Not sure I fully understand. Deleting the file (symlink) ($HOME/.nix-profile
) renders the nix profile
command non-operational:
$ nix profile install nix
-bash: /home/sylvain/.nix-profile/bin/nix: No such file or directory
From following the symlinks, the ~/.nix-profile
links to
$ ls -l .nix-profile
.nix-profile -> /nix/var/nix/profiles/per-user/sylvain/profile
$ ls -l /nix/var/nix/profiles/per-user/sylvain/profile
/nix/var/nix/profiles/per-user/sylvain/profile -> profile-7-link
$ ls -l /nix/var/nix/profiles/per-user/sylvain/profile-7-link
/nix/var/nix/profiles/per-user/sylvain/profile-7-link -> /nix/store/9sjphl1izy2f9xw2ksz0ndh63fqdhvl6-profile
It seems that whatever I delete I won’t have the bin/nix
command available, as I currently only have one profile.
$ ls -l /nix/var/nix/profiles/per-user/sylvain/profile*
/nix/var/nix/profiles/per-user/sylvain/profile -> profile-7-link
/nix/var/nix/profiles/per-user/sylvain/profile-7-link -> /nix/store/9sjphl1izy2f9xw2ksz0ndh63fqdhvl6-profile
So, I installed to a different profile as you suggested:
$ nix profile --profile ~/.nix-profile2 install nix
Deleted ~/.nix-profile
, and copied ~/.nix-profile2
into default profile location (~/.nix-profile
):
cp -r ~/.nix-profile2 ~/.nix-profile
There’s probably a simpler way to do this … and I’m not sure this approach actually works, as when I run nix profile upgrade nix
I get:
$ nix profile upgrade nix
warning: 'nix' does not match any packages
warning: Use 'nix profile list' to see the current profile.
$ nix profile list
0 flake:nix#defaultPackage.x86_64-linux github:NixOS/nix/92b8d4d8861b908a7ec500526a84155c597d6d2b#defaultPackage.x86_64-linux /nix/store/fxygga1i4s95xrpq943qdbqpk3qwy79z-nix-2.8.0pre20220307_92b8d4d
My original profile, with the nix
that I cannot figure out how to upgrade:
$ nix profile list
0 - - /nix/store/j3z4bd88qk6ln7ykikxa1bb612pjjvkx-cachix-0.7.0
1 - - /nix/store/6wljmq98mf555cqqahjryjbkpsg6jlx3-nix-2.7pre20220124_0a70b37
2 - - /nix/store/m2hr19fnix4qsd14j3wdw9kijz3x2l72-rust_carnix-0.10.0
3 - - /nix/store/xn2vp71in8fpnz0viqs66s0lqdvcp7vi-niv-0.2.19-bin
4 - - /nix/store/8n83ig414sxywz9qqc53d15ww7g08c3l-python3.9-nix-prefetch-github-5.0.1
5 github:kamadorueda/alejandra/0.7.0#defaultPackage.x86_64-linux github:kamadorueda/alejandra/a618751be3605f08e5bd2ddde6ee06a0b0d8723c#defaultPackage.x86_64-linux /nix/store/qrhvl59ap9v5sv70hhppb355b04qbviw-alejandra-0.7.0+20220228.a618751
Removed nix
with:
$ nix profile remove nix
Re-installed, using the explicit path to nix
, since it is no longer symlinked, e.g.:
$ /nix/var/nix/profiles/per-user/sylvain/profile-7-link/bin/nix profile install nix
Now:
$ nix profile list
0 - - /nix/store/j3z4bd88qk6ln7ykikxa1bb612pjjvkx-cachix-0.7.0
1 - - /nix/store/m2hr19fnix4qsd14j3wdw9kijz3x2l72-rust_carnix-0.10.0
2 - - /nix/store/xn2vp71in8fpnz0viqs66s0lqdvcp7vi-niv-0.2.19-bin
3 - - /nix/store/8n83ig414sxywz9qqc53d15ww7g08c3l-python3.9-nix-prefetch-github-5.0.1
4 github:kamadorueda/alejandra/0.7.0#defaultPackage.x86_64-linux github:kamadorueda/alejandra/a618751be3605f08e5bd2ddde6ee06a0b0d8723c#defaultPackage.x86_64-linux /nix/store/qrhvl59ap9v5sv70hhppb355b04qbviw-alejandra-0.7.0+20220228.a618751
5 flake:nix#defaultPackage.x86_64-linux github:NixOS/nix/92b8d4d8861b908a7ec500526a84155c597d6d2b#defaultPackage.x86_64-linux /nix/store/fxygga1i4s95xrpq943qdbqpk3qwy79z-nix-2.8.0pre20220307_92b8d4d
Still not sure how to upgrade though:
$ nix profile upgrade 5
error: opening directory '/nix/store/azanfdwpnpwsq2iwdzjf9zkb5b9fqqb1-nix-2.8.0pre20220307_92b8d4d-doc': No such file or directory