flake: fixup multisystem switch

This commit is contained in:
Dmitriy Pleshevskiy 2025-03-06 17:02:18 +03:00
parent 488dc5095e
commit 62995b9c0a
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2

View file

@ -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