Home-manager: mkOutOfStoreSymlink and nixUnstable

Just dropping a note here for other home-manager users.

If you’re using config.lib.file.mkOutOfStoreSymlink, note that it is currently not compatible with nixpkgs#nixVersions.unstable (i.e. 2.19.2).

The error you see when building your configuration looks like:

error:
       … while setting up the build environment

       error: getting attributes of path '/nix/store/d5w0zqag0v8wkyab59aph7v9ypkr3h6y-hm_nvim': Permission denied

By default on NixOS you get the stable version (pkgs.nix = pkgs.nixVersions.stable = v2.18.1), unless you have set the option nix.package.

But if you recently installed nix via sh <(curl -L https://nixos.org/nix/install), then you will have 2.19.2.

Work around the issue by removing mkOutOfStoreSymlink from your config, and then downgrading your nix version to nixpkgs#nix (2.18.1, the stable version).

Links to github issues:

8 Likes

Users of impermanence may experience this too since it uses that option under the hood.

1 Like

This is seemingly a very annoying problem.
This works flawlessly in my current flake, but my flake doesnt pin the nix version im using in non-nixos systems so im at the mercy of determinatesystems to push a working nix version.

I’ve tried using nix run nixpkgs#nixVersions.git to rebuild but still get the issue.

unsure how to proceed on non-nix systems.