From 5d9f3332b8254b6045e64932941ee70ba8f3a7d1 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 9 Feb 2025 03:52:25 +0100 Subject: [PATCH] outputs: factor out mkNixosSystem I hope this makes this file more readable --- outputs.nix | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/outputs.nix b/outputs.nix index 1c25428..cb46fbd 100644 --- a/outputs.nix +++ b/outputs.nix @@ -20,6 +20,20 @@ self = { }; nixosConfigurations = let nixosSystem = import "${inputs.nixpkgs}/nixos/lib/eval-config.nix"; + mkNixosSystem = path: nixosSystem { + inherit lib; + modules = [ + path + { + config.nixpkgs.overlays = [ + ( import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = "${self}/pkgs/top-level/impure.nix"; } ) + ( import ./pkgs/top-level/by-name-overlay.nix "${self}/pkgs/by-name" ) + self.overlays.versionInfoFixup + ]; + } + ]; + specialArgs = { inherit self inputs; }; + }; in # mapped attrset of nix file paths to attrSet with initialized NixOS configurations, # whose names are derived from file names @@ -37,20 +51,7 @@ self = { # remove .nix extension name = if type == "directory" then name else builtins.substring 0 (builtins.stringLength name - 4) name; # initialize NixOS configuration - value = nixosSystem { - inherit lib; - modules = [ - ./hosts/${name} - { - config.nixpkgs.overlays = [ - ( import ./pkgs/overlays/selfExpr.nix { nixpkgsPath = "${self}/pkgs/top-level/impure.nix"; } ) - ( import ./pkgs/top-level/by-name-overlay.nix "${self}/pkgs/by-name" ) - self.overlays.versionInfoFixup - ]; - } - ]; - specialArgs = { inherit self inputs; }; - }; + value = mkNixosSystem ./hosts/${name}; })) builtins.attrValues builtins.listToAttrs