From 24f825efc3c40c8008276672725bd55abb5e6f35 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Fri, 24 Jan 2025 23:50:51 +0300 Subject: [PATCH] Move collect to inside lib --- lib/default.nix | 9 +++++---- lib/filesystem.nix | 7 +++++++ lib/system.nix | 31 +++++++++++++------------------ 3 files changed, 25 insertions(+), 22 deletions(-) create mode 100644 lib/filesystem.nix diff --git a/lib/default.nix b/lib/default.nix index 5db61bd..6babaf2 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,5 +1,6 @@ inputs: self: super: let - option = import ./option.nix inputs self super; - system = import ./system.nix inputs self super; - values = import ./values.nix inputs self super; -in option // system // values + filesystem = import ./filesystem.nix inputs self super; + option = import ./option.nix inputs self super; + system = import ./system.nix inputs self super; + values = import ./values.nix inputs self super; +in filesystem // option // system // values diff --git a/lib/filesystem.nix b/lib/filesystem.nix new file mode 100644 index 0000000..9e4f336 --- /dev/null +++ b/lib/filesystem.nix @@ -0,0 +1,7 @@ +_: self: super: let + inherit (self) filter hasSuffix; + inherit (self.filesystem) listFilesRecursive; +in { + collect = path: listFilesRecursive path + |> filter (hasSuffix ".nix"); +} diff --git a/lib/system.nix b/lib/system.nix index 0f6eca2..d45519f 100644 --- a/lib/system.nix +++ b/lib/system.nix @@ -1,12 +1,8 @@ inputs: self: super: let - inherit (self) attrValues filter getAttrFromPath hasAttrByPath hasSuffix; - inherit (self.filesystem) listFilesRecursive; - - collect = path: listFilesRecursive path - |> filter (hasSuffix ".nix"); + inherit (self) attrValues filter getAttrFromPath hasAttrByPath collect; commonModules = collect ../modules/common; - nixosModules = collect ../modules/nixos; + nixosModules = collect ../modules/linux; darwinModules = collect ../modules/darwin; collectInputs = let @@ -20,34 +16,33 @@ inputs: self: super: let inputOverlays = collectInputs [ "overlays" "default" ]; overlayModule = { nixpkgs.overlays = inputOverlays; }; + + specialArgs = inputs // { + inherit inputs; + + keys = import ../keys.nix; + lib = self; + }; in { nixosSystem = module: super.nixosSystem { + inherit specialArgs; + modules = [ module overlayModule ] ++ commonModules ++ nixosModules ++ inputNixosModules; - - specialArgs = inputs // { - inherit inputs; - - lib = self; - }; }; darwinSystem = module: super.darwinSystem { + inherit specialArgs; + modules = [ module overlayModule ] ++ commonModules ++ darwinModules ++ inputDarwinModules; - - specialArgs = inputs // { - inherit inputs; - - lib = self; - }; }; }