Listing package versions
Listing package versions
Section titled “Listing package versions”In the following example, emacs@* is a package spec. Requesting emacs at any version.
And is equivalent to just emacs or emacs@ with an empty constraint.
nix-versions emacs@*If you want to know the emacs version available on your system’s nixpkgs tree,
use the system: backend prefix. More on backend prefixes here.
nix-versions system:emacs@Semantic Version Constraints
Section titled “Semantic Version Constraints”A version constraint lets you filter by only those versions that match a particular release set.
This is a very useful feature when you need to keep your tools in a range of known, stable versions. For example, you might need that your compiler/interpreter is always compatible with your current code, even if the nixpkgs tree is bleeding edge and contains latest versions that you might be not be ready to use.
SemVer Constraint Syntax
Section titled “SemVer Constraint Syntax”Using the previous emacs example, lets filter by just a pair of release series.
nix-versions 'emacs@~27 || ~29'--all (short -a)
Section titled “--all (short -a)”Use --all to visualize the matching versions compared to all others.
nix-versions 'emacs@~27 || ~29' --allAs you can see, coloring can help visualising the selected versions matching a specified constraint and also
the latest version in all the set. You can turn off colors using the --color=false option.
--one (short -1)
Section titled “--one (short -1)”Use --one to show only the latest version that matches a specified constraint.
nix-versions 'emacs@~27 || ~29' --oneRegexp Version Constraints
Section titled “Regexp Version Constraints”Sometimes packages do not follow SemVer conventions. In those cases you can specify a regular expression to match on versions.
Enable Regexps by ending your constraint with the $ symbol.
Since $ is an invalid character on SemVer constraint syntax, we use it to identify
when a constraint should be matched as a regexp. So, always try to start your regexp
expression with ^ and end it with $.
nix-versions 'leanify@^27\.[0-9]+$'