home: nix: add 'NIX_PATH' handling
All checks were successful
continuous-integration/drone/push Build is passing

Still waiting for the actual home-manager module option to be added [1].

In the meantime, just do it by hand.

[1]: https://github.com/nix-community/home-manager/pull/2677
This commit is contained in:
Bruno BELANYI 2023-03-30 09:58:46 +00:00
parent b909f43269
commit f0a93f878b

View file

@ -26,10 +26,24 @@ in
addToRegistry = my.mkDisableOption "add inputs and self to registry";
addToNixPath = my.mkDisableOption "add inputs and self to nix path";
overrideNixpkgs = my.mkDisableOption "point nixpkgs to pinned system version";
};
config = lib.mkIf cfg.enable (lib.mkMerge [
{
assertions = [
{
assertion = cfg.addToNixPath -> cfg.linkInputs;
message = ''
enabling `my.home.nix.addToNixPath` needs to have
`my.home.nix.linkInputs = true`
'';
}
];
}
{
nix = {
package = lib.mkDefault pkgs.nix; # NixOS module sets it unconditionally
@ -60,5 +74,9 @@ in
in
makeLinks channels;
})
(lib.mkIf cfg.addToNixPath {
home.sessionVariables.NIX_PATH = "${config.xdg.configHome}/nix/inputs\${NIX_PATH:+:$NIX_PATH}";
})
]);
}