From 7063ef40d928de4f6147760a5c8e7729872e9b1f Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Fri, 30 Aug 2024 23:15:56 +0200 Subject: [PATCH] lib: working extended lib --- hosts/default.nix | 32 +++----------------------------- parts/lib/builders.nix | 9 +++------ parts/lib/default.nix | 3 ++- 3 files changed, 8 insertions(+), 36 deletions(-) diff --git a/hosts/default.nix b/hosts/default.nix index cb43036..72ec2f0 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,36 +1,10 @@ { - inputs, - lib, withSystem, + inputs, ... }: let - # inherit (inputs) self; - # inherit (inputs.nixpkgs) lib; - inherit (lib.builders) mkSystem; - # mkSystem = { - # withSystem, - # system, - # ... - # } @ args: - # withSystem system ( - # { - # inputs', - # self', - # ... - # }: - # lib.nixosSystem { - # inherit system; - # specialArgs = - # lib.recursiveUpdate - # { - # inherit lib; - # inherit inputs inputs'; - # inherit self self'; - # } - # (args.specialArgs or {}); - # inherit (args) modules; - # } - # ); + inherit (inputs.self) lib; + inherit (lib.extendedLib.builders) mkSystem; in { flake.nixosConfigurations = { temperance = mkSystem { diff --git a/parts/lib/builders.nix b/parts/lib/builders.nix index 67e1c47..9822c31 100644 --- a/parts/lib/builders.nix +++ b/parts/lib/builders.nix @@ -1,9 +1,6 @@ -{ - inputs, - lib, - ... -}: let - inherit (inputs) self; +{inputs, ...}: let + inherit (inputs) self nixpkgs; + inherit (nixpkgs) lib; in { mkSystem = { withSystem, diff --git a/parts/lib/default.nix b/parts/lib/default.nix index f7b2998..85a844d 100644 --- a/parts/lib/default.nix +++ b/parts/lib/default.nix @@ -19,12 +19,13 @@ builders = callLibs ./builders.nix; }; - # This makes mkSysytem available *in addition* to `lib.extendedLib.builders.mkSystem`. + # This makes mkSytem available *in addition* to `lib.extendedLib.builders.mkSystem`. # The syntax is a matter of preference, but it is good to make sure all custom attribute # sets (e.g., builders) are defined and taken from a separate attrset (extendedLib) to make # absolutely sure we *never* conflict with nixpkgs. Likewise, the function names inherited # here should also be different from ones available under `lib` by default, i.e., you cannot # re-define functions. + inherit (self.extendedLib) builders; inherit (self.extendedLib.builders) mkSystem; };