Flake Generator Endpoint
Flake Generator Endpoint
We provide a couple of flake related endpoints that can generate a fully working flake with the package specs you provide.
These endpoints are located at the flake.nix
and flake.zip
paths:
# Generate a flake.nix containing latest ruby and nodejs.
curl https://nix-versions.alwaysdata.net/flake.nix/ruby@latest/nodejs@latest -o flake.nix
# An archive containing flake.nix. This is useful as input for your own flakes.
curl https://nix-versions.alwaysdata.net/flake.zip/ruby@latest/nodejs@latest -o flake.zip
Keeping up to date with versioned packages
One advantage of using pinned-versions flakes as inputs for your own flakes is that if you have:
{
inputs.tools.url = "https://nix-versions.alwaysdata.net/flake.zip/go@~1.24/*.pip@25";
}
then, every time you do nix flake update tools
you are certain that if new versions of go or pip are available matching their respective constraint, you will get the new versions. But if an incompatible version is availabe you wont get that update, preventing potential problems in your dev environment.
This ensures your packages are still updated but compatible with the version constraint you identify as stable releases.
Generated Flake outputs
You can inspect the content of generated flake.zip with the following command:
nix flake show https://nix-versions.alwaysdata.net/flake.zip/go@1.24.x/ruby@~3.4 --no-write-lock-file
Requesting for go@1.24.x
and ruby@~3.4
will generate a flake with the following structure:
{
overlays.default # An overlay containing `{ ruby = ...; go = ...; }` at their respective versions.
packages.${system} = {
go = ...; # Go package at specified version
ruby = ...; # Ruby package at specified version
default = ...; # An envrionment (`buildEnv`) contaning the paths of specified tools.
};
devShells.${system} = {
default = ...; # A numtide/devshell with the specified tools.
};
}
The flake itself is generated by using ntv and uses its flakeModules to create flake outputs.
Using nix develop
with flake.zip
endpoint.
You can create quick one-shot environments by using the following command:
nix develop https://nix-versions.alwaysdata.net/flake.zip/go@1.24.x/ruby@~3.4 --no-write-lock-file
Using as input
on your own flakes.
If you need to pin some tools to specific versions on your own flakes, just use our flake.zip
endpoint.
{
inputs.tools.url = "https://nix-versions.alwaysdata.net/flake.zip/go@~1.24";
outputs = inputs: {
# Go 1.24 is available at:
# inputs.tools.packages.${system}.go
};
}
Using as input
on devenv environments.
On your devenv.yaml
file define an input:
inputs:
tools:
url: "https://nix-versions.alwaysdata.net/flake.zip/go@~1.24"