I’m seeing some breakage on my Catalina nix install that I’ve never seen before. Observe:
$ darwin-rebuild
zsh: command not found: darwin-rebuild
Then,
$ ls -l /run/current-system/sw/bin/darwin-rebuild
lrwxr-xr-x 1 mrobbetts nixbld 77 Dec 31 1969 /run/current-system/sw/bin/darwin-rebuild -> /nix/store/iknjhygkc7adhp7fyn3vdsgazmsj2ii7-darwin-rebuild/bin/darwin-rebuild
(and, /nix/store/iknjhygkc7adhp7fyn3vdsgazmsj2ii7-darwin-rebuild/bin/darwin-rebuild
really doesn’t exist). So I’m confused right away because how did the current-system darwin-rebuild
symlink get itself pointed to a nonexistent path?
Now, a recovery step suggested by the nix-darwin install doc is:
$ nix-build '<darwin>' -A system
these derivations will be built:
/nix/store/8akkwpns2vzgn2zyj77d47w94irsvj6z-system-applications.drv
/nix/store/x34w99y8mvyfq4jl5zhw3g7bdpscrwid-system-path.drv
/nix/store/00frb7y6rmb6fkzh5pf5p75xpbnas036-darwin-system-20.03.git.8be1f98+darwin4.0000000.drv
building '/nix/store/8akkwpns2vzgn2zyj77d47w94irsvj6z-system-applications.drv'...
Can't open perl script "/nix/store/pmgi6an5cplww4p5fzyyk2spd9xbwy7y-builder.pl": No such file or directory
builder for '/nix/store/8akkwpns2vzgn2zyj77d47w94irsvj6z-system-applications.drv' failed with exit code 2
cannot build derivation '/nix/store/00frb7y6rmb6fkzh5pf5p75xpbnas036-darwin-system-20.03.git.8be1f98+darwin4.0000000.drv': 1 dependencies couldn't be built
error: build of '/nix/store/00frb7y6rmb6fkzh5pf5p75xpbnas036-darwin-system-20.03.git.8be1f98+darwin4.0000000.drv' failed
I also have a bunch of darwin-rebuild
s laying around in my /nix/store
, and have tried running them all - they all try to call through to that non-existent /nix/store/pmgi6an5cplww4p5fzyyk2spd9xbwy7y-builder.pl
.
Worth noting is that I quickly re-ran the nixpkgs install script (i.e. curl -L https://nixos.org/nix/install | sh
) and this succeeded at updating my nixpkgs. But then trying to do anything, including re-running the nix-darwin installer, fails with the same non-existent /nix/store/pmgi6an5cplww4p5fzyyk2spd9xbwy7y-builder.pl
.
Does anyone have any idea how to fix this, or what the problem really is? I hadn’t used much of my nix on this machine for a little while, and had updated the MacOS installation in the mean time (to 10.15.5), so perhaps something about that dot-release has broken something.
It’s a little unclear if you’ve found Nix broken the first time you went to use it after updating to Catalina, or if you previously installed it on Catalina?
If you had the Nix install before updating to Catalina and didn’t do anything special to try to fix Nix at the time, that upgrade should have moved your Nix store out of /nix and into a “Relocated Items” directory on your Desktop and broken Nix in the process.
It’s a little unclear if you’ve found Nix broken the first time you went to use it after updating to Catalina, or if you previously installed it on Catalina?
Oh, sorry! No - I’ve been using Nix on Catalina since Catalina came out. The only OS-version change that happened, since Nix was last working correctly, is the update from 10.15.4 to 10.15.5 in the last week or so.
Another data point, it’s the weirdest thing. I noticed that my nix-provided zsh
is in the same boat as darwin-rebuild
, in that there is a symlink in /run/current-system/sw
(as there should be), but it points to a non-existent location.
$ ls -l /run/current-system/sw/bin/zsh
lrwxr-xr-x 1 mrobbetts admin 61 Dec 31 1969 /run/current-system/sw/bin/zsh -> /nix/store/si1wplsicrnky4cwxphyb0vdwgjcr3sg-zsh-5.7.1/bin/zsh
$ ls -l /nix/store/si1wplsicrnky4cwxphyb0vdwgjcr3sg-zsh-5.7.1/bin/zsh
ls: /nix/store/si1wplsicrnky4cwxphyb0vdwgjcr3sg-zsh-5.7.1/bin/zsh: No such file or directory
And trying to probe into this a little bit:
$ nix-shell -p zsh
build input /nix/store/si1wplsicrnky4cwxphyb0vdwgjcr3sg-zsh-5.7.1 does not exist
which also seems plain weird, right? There is clearly a broken mechanism in here somewhere…
I took this update in the past week without trouble, so it probably comes down to some difference in our setups. More questions:
- What happens if you run
ls -l /nix
?
- Roughly, when did you install Nix?
- Do you remember what you did to create the root /nix directory? (symlink? volume? encrypted or not? etc.)
Urrrrrgh.
Your prompting me to look in /nix
reminded me that I’m using a custom nixpkgs git clone (which I keep at /nix/nixpkgs/
), rather than the normal channel mechanism. Updating that clone fixed all the problems. I still maintain the way it failed look reeeeally weird. But at the same time, this was apparently all my fault.
A bit of bootstrapping from an old darwin-rebuild
was enough to set everything right AFAICT.
Thanks for your attention! Even though it was all my fault, your suggestion was what helped me find it 
1 Like