Error following "Your first package": attribute 'nix' in selection path 'hello.nix' not found

I’m following Packaging existing software with Nix — nix.dev documentation and I get error error: attribute 'nix' in selection path 'hello.nix' not found when I issue nix-build -A hello as instructed in Building with nix-build.

I did update https://github.com/NixOS/nixpkgs/tarball/nixos-24.05 to https://github.com/NixOS/nixpkgs/tarball/nixos-24.11 which I believe should be changed in the documentation aswell.

Please, let me know what am I doing wrong. Thx!

What modifications did you make to the default.nix file? You didn’t, by chance, replace ./hello.nix with hello.nix in that file, did you?

2 Likes

Strange thing. I got the error I described above from within terminal in vi. I did it outside just now I don’t get the error anymore. Not clear to me what the difference is. Anyway, it works now. Thx, rhendric!