I've been using home-manager for a while now but for some reason, building my configuration with a newer version of nixpkgs yielded the following error:
error: builder for '/nix/store/3x71f0awjw2psr857hladz3riyzq5v13-home-manager-path.drv' failed with exit code 1;
last 1 log lines:
> /nix/store/l622p70vy8k5sh7y5wizi5f2mic6ynpg-source-stdenv.sh: line 2: /setup: No such file or directory
For full logs, run 'nix log /nix/store/3x71f0awjw2psr857hladz3riyzq5v13-home-manager-path.drv'.Searching for this error didn't get me any closer to a solution and even asking my friend with more nix experience was fruitless. Since my flake built on his env without issues, I decided to re-install nix.
I went through the following steps:
- Create a new user on my machine My user session utilizes many things from my home-manager config so I felt safer doing this from a separate user
- Uninstall home-manager
This didn't actually work because
home-manager uninstalltries to build an empty configuration and switch to it but building new flakes was broken so it couldn't complete this. I figured it'll be fine as the worst thing would be dangling symlinks which I could clobber/clean up later. Uninstall nix
I used the determinate systems installer when setting up nix the first time so I followed their uninstall instructions:
/nix/nix-installer uninstall- Reinstall nix I took the opportunity to try out lix instead so I used their installer. This worked really well even though it failed on the first invokation due to a leftover systemd unit (I think this was caused by me trying to fix the original issue). A second try after removing the unit went through without issues.
- Remove
$HOME/.nix-profileInitially I didn't do this and ran into issues with home-manager complaining about conflicting environments. The reason for this was that my.nix-profilewas still pointing to a location in the nix store from the old install. Removing this did the trick. Rebuild home-manager config
With the home-manager config as a flake, this was easy enough:
nix run 'nixpkgs#home-manager' switch- Remove the temporary user I logged in as my main user and everything worked so the only thing left to clean up was the temporary user