modules: system: nix: rename 'inputs' options

This commit is contained in:
Bruno BELANYI 2023-05-01 19:43:29 +02:00
parent 93bc5cbd01
commit 20d19ed128

View file

@ -12,7 +12,7 @@ let
# Use pinned nixpkgs when using `nix run pkgs#<whatever>` # Use pinned nixpkgs when using `nix run pkgs#<whatever>`
pkgs = inputs.nixpkgs; pkgs = inputs.nixpkgs;
} }
(lib.optionalAttrs cfg.overrideNixpkgs { (lib.optionalAttrs cfg.inputs.overrideNixpkgs {
# ... And with `nix run nixpkgs#<whatever>` # ... And with `nix run nixpkgs#<whatever>`
nixpkgs = inputs.nixpkgs; nixpkgs = inputs.nixpkgs;
}) })
@ -22,23 +22,25 @@ in
options.my.system.nix = with lib; { options.my.system.nix = with lib; {
enable = my.mkDisableOption "nix configuration"; enable = my.mkDisableOption "nix configuration";
linkInputs = my.mkDisableOption "link inputs to `/etc/nix/inputs/`"; inputs = {
link = my.mkDisableOption "link inputs to `/etc/nix/inputs/`";
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"; addToNixPath = my.mkDisableOption "add inputs and self to nix path";
overrideNixpkgs = my.mkDisableOption "point nixpkgs to pinned system version"; overrideNixpkgs = my.mkDisableOption "point nixpkgs to pinned system version";
};
}; };
config = lib.mkIf cfg.enable (lib.mkMerge [ config = lib.mkIf cfg.enable (lib.mkMerge [
{ {
assertions = [ assertions = [
{ {
assertion = cfg.addToNixPath -> cfg.linkInputs; assertion = cfg.inputs.addToNixPath -> cfg.inputs.link;
message = '' message = ''
enabling `my.system.nix.addToNixPath` needs to have enabling `my.system.nix.inputs.addToNixPath` needs to have
`my.system.nix.linkInputs = true` `my.system.nix.inputs.link = true`
''; '';
} }
]; ];
@ -54,7 +56,7 @@ in
}; };
} }
(lib.mkIf cfg.addToRegistry { (lib.mkIf cfg.inputs.addToRegistry {
nix.registry = nix.registry =
let let
makeEntry = v: { flake = v; }; makeEntry = v: { flake = v; };
@ -63,7 +65,7 @@ in
makeEntries channels; makeEntries channels;
}) })
(lib.mkIf cfg.linkInputs { (lib.mkIf cfg.inputs.link {
environment.etc = environment.etc =
let let
makeLink = n: v: { makeLink = n: v: {
@ -75,7 +77,7 @@ in
makeLinks channels; makeLinks channels;
}) })
(lib.mkIf cfg.addToNixPath { (lib.mkIf cfg.inputs.addToNixPath {
nix.nixPath = [ nix.nixPath = [
"/etc/nix/inputs" "/etc/nix/inputs"
] ]