nix-installer icon indicating copy to clipboard operation
nix-installer copied to clipboard

upgrade-nix downgrades, easy to miss readme comment

Open dezren39 opened this issue 2 years ago • 6 comments

image hello! the determinate nix installer worked very well once i enabled systemd in wsl2. i was following the steps and thought i'd upgrade just in case and it downgraded me :-) https://github.com/DeterminateSystems/nix-installer?tab=readme-ov-file#upgrading-nix i do see that the step does link and let you know where it comes from https://raw.githubusercontent.com/NixOS/nixpkgs/master/nixos/modules/installer/tools/nix-fallback-paths.nix and so maybe it's not an issue, but it may be a good idea to make a bigger bolder warning there if it's going to be a long-standing difference, especially with notable flake issues with 2.17.0 and 2.18.1.

replacing old 'nix-2.18.1'
installing 'nix-2.17.0'
[user@DESKTOP-P1BL9NE ~]$ curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
info: downloading installer https://install.determinate.systems/nix/tag/v0.14.0/nix-installer-x86_64-linux
`nix-installer` needs to run as `root`, attempting to escalate now via `sudo`...
Nix install plan (v0.14.0)
Planner: linux (with default settings)

Planned actions:
* Create directory `/nix`
* Fetch `https://releases.nixos.org/nix/nix-2.18.1/nix-2.18.1-x86_64-linux.tar.xz` to `/nix/temp-install-dir`
* Create a directory tree in `/nix`
* Move the downloaded Nix into `/nix`
* Create build users (UID 30000-30032) and group (GID 30000)
* Setup the default Nix profile
* Place the Nix configuration in `/etc/nix/nix.conf`
* Configure the shell profiles
* Configure Nix daemon related settings with systemd
* Remove directory `/nix/temp-install-dir`


Proceed? ([Y]es/[n]o/[e]xplain): y
 INFO Step: Create directory `/nix`
 INFO Step: Provision Nix
 INFO Step: Create build users (UID 30000-30032) and group (GID 30000)
 INFO Step: Configure Nix
 INFO Step: Create directory `/etc/tmpfiles.d`
 INFO Step: Configure Nix daemon related settings with systemd
 INFO Step: Remove directory `/nix/temp-install-dir`
Nix was installed successfully!
To get started using Nix, open a new shell or run `. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh`

[user@DESKTOP-P1BL9NE ~]$ `. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
> ^C
[user@DESKTOP-P1BL9NE ~]$ . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
[user@DESKTOP-P1BL9NE ~]$ sudo -i nix upgrade-nix
replacing old 'nix-2.18.1'
installing 'nix-2.17.0'
building '/nix/store/b1vjgglfs4lji3016xklqvd9dbl8mv6b-user-environment.drv'...
[user@DESKTOP-P1BL9NE ~]$

dezren39 avatar Oct 28 '23 23:10 dezren39

maybe advertise 'if you're using flakehub, do not run this plain command, see this link to learn about' https://flakehub.com/docs#upgrade-nix

dezren39 avatar Oct 28 '23 23:10 dezren39

i too noticed this problem

xd003 avatar Oct 30 '23 10:10 xd003

😅 This is not always the case, but indeed a better warning it a good idea.

Hoverbear avatar Oct 30 '23 15:10 Hoverbear

The version file no longer exists, so the documentation is less clear now. See #928.

DanLipsitt avatar Apr 10 '24 05:04 DanLipsitt

maybe advertise 'if you're using flakehub, do not run this plain command, see this link to learn about' https://flakehub.com/docs#upgrade-nix

Oops, it looks like this document isn't there anymore either.

DanLipsitt avatar Apr 10 '24 05:04 DanLipsitt

I was able to work around this by using the versions.nix from an earlier (but still newer than what I had installed) tag of the nix repo:

sudo -i nix upgrade-nix --nix-store-paths-url https://github.com/DeterminateSystems/nix/raw/v2.20.5/versions.nix

DanLipsitt avatar Apr 10 '24 05:04 DanLipsitt