modules: system: nix: add '/etc/nix/inputs' links

This commit is contained in:
Bruno BELANYI 2023-02-20 22:26:51 +01:00
parent 607d11bbad
commit c1214547da
1 changed files with 20 additions and 0 deletions

View File

@ -7,6 +7,8 @@ in
options.my.system.nix = with lib; {
enable = my.mkDisableOption "nix configuration";
linkInputs = my.mkDisableOption "link inputs to `/etc/nix/inputs/`";
addToRegistry = my.mkDisableOption "add inputs and self to registry";
addToNixPath = my.mkDisableOption "add inputs and self to nix path";
@ -38,6 +40,24 @@ in
};
})
(lib.mkIf cfg.linkInputs {
environment.etc =
let
makeLink = n: v: {
name = "nix/inputs/${n}";
value = { source = v.outPath; };
};
makeLinks = lib.mapAttrs' makeLink;
in
makeLinks {
inherit (inputs)
self
nixpkgs
nur
;
};
})
(lib.mkIf cfg.addToNixPath {
nix.nixPath = [
"self=${inputs.self}"