From 08d7bc266b369ff1992d5f08a55b901aa3ec65dd Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Fri, 30 Aug 2024 20:11:05 +0200 Subject: [PATCH] lib: trying to extend the default NixOS library, NOT WORKING ATM --- hosts/default.nix | 53 +++++++++++++++++++++--------------------- parts/lib/builders.nix | 7 +++--- parts/lib/default.nix | 24 ++++++++++--------- 3 files changed, 44 insertions(+), 40 deletions(-) diff --git a/hosts/default.nix b/hosts/default.nix index dcd8ecb..c8e94ac 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,35 +1,36 @@ { inputs, + lib, withSystem, ... }: let - # inherit (inputs) self; + 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 (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; + } + ); in { flake.nixosConfigurations = { temperance = mkSystem { diff --git a/parts/lib/builders.nix b/parts/lib/builders.nix index 301e70e..67e1c47 100644 --- a/parts/lib/builders.nix +++ b/parts/lib/builders.nix @@ -1,9 +1,10 @@ { - lib, inputs, - self, + lib, ... -}: { +}: let + inherit (inputs) self; +in { mkSystem = { withSystem, system, diff --git a/parts/lib/default.nix b/parts/lib/default.nix index b6c5fe6..a6298ed 100644 --- a/parts/lib/default.nix +++ b/parts/lib/default.nix @@ -1,17 +1,19 @@ -{ - inputs, - lib, - self, - ... -}: let - callLibs = path: import path {inherit inputs lib self;}; - sussyLib = inputs.nixpkgs.lib.extend (final: prev: { +{inputs, ...}: let + callLibs = path: + import path { + inherit inputs; + inherit lib; + }; + lib = inputs.nixpkgs.lib.extend { builders = callLibs ./builders.nix; - }); + }; in { + perSystem = { + _module.args.lib = lib; + }; flake = { - lib = sussyLib; + inherit lib; # raf what the hell does this do you made me set it - _module.args.lib = sussyLib; + _module.args.lib = lib; }; }