Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: directory '"/nix/store/46p1z0w9ad605kky62dr53z4h24k2a5r-nix-2.25.3/bin/nix"' does not appear to be part of a Nix profile #1362

Open
nalzok opened this issue Dec 26, 2024 · 4 comments
Assignees

Comments

@nalzok
Copy link

nalzok commented Dec 26, 2024

Hi there! I have some trouble installing/updating Nix on a fresh installation of macOS 15.2 (24C101). I executed the installation command curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install, opened a new shell session, and ran sudo -i nix upgrade-nix to update Nix, only to got the following error message:

qys@gloaming ~ % nix --version          
nix (Nix) 2.25.3
qys@gloaming ~ % sudo -i nix upgrade-nix
Password:
error: directory '"/nix/store/46p1z0w9ad605kky62dr53z4h24k2a5r-nix-2.25.3/bin/nix"' does not appear to be part of a Nix profile

I understand that I'm already using the latest Nix version (since I just installed Nix), but the error message is concerning!

@rosstimson
Copy link

Same here, tried multiple uninstall, reboot, reinstalls etc and looking for any leftover files/dirs to cleanup. This used to work no problem so not sure what has went wrong but admittedly I do not know nix well.

@rosstimson
Copy link

@nalzok I think I've managed to fix this by doing the following:

  1. nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
  2. nix-channel --update
  3. nix-env -iA nixpkgs.nix
  4. Just to verify: nix-channel --list prior to the above steps I didn't seem to have any channels
  5. After these steps I tried again and got:
$ sudo -i nix upgrade-nix
replacing old 'nix-2.24.11'
installing 'nix-2.25.3'

Pretty certain this is just a lack of nix experience/understanding but it does seem odd a fresh install doesn't allow this to work just out the box, I'm sure it used to when I last tinkered with nix a year or so ago.

@nalzok
Copy link
Author

nalzok commented Jan 3, 2025

Thanks @rosstimson, I can confirm that it works! For some reason I'm still getting the 24.11 version, maybe because I'm using nix-darwin?

$ sudo -i nix upgrade-nix
replacing old 'nix-2.24.11'
installing 'nix-2.24.11'
building '/nix/store/jcf1r42xbjq29dhnfjqbfw16cb3mlbdl-user-environment.drv'...

Anyway, I don't think we are supposed to do this manually. Installing a package on the command line with nix-env -iA is an imperative action that kind of defeats the declarative nature of Nix, so it is discouraged. At the end of the day, it is the Determinate Nix Installer's responsibility to ensure that sudo -i nix upgrade-nix works out of the box (not sure if that's possible though, but perhaps we can replace nix-env -iA with an entry in environment.systemPackages?)

@Tyrubias
Copy link

Tyrubias commented Jan 4, 2025

I've run into this issue too but I can't use the approach @rosstimson suggested because I'm using nix profile. Does anyone have any suggestions for how to proceed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants