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

nix upgrade-nix does not detect 2.4 #5503

Open
Dzieni opened this issue Nov 5, 2021 · 6 comments
Open

nix upgrade-nix does not detect 2.4 #5503

Dzieni opened this issue Nov 5, 2021 · 6 comments
Labels

Comments

@Dzieni
Copy link

Dzieni commented Nov 5, 2021

Describe the bug

My collegaue has problems with remote builds using Nix 2.4. To see if it's a matter of different Nix version (I use 2.3 myself), I wanted to upgrade. However, I'm not sure how to do this.

Steps To Reproduce

  1. Run nix-channel --update, then nix upgrade-nix.

Expected behavior

According to --help, it should upgrade Nix to the latest stable version. Latest stable version is 2.4, but I get this output instead:

[0.0 MiB DL]
replacing old 'nix-2.3.16'
installing 'nix-2.3.16'
upgrade to version 2.3.16 done

nix-env --version output

2.3.16, as mentioned above.

Additional context

I also tried to upgrade using nix-env -u and it managed to upgrade to nix-2.4pre-rc1. Then, after running nix upgrade-nix, it downgraded to 2.3:

replacing old 'nix-2.4pre-rc1'
installing 'nix-2.3.16'

OS: macOS Big Sur 11.3.1

@Dzieni Dzieni added the bug label Nov 5, 2021
@Dzieni
Copy link
Author

Dzieni commented Nov 5, 2021

Is it possibly related to the fact that I run my Nix single-user and it's no longer supported in v2.4?

https://github.com/NixOS/nix/blob/2.4-maintenance/scripts/install-nix-from-closure.sh#L63

If so, I think it should be mentioned in release notes...?

@abathur
Copy link
Member

abathur commented Nov 5, 2021

Is it possibly related to the fact that I run my Nix single-user and it's no longer supported in v2.4?

No. Upgrade pulls the latest version from a file in nixpkgs (which still indicates 2.3.16).

I am not sure exactly what the criteria for updating it is, but I assume this is waiting for nixpkgs itself to complete updating (see NixOS/nixpkgs#144197).

@Dzieni
Copy link
Author

Dzieni commented Nov 5, 2021

@abathur does it mean that the best workaround for now is to just reinstall Nix from scratch?

@abathur
Copy link
Member

abathur commented Nov 5, 2021

I would personally treat that as a last resort, if you need exactly the same version. (uninstall/reinstall experience has sharp corners and can be frustrating). Nixpkgs also includes a nixUnstable attr (also known as nixFlakes) which should be a pre-2.5 build that isn't too far ahead of 2.4 at this point.

I haven't tried using this via nix-env, but if the wiki page for flakes is right, something like nix-env -iA nixpkgs.nixUnstable should work.

@abathur
Copy link
Member

abathur commented Nov 9, 2021

The nixpkgs PR I mentioned before has been merged--this should work now.

@matu3ba
Copy link

matu3ba commented Sep 3, 2022

I can confirm that this works now:

[user@pc zsh]$ nix --version
nix (Nix) 2.4pre20210429_d15a196
[user@pc zsh]$ nix upgrade
error: 'upgrade' is not a recognised command
Try 'nix --help' for more information.
[user@pc zsh]$ nix --help
[user@pc zsh]$ nix-channel --update
unpacking channels...
[user@pc zsh]$ nix upgrade-nix
replacing old 'nix-2.4pre20210429_d15a196'
installing 'nix-2.11.0'
building '/nix/store/lyrzv64mi81lj04fh0qjg6vx5xbqmm6i-user-environment.drv'...
[user@pc zsh]$ nix --version
nix (Nix) 2.11.0
[user@pc zsh]$

@stale stale bot removed the stale label Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants