Skip to content

upgrade-nix can downgrade nix #1899

Open

Description

@andrewthad

Here's the problem:

$ curl https://nixos.org/nix/install | sh
$ nix --version
nix (Nix) 2.0
$ nix upgrade-nix
$ nix --version
-bash: /home/amartin/.nix-profile/bin/nix: No such file or directory
$ nix-env --version
nix-env (Nix) 1.11.16

This happens because nix-2.0 is not technically considered stable even though the recommended download instructions say:

The latest and recommended version of Nix is 2.0.

I would recommend that the upgrade-nix subcommand refuse to ever replace a newer version of nix with an older one.

Activity

  1. self-assigned this
    on Apr 1, 2018
  2. Wizek commented on Apr 24, 2018

    @Wizek

    Is there a reliable/recommended way to downgrade? I'm trying to make nix usable on windows (WSL) again, but I am running into #2021 with nix-2.0, so I am trying to downgrade to see if that is a workaround until a proper fix arrives.

  3. jcrben commented on Jan 29, 2019

    @jcrben

    Is there a reliable/recommended way to downgrade?

    Given the advice at in the manual https://nixos.org/nix/manual/#ch-upgrading-nix on upgrading which advises to use the nix channel itself (@grahamc authored c42eaaf), pinning to specific older version of nixpkgs as described in NixOS/nixpkgs#27994 may be the way to go for downgrading?

    You could also installed a pinned version per https://nixos.org/nix/manual/#sect-nix-install-pinned-version-url

    Not really clear why we need nix upgrade-nix if we can use the normal package installation method.

  4. stale commented on Feb 14, 2021

    @stale

    I marked this as stale due to inactivity. → More info

  5. coderfromhere commented on Jul 16, 2021

    @coderfromhere

    I'm experiencing a similar issue, nix upgrade-nix doesn't see releases above 2.3.11

  6. domenkozar commented on Jul 16, 2021

    @domenkozar
    Member
  7. stale commented on Apr 17, 2022

    @stale

    I marked this as stale due to inactivity. → More info

  8. added
    UX
    new-cli
    on Oct 6, 2022
  9. poliorcetics commented on Feb 25, 2024

    @poliorcetics
    Contributor

    I'm on macOS, it's trying to go down 2 minor versions at the moment:

    replacing old 'nix-2.20.3'
    installing 'nix-2.18.1'
    
  10. pavelpulec commented on Apr 22, 2024

    @pavelpulec

    Hi,
    Does anyone has any workaround how to upgrade Nix back to the newest unstable version?
    🙇‍♂️

  11. grahamc commented on Apr 22, 2024

    @grahamc
    Member

    A one-time option is to manually specify the source fallback paths:

    nix upgrade-nix --nix-store-paths-url https://releases.nixos.org/nix/nix-2.21.2/fallback-paths.nix
    

    though for the Determinate Nix installer, we've been including this in the nix.conf to make it behave more predictably and to track the latest version we've validated:

    # nix.conf
    upgrade-nix-store-path-url = https://install.determinate.systems/nix-upgrade/stable/universal

    Note: this option is new as of 2.19.0. If you're on 2.18, you'll need to run nix upgrade-nix --nix-store-paths-url https://install.determinate.systems/nix-upgrade/stable/universal once first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

UXnew-cli

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions