diff --git a/flake.nix b/flake.nix index 1d98909..e10de30 100644 --- a/flake.nix +++ b/flake.nix @@ -73,15 +73,20 @@ (hostname: { system, ... }: system == x86_64-darwin) hosts; - mkDeploymentModule = targetHost: ({ lib, ... }: { + mkDeploymentModule = { targetHost, system, ... }: ({ lib, ... }: { options.deployment = with lib; { + system = mkOption { + type = types.str; + readOnly = true; + internal = true; + }; targetHost = mkOption { type = types.nullOr types.str; readOnly = true; internal = true; }; }; - config.deployment = { inherit targetHost; }; + config.deployment = { inherit targetHost system; }; }); baseHomeManagerModule = ({ ... }: { @@ -114,8 +119,8 @@ let pkgs = import nixpkgs { inherit system; }; - machineRebuild = { system, ...}: - if system == x86_64-linux + machineRebuild = machine: + if machine.config.deployment.system == x86_64-linux then pkgs.nixos-rebuild else inputs.nix-darwin.packages.${x86_64-darwin}.darwin-rebuild; @@ -209,7 +214,7 @@ impermanence.nixosModules.impermanence ]) ++ [ - (mkDeploymentModule targetHost) + (mkDeploymentModule { inherit system targetHost; }) baseHomeManagerModule ] ++ extraModules @@ -242,7 +247,7 @@ ]) ++ [ (baseDarwinModule system) - (mkDeploymentModule targetHost) + (mkDeploymentModule { inherit system targetHost; }) baseHomeManagerModule ] ++ extraModules