modules: system: nix: add inputs to NIX_PATH

This commit is contained in:
Bruno BELANYI 2021-12-22 23:47:27 +01:00
parent 876dacab85
commit 3a313812b8

View file

@ -1,5 +1,5 @@
# Nix related settings # Nix related settings
{ config, inputs, lib, pkgs, ... }: { config, inputs, lib, options, pkgs, ... }:
let let
cfg = config.my.system.nix; cfg = config.my.system.nix;
in in
@ -8,6 +8,8 @@ in
enable = my.mkDisableOption "nix configuration"; enable = my.mkDisableOption "nix configuration";
addToRegistry = my.mkDisableOption "add inputs and self to registry"; addToRegistry = my.mkDisableOption "add inputs and self to registry";
addToNixPath = my.mkDisableOption "add inputs and self to nix path";
}; };
config = lib.mkIf cfg.enable (lib.mkMerge [ config = lib.mkIf cfg.enable (lib.mkMerge [
@ -31,5 +33,13 @@ in
nur.flake = inputs.nur; nur.flake = inputs.nur;
}; };
}) })
(lib.mkIf cfg.addToNixPath {
nix.nixPath = options.nix.nixPath.default ++ [
"self=${inputs.self}"
"pkgs=${inputs.nixpkgs}"
"nur=${inputs.nur}"
];
})
]); ]);
} }