I’m trying to test a newer version of Nix to debug an issue and when I try using nixpkgs it fails with:
> nix profile install nixpkgs\#nix_2_18
error: flake 'flake:nixpkgs' does not provide attribute 'packages.x86_64-linux.nix_2_18', 'legacyPackages.x86_64-linux.nix_2_18' or 'nix_2_18'
Did you mean one of nix_2_3, nix_2_4, nix_2_5 or nix_2_6?
So I tired using nixos-unstable:
> nix profile install nixpkgs/nixos-unstable\#nix_2_18
error: flake 'flake:nixpkgs/nixos-unstable' does not provide attribute 'packages.x86_64-linux.nix_2_18', 'legacyPackages.x86_64-linux.nix_2_18' or 'nix_2_18'
Did you mean one of nix_2_3, nix_2_4, nix_2_5 or nix_2_6?
But that doesn’t work either, despite nix_2_18 is clearly available in nixos-unstable:
And as far as I can tell it doesn’t properly explain where it gets the source of nixpkgs. There is this:
The Nix search path is initialized from the colon-separated NIX_PATH environment variable, and is used to look up the location of Nix expressions using paths enclosed in angle brackets (i.e., <nixpkgs> ).
When you refer to flakes without a URI, they are taken from the flake registry. nixpkgs usually refers to unstable unless you’ve explicitly changed it.
That said, the package you’re looking for is nixpkgs#nixVersion.nix_2_18, or github:NixOS/nixpkgs/nixos-unstable#nixVersion.nix_2_18 if you configured your registry to point at a different branch.
> nix profile install nixpkgs\#nixVersion.nix_2_18
error: flake 'flake:nixpkgs' does not provide attribute 'packages.x86_64-linux.nixVersion.nix_2_18', 'legacyPackages.x86_64-linux.nixVersion.nix_2_18' or 'nixVersion.nix_2_18'
Did you mean nixVersions?
And neither does this:
> nix profile install github:NixOS/nixpkgs/nixos-unstable\#nixVersion.nix_2_18
error: flake 'github:NixOS/nixpkgs/nixos-unstable' does not provide attribute 'packages.x86_64-linux.nixVersion.nix_2_18', 'legacyPackages.x86_64-linux.nixVersion.nix_2_18' or 'nixVersion.nix_2_18'
Did you mean nixVersions?
I also tried some other approaches like:
> nix profile install -I nixpkgs=github:NixOS/nixpkgs/nixos-unstable nixpkgs\#nixVersion.nix_2_18
error: flake 'flake:nixpkgs' does not provide attribute 'packages.x86_64-linux.nixVersion.nix_2_18', 'legacyPackages.x86_64-linux.nixVersion.nix_2_18' or 'nixVersion.nix_2_18'
Did you mean nixVersions?
> nix profile install -I nixpkgs=github:NixOS/nixpkgs/nixos-unstable nixpkgs\#nix.nix_2_18
error: flake 'flake:nixpkgs' does not provide attribute 'packages.x86_64-linux.nix.nix_2_18', 'legacyPackages.x86_64-linux.nix.nix_2_18' or 'nix.nix_2_18'
Did you mean lib?
> nix profile install -I nixpkgs=github:NixOS/nixpkgs/nixos-unstable nixpkgs\#nix_2_18
error: flake 'flake:nixpkgs' does not provide attribute 'packages.x86_64-linux.nix_2_18', 'legacyPackages.x86_64-linux.nix_2_18' or 'nix_2_18'
Did you mean one of nix_2_3, nix_2_4, nix_2_5 or nix_2_6?
I really don’t understand how this is supposed to work.