Fix baremetal deployment

This commit is contained in:
Sandro - 2023-10-26 20:43:01 +02:00
parent 73e4cc7eb3
commit 89635cd5c9
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
2 changed files with 4 additions and 3 deletions

View File

@ -59,7 +59,7 @@
nix = {
# Show a diff when activating a new system except for microvms which handle this seperately
diffSystem = config.c3d2.deployment.server == "";
diffSystem = config.c3d2.deployment.server or "" == "";
gc = lib.mkIf config.c3d2.autoUpdate {
automatic = true;
randomizedDelaySec = "6h";

View File

@ -110,16 +110,17 @@ lib.attrsets.mapAttrs
"${name}-nixos-rebuild" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
set -eou pipefail
${lib.optionalString (hostConfig.c3d2.deployment.server != "") ''
${lib.optionalString (hostConfig.c3d2.deployment.server or "" != "") ''
echo "microvms cannot be updated with nixos-rebuild. Use nix run .#microvm-update-${name}"
exit 2
''}
[[ $(ssh ${target} cat /etc/hostname) == ${name} ]]
nix copy --no-check-sigs --to ssh-ng://${target} ${inputPaths}
nix copy --no-check-sigs --derivation --to ssh-ng://${target} ${discardStringCtx hostConfig.system.build.nixos-rebuild.drvPath}
# use nixos-rebuild from target config
nixosRebuild=$(ssh ${target} nix build ${discardStringCtx hostConfig.system.build.nixos-rebuild.outPath or ""} ${overrideInputsArgs} --no-link --json | ${lib.getExe hostPkgs.jq} -r '.[0].outputs.out')
nixosRebuild=$(ssh ${target} nix build ${discardStringCtx hostConfig.system.build.nixos-rebuild.drvPath} ${overrideInputsArgs} --no-link --json | ${lib.getExe hostPkgs.jq} -r '.[0].outputs.out')
ssh ${target} $nixosRebuild/bin/nixos-rebuild ${rebuildArg} "$@"
'';