From 5aa7cf4d1c99fa2044a56e32604af231a735defe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 4 Dec 2024 12:33:43 +0100 Subject: [PATCH] fix deploying from darwin to linux --- lib/build-clan/module.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/build-clan/module.nix b/lib/build-clan/module.nix index 3db4ca93b..efd1cfaf5 100644 --- a/lib/build-clan/module.nix +++ b/lib/build-clan/module.nix @@ -67,13 +67,21 @@ let # Machine specific settings clan.core.machineName = name; networking.hostName = lib.mkDefault name; - nixpkgs.hostPlatform = lib.mkIf (system != null) (lib.mkDefault system); # speeds up nix commands by using the nixpkgs from the host system (especially useful in VMs) nix.registry.nixpkgs.to = lib.mkDefault { type = "path"; path = lib.mkDefault nixpkgs; }; + + # For vars we need to override the system so we run vars + # generators on the machine that runs `clan vars generate`. If a + # users is using the `pkgsForSystem`, we don't set + # nixpkgs.hostPlatform it would conflict with the `nixpkgs.pkgs` + # option. + nixpkgs.hostPlatform = lib.mkIf (system != null && (pkgsForSystem system) != null) ( + lib.mkForce system + ); } // lib.optionalAttrs (pkgs != null) { nixpkgs.pkgs = lib.mkForce pkgs; } )