How FlakeHub flake URLs work
Here’s the structure of URLs for flakes on FlakeHub:
https://flakehub.com/f/:org/:project/:version-req.tar.gz
staticrequired
Org | Repo | Version | Example Nix command |
---|---|---|---|
ryantm | agenix | 0.13 | nix flake show https://flakehub.com/f/ryantm/agenix/0.13 |
NixOS | nixpkgs | * | nix flake show https://flakehub.com/f/NixOS/nixpkgs/* |
NixOS | nixpkgs | ~0.2305 | nix flake show https://flakehub.com/f/NixOS/nixpkgs/~0.2305 |
NixOS | nix | =2.17.0 | nix flake show https://flakehub.com/f/NixOS/nix/=2.17.0 |
The version-range
segment defines the boundaries of the versions you want.
The range isn’t an exact version number but rather a SemVer version constraint, which provides predictable upgrades.
FlakeHub’s version solver behaves like Cargo’s version solver. Here are some example version ranges and how they’re interpreted:
- 1.0.1 is always 1.0.1 and never upgrades to 2.0.0.
- 0.1.1 returns at least 0.1.1 but never upgrades to 0.2.0.
FlakeHub also offers a few comparison operators, which generally shouldn’t be necessary.
Tilde operator (~
)
The tilde (~
) reduces the maximum version boundary when specifying the major and minor versions.
The version constraint ~1.0
, for example, upgrades to any version between 1.0 and 1.1 but not to 1.1.
Wildcard operator (*
)
The wildcard (*
) allows for any version in that position.
- The version range
*
always uses the highest published version. 1.2.*
allows any version with the major and minor version 1.2.
Equals operator (=
)
The equals (=
) operator enables users to specify exactly one version with no room to update.
=3.2.1
always returns version 3.2.1.