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