packages: let microvm-update-* bail out with elaborative exception
This commit is contained in:
parent
3d276740a2
commit
af7b75df9e
13
packages.nix
13
packages.nix
|
@ -160,14 +160,11 @@ lib.attrsets.mapAttrs
|
||||||
ssh ${target} "time nix-collect-garbage -d && time nix-store --optimise"
|
ssh ${target} "time nix-collect-garbage -d && time nix-store --optimise"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
"microvm-update-${name}" = pkgs.writeScriptBin "microvm-update-${name}" ''
|
"microvm-update-${name}" = pkgs.writeScriptBin "microvm-update-${name}" (
|
||||||
|
if builtins.elem (hostConfig.c3d2.deployment.server or null) [ "server9" "server10" ]
|
||||||
|
then ''
|
||||||
#!${pkgs.runtimeShell} -e
|
#!${pkgs.runtimeShell} -e
|
||||||
|
|
||||||
${lib.optionalString (! builtins.elem (hostConfig.c3d2.deployment.server or null) [ "server9" "server10" ]) ''
|
|
||||||
echo "MicroVM must be configured to proper server" >&2
|
|
||||||
exit 1
|
|
||||||
''}
|
|
||||||
|
|
||||||
${hostConfig.system.build.copyToServer} ${inputPaths}
|
${hostConfig.system.build.copyToServer} ${inputPaths}
|
||||||
|
|
||||||
${hostConfig.system.build.runOnServer} bash -e <<END
|
${hostConfig.system.build.runOnServer} bash -e <<END
|
||||||
|
@ -191,7 +188,9 @@ lib.attrsets.mapAttrs
|
||||||
|
|
||||||
systemctl restart microvm@${name}.service
|
systemctl restart microvm@${name}.service
|
||||||
END
|
END
|
||||||
'';
|
''
|
||||||
|
else throw "${name} is not configured to run on microvm.nix. Is it a physical host or is it deployed in Skyflake?"
|
||||||
|
);
|
||||||
|
|
||||||
"microvm-update-${name}-local" = pkgs.writeScriptBin "microvm-update-${name}" ''
|
"microvm-update-${name}-local" = pkgs.writeScriptBin "microvm-update-${name}" ''
|
||||||
#!${pkgs.runtimeShell} -e
|
#!${pkgs.runtimeShell} -e
|
||||||
|
|
Loading…
Reference in New Issue
Block a user