home-manager icon indicating copy to clipboard operation
home-manager copied to clipboard

home-manager: Add home-manager search path to EXTRA_NIX_PATH

Open zhaofengli opened this issue 1 year ago • 0 comments

Description

Since 2.4, the Nix installer no longer adds the NIX_PATH environment variable to shell profiles, because Nix now has a built-in search path if it's unset. However, home-manager still relies on it being set and prepends search paths for home-manager. Even though the documentations have been updated to include instructions for non-NixOS users, this is a bad first-time experience (https://github.com/nix-community/home-manager/issues/2564, https://github.com/nix-community/home-manager/issues/3020, https://github.com/nix-community/home-manager/issues/2580).

Instead of relying on NIX_PATH being set and prepending to it, let's not touch it at all and add our paths as -I arguments. We trust that Nix will use a sensible default.

Tested by installing home-manager on Ubuntu 22.04 with a fresh multi-user Nix installation.

Checklist

  • [x] Change is backwards compatible.

  • [x] Code formatted with ./format.

  • [ ] Code tested through nix-shell --pure tests -A run.all.

  • [ ] Test cases updated/added. See example.

  • [x] Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • [ ] Added myself as module maintainer. See example.

    • [ ] Added myself and the module files to .github/CODEOWNERS.

zhaofengli avatar Sep 20 '22 03:09 zhaofengli