diff options
Diffstat (limited to 'lib/lib.nix')
| -rw-r--r-- | lib/lib.nix | 66 |
1 files changed, 37 insertions, 29 deletions
diff --git a/lib/lib.nix b/lib/lib.nix index aedb67a..e0e14e4 100644 --- a/lib/lib.nix +++ b/lib/lib.nix @@ -3,28 +3,34 @@ self, inputs, ... -}: let +}: +let # function -> function -> { } -> { } # wrap the `args` applied to `builder` with the result of `apply` # applied to those `args` - wrapBuilderWith = apply: builder: args: builder (apply args); + wrapBuilderWith = + apply: builder: args: + builder (apply args); # string -> function -> { } -> { } # wrap the `args` for `builder` of type `type` with nice defaults - wrapBuilder = type: - wrapBuilderWith ({ - modules ? [], - specialArgs ? {}, + wrapBuilder = + type: + wrapBuilderWith ( + { + modules ? [ ], + specialArgs ? { }, ... - } @ args: - args - // { - modules = - modules - ++ lib.attrValues (self."${type}Modules" or {}); + }@args: + args + // { + modules = modules ++ lib.attrValues (self."${type}Modules" or { }); - specialArgs = specialArgs // {inherit inputs;}; - }); + specialArgs = specialArgs // { + inherit inputs; + }; + } + ); # function -> { } -> { } # wrap the `args` to the nixos `builder` function with nice defaults @@ -35,23 +41,25 @@ # function -> { } -> { } # wrap the `args` to the homeManager `builder` function with nice defaults - wrapUser = builder: args: - wrapBuilderWith ({ - modules ? [], - extraSpecialArgs ? {}, + wrapUser = + builder: args: + wrapBuilderWith ( + { + modules ? [ ], + extraSpecialArgs ? { }, ... - } @ args: - args - // { - modules = - modules - ++ lib.attrValues (self.homeManagerModules or {}); + }@args: + args + // { + modules = modules ++ lib.attrValues (self.homeManagerModules or { }); - extraSpecialArgs = extraSpecialArgs // {inherit inputs;}; - }) - builder - args; -in { + extraSpecialArgs = extraSpecialArgs // { + inherit inputs; + }; + } + ) builder args; +in +{ # { } -> { } # apply nice defaults to the `args` of `nixosSystem` nixosSystem = wrapNixOS inputs.nixpkgs.lib.nixosSystem; |
