Dominik Süß

fighting computers since 1999

Re-installing nix on fedora


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:

  1. 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
  2. Uninstall home-manager This didn't actually work because home-manager uninstall tries 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.
  3. 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
  4. 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.
  5. Remove $HOME/.nix-profile Initially I didn't do this and ran into issues with home-manager complaining about conflicting environments. The reason for this was that my .nix-profile was still pointing to a location in the nix store from the old install. Removing this did the trick.
  6. Rebuild home-manager config

    With the home-manager config as a flake, this was easy enough:

    nix run 'nixpkgs#home-manager' switch
  7. 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