Repository navigation
Description
The Nix package manager should have a command to update the current version of Nix; this would prevent the hoops that I'm currently jumping through:
- Try to update an old machine with NixOS installed (from about 12 or 13 months ago), and watch it fail because the installed version of Nix is too old to evaluate the latest Nixpkgs.
- Consult https://nixos.org/wiki/How_to_update_when_Nix_is_too_old_to_evaluate_Nixpkgs, which suggests:
curl -L https://hydra.nixos.org/job/nixos/trunk-combined/nixpkgs.nix.x86_64-linux/latest-finished/nix/pkg/nix-1.10-x86_64-linux.nixpkg | nix-install-package --non-interactive - - ... which fails because, as Hydra reports, "Path /nix/store/6nkzpsw9wq4gfn84c4d0shjs9hqyw9jy-nix-1.11.4-debug is no longer available."
- Click through Hydra and try to find a recent evaluation, hoping that the store path hasn't disappeared.
- Find the nixos:trunk-combined:nixpkgs.nix.x86_64-linux job, find the latest evaluation (evaluated on 2016-10-29 18:50:01), and then try to fetch the "One-Click Install" build product.
- Get presented with a 404: "Path /nix/store/5q4rqc1fv1vi8z9g6ni0jlf7b802vm67-nix-1.11.4-debug is no longer available."
- Realize that I could just
nix-store --export $(nix-store -qR $(which nix-build)) > nix.closurefrom my up-to-date machine, copy that to a USB drive, and thennix-store --import nix.closureon the old machine. - That fails with: "error: imported archive of '/nix/store/....-glibc-2.24' lacks a signature" (despite having
nix.requireSignedBinaryCaches = false;configured) - Have no idea what to do about the missing signature.
I still haven't figure out how I'm going to upgrade, but I figure the next step is going to be trying to install from source, and hope that any transitive dependencies don't get me stuck in some sort of catch 22 scenario.
In my case, I've been using Nix/NixOS for a while now and am thoroughly convinced of the benefits (even if things get pretty damned bumpy every now and then), so this isn't going to turn me off. For new users, though, this sort of scenario would very likely be the thing that makes them say "fuck it" and warn their friends.
What we really need is a single command that can get people unstuck in these scenarios.
Activity
cstrahan commentedon Oct 29, 2016
Note that while
nix-copy-closurehas the--signflag documented in the Nix manual, the same is not true fornix-store --export.Also, while there used to be
doc/signing.txtin the repo, it has since been removed, and there is no mention of how to generate/etc/nix/signing-key.{pub,sec}in the Nix manual.groxxda commentedon Oct 29, 2016
It's a known issue that the links on hydra are dead since the packages are uploaded to s3.
The workaround is to use
nix-store --realise /nix/store/....to download the wanted path.That the wiki provides an outdated solution that does not work anymore is (at least) unfortunate. Since porting the wiki content is progressing so slow, we should really consider updating that single wiki page because people report this regularly....
groxxda commentedon Oct 29, 2016
I think that signing keys can be generated with
nix-store --generate-binary-cache-key <keyid> <secret-file-out> <signature-out>cstrahan commentedon Oct 29, 2016
@groxxda Is there a way that Hydra could provide links to S3, then? Or at least not pretend to have direct links (e.g. keep the list of build products, but remove the
<a href="...">bits)? As it stands, this is pretty confusing.cstrahan commentedon Oct 29, 2016
Oh, and thanks for the
nix-store --realizetip; I'll give that a go.groxxda commentedon Oct 29, 2016
@cstrahan NixOS/hydra#321 is about the broken links on hydra.
cstrahan commentedon Oct 29, 2016
Not having much luck with signing:
Guess I'll go for the
--realizeapproach.groxxda commentedon Oct 29, 2016
Okay sorry, my advice was incorrect.
But generating with openssl should work as described here: doc/[email protected]
cstrahan commentedon Oct 29, 2016
I ended up isolating Firefox as being the only thing that wouldn't evaluate in my config (as it, or one of its dependencies, uses a sha512 somewhere). I just commented that out and I'm now updating.
Before that, I tried
sudo nix-env -i /nix/store/75l105a6h71mliypp6madr9y1mvwp5nc-nix-1.11.4, butnixos-rebuildsomehow kept using the old nix, rather than the new one fromroot's$PATH.groxxda commentedon Oct 29, 2016
I think you could have forced nixos-rebuild to use nix from path with
_NIXOS_REBUILD_REEXEC=1 nixos-rebuild ...domenkozar commentedon Oct 29, 2016
Next Nix UI will have
nix upgradecommand.vcunat commentedon Oct 30, 2016
IIRC with sha512 there matters what version the nix daemon is running; I think nix will bypass the daemon if executing the command as root.
We recently discussed these on ML http://lists.science.uu.nl/pipermail/nix-dev/2016-June/020891.html . A problem is that there probably isn't a catch-all way, as you might be using rpm/deb to install nix, for example.
cleverca22 commentedon Nov 25, 2016
one thing of note, you don't have to mess with export, copy-closure, or signing at all in 90% of cases
run this on any machine with the newer channel, and the correct arch, then do this on the older machine:
and you now have the new nix, manually add it to $PATH and _NIXOS_REBUILD_REEXEC, or if its not nixos, just nix-env -i the above path
jcrben commentedon Feb 28, 2018
is this resolved by Nix 2.0 which has
nix upgrade-nixper the release notes https://nixos.org/nix/manual/#ssec-relnotes-2.0commando-crypto commentedon Nov 28, 2018
@cstrahan @copumpkin can close this "fixed"
jcrben commentedon Jan 29, 2019
Left a question about the where the new
nix upgrade-nixcommand fits in at #1899 (comment)