From 20d19ed12880fa197aec8d8f610cc9a9acec0e85 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Mon, 1 May 2023 19:43:29 +0200 Subject: [PATCH] modules: system: nix: rename 'inputs' options --- modules/system/nix/default.nix | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/modules/system/nix/default.nix b/modules/system/nix/default.nix index c8ce001..5c9dbc8 100644 --- a/modules/system/nix/default.nix +++ b/modules/system/nix/default.nix @@ -12,7 +12,7 @@ let # Use pinned nixpkgs when using `nix run pkgs#` pkgs = inputs.nixpkgs; } - (lib.optionalAttrs cfg.overrideNixpkgs { + (lib.optionalAttrs cfg.inputs.overrideNixpkgs { # ... And with `nix run nixpkgs#` 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" ]