From 130aeb36b7d9d303a2b4a3a20e2978435afd2469 Mon Sep 17 00:00:00 2001 From: Qubasa Date: Mon, 11 Nov 2024 21:50:25 +0700 Subject: [PATCH] Revert "clan: Remove pkgsForSystem" This reverts commit 382e27a20b9a22faa200941a27a794e1d73fcadf. --- lib/build-clan/interface.nix | 14 ++++++++++++-- lib/build-clan/module.nix | 5 +++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/build-clan/interface.nix b/lib/build-clan/interface.nix index df4743980..8dd3abf74 100644 --- a/lib/build-clan/interface.nix +++ b/lib/build-clan/interface.nix @@ -3,7 +3,6 @@ let types = lib.types; in { - options = { # Required options directory = lib.mkOption { @@ -70,6 +69,18 @@ in default = { }; }; + pkgsForSystem = lib.mkOption { + type = types.functionTo (types.nullOr types.attrs); + default = _: null; + defaultText = "Lambda :: String -> { ... } | null"; + description = '' + A function that maps from architecture to pkg. `( string -> pkgs )` + + If specified this nixpkgs will be only imported once for each system. + This improves performance, but all nipxkgs.* options will be ignored. + ''; + }; + # Outputs nixosConfigurations = lib.mkOption { # Hide from documentation. @@ -101,5 +112,4 @@ in }; }; }; - } diff --git a/lib/build-clan/module.nix b/lib/build-clan/module.nix index 072b16c98..016f9baf3 100644 --- a/lib/build-clan/module.nix +++ b/lib/build-clan/module.nix @@ -9,6 +9,7 @@ let inherit (config) directory machines + pkgsForSystem specialArgs ; @@ -57,7 +58,7 @@ let # Settings clan.core.clanDir = directory; # Inherited from clan wide settings - # TODO: remove these` + # TODO: remove these clan.core.name = config.inventory.meta.name; clan.core.icon = config.inventory.meta.icon; @@ -126,7 +127,7 @@ let args // { inherit name system; - pkgs = nixpkgs.legacyPackages.${system}; + pkgs = pkgsForSystem system; } ) ) allMachines