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

default.nix: More thoroughly explain the macOS upgrade process #46207

Closed
wants to merge 1 commit into from

Conversation

grahamc
Copy link
Member

@grahamc grahamc commented Sep 6, 2018

Motivation for this change

The install instructions broke an IRC user, floop's setup and was pretty frustrating.

error: evaluation aborted with the following error message: '
This version of Nixpkgs requires Nix >= 2.0, please upgrade:

- If you are running NixOS, `nixos-rebuild' can be used to upgrade your system.

- If you have a multi-user Nix installation on macOS, update Nix by running:

      sudo -i nix-store -r /nix/store/lc3ymlix73kaad5srjdgaxp9ngr1sg6g-nix-2.1.1;
      sudo -i /nix/store/lc3ymlix73kaad5srjdgaxp9ngr1sg6g-nix-2.1.1/bin/nix-env --uninstall nix
      sudo -i /nix/store/lc3ymlix73kaad5srjdgaxp9ngr1sg6g-nix-2.1.1/bin/nix-env -i /nix/store/lc3ymlix73kaad5srjdgaxp9ngr1sg6g-nix-2.1.1
      sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist
      sudo launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist

    if you have done that and still see this error message, also run:

      /nix/store/lc3ymlix73kaad5srjdgaxp9ngr1sg6g-nix-2.1.1/bin/nix-env -i /nix/store/lc3ymlix73kaad5srjdgaxp9ngr1sg6g-nix-2.1.1

- If you installed Nix using the install script (https://nixos.org/nix/install),
  it is safe to upgrade by running it again:

      curl https://nixos.org/nix/install | sh

For more information, please see the NixOS release notes at
https://nixos.org/nixos/manual or locally at
/home/grahamc/projects/nixpkgs/doc/manual/release-notes.

If you need further help, see https://nixos.org/nixos/support.html
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@grahamc grahamc requested a review from nbp as a code owner September 6, 2018 21:00
@GrahamcOfBorg GrahamcOfBorg added the 6.topic: darwin Running or building packages on Darwin label Sep 6, 2018
Copy link
Member

@LnL7 LnL7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should make this part conditional based on builtins.currentSystem.

upgrade Nix. You may use `nix-env --version' to check which version you have.
- If you have a multi-user Nix installation on macOS, update Nix by running:

sudo -i nix-store -r ${fallback-paths.x86_64-darwin};
Copy link
Member

@LnL7 LnL7 Sep 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, semicolon and sudo

- If you have a multi-user Nix installation on macOS, update Nix by running:

sudo -i nix-store -r ${fallback-paths.x86_64-darwin};
sudo -i ${fallback-paths.x86_64-darwin}/bin/nix-env --uninstall nix
Copy link
Member

@LnL7 LnL7 Sep 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be necessary given the next step, and might result in the user loosing their reference to nix-store/nix-env.

sudo -i nix-store -r ${fallback-paths.x86_64-darwin};
sudo -i ${fallback-paths.x86_64-darwin}/bin/nix-env --uninstall nix
sudo -i ${fallback-paths.x86_64-darwin}/bin/nix-env -i ${fallback-paths.x86_64-darwin}
sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be more reliable sudo launchctl remove org.nixos.nix-daemon.

@infinisil
Copy link
Member

I'm not sure if this is the right place to fix this, shouldn't this be in the installer instead?

@grahamc
Copy link
Member Author

grahamc commented Sep 6, 2018

@infinisil the installer and the Nix documentation can't be updated without doing a full Nix release, unfortunately.

@infinisil
Copy link
Member

@grahamc Is there a problem with doing a 2.1.1 release to fix the macOS installation? It's obviously a problem with Nix, not nixpkgs

@LnL7
Copy link
Member

LnL7 commented Sep 12, 2018

I ran into a kind of similar problem today.

A coworker followed https://nixos.org/nix/manual/#ch-upgrading-nix to upgrade, but ended up actually downgrading from 2.0 to 1.11.6 due to the channel. I had to either perform an intermediate upgrade or grep for *fallback* and run something like this to recover because the current message was useless.

find /nix/var/nix/profiles -name '*fallback*.nix'
sudo -i NIX_SSL_CERT_FILE=$NIX_SSL_CERT_FILE nix-env -i /nix/store/lc3ymlix73kaad5srjdgaxp9ngr1sg6g-nix-2.1.1
sudo launchctl remove org.nixos.nix-daemon
sudo launchctl load /Library/LaunchDaemons/org.nixos.nix-daemon.plist

NOTE: nix upgrade-nix fixes this, but had a bug in 2.0 making this whole situation kind of awkward.

@mmahut
Copy link
Member

mmahut commented Aug 7, 2019

Any updates on this pull request, please?


This version of Nixpkgs requires Nix >= ${requiredVersion}, please upgrade:

- If you are running NixOS, `nixos-rebuild' can be used to upgrade your system.

- Alternatively, with Nix > 2.0 `nix upgrade-nix' can be used to imperatively
upgrade Nix. You may use `nix-env --version' to check which version you have.
- If you have a multi-user Nix installation on macOS, update Nix by running:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we detect this scenario so we don't give confusing instructions to the user?

Alternatively, could we instead update the install script to detect an existing multi-user install and clean it up appropriately?

@stale
Copy link

stale bot commented Jun 1, 2020

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@samuela
Copy link
Member

samuela commented Sep 24, 2020

Is this PR still up-to-date after the macOS Catalina issues (eg NixOS/nix#2925)?

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Sep 24, 2020
@stale
Copy link

stale bot commented Mar 26, 2021

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

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 26, 2021
@Artturin Artturin closed this Apr 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: darwin Running or building packages on Darwin 10.rebuild-darwin: 0 10.rebuild-linux: 0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants