flake: fixup multisystem switch
This commit is contained in:
parent
488dc5095e
commit
62995b9c0a
1 changed files with 11 additions and 6 deletions
17
flake.nix
17
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
|
||||
|
|
Loading…
Add table
Reference in a new issue