From 89daa0c9ba1602936c81fe7db1ed84df5ab55b64 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sat, 11 May 2024 01:33:56 +0200 Subject: [PATCH] Evaluate machine configs using `callPackage` --- flake.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index b2b490f..3ebd0c4 100644 --- a/flake.nix +++ b/flake.nix @@ -38,8 +38,8 @@ machines = builtins.mapAttrs ( name: machineDefinition: defaultMachine // machineDefinition // { - config = { ... }@args: - ((defaultMachine.config args) // (machineDefinition.config args)); + config = { callPackage, ... }: + ((callPackage defaultMachine.config { }) // (callPackage machineDefinition.config { })); }) machineDefinitions; @@ -86,11 +86,11 @@ modules = [ ( - { pkgs, ... }@args: { + { pkgs, ... }: { config._module.args = { inherit hostname; - machineConfig = (config args) // { + machineConfig = (pkgs.callPackage config { }) // { inherit hostname; }; }; @@ -113,6 +113,8 @@ pkgs = import nixpkgs { inherit (machine) system; }; + + machineConfig = pkgs.callPackage machine.config { }; in lib.attrsets.concatMapAttrs ( username: user: { @@ -137,7 +139,7 @@ ] ++ (lib.optional (userConfigPath != null) userConfigPath); }; }) - (machine.config { inherit pkgs; }).users) + machineConfig.users) machines; }); }