diff --git a/modules/microvm.nix b/modules/microvm.nix index a05166fd..459996ac 100644 --- a/modules/microvm.nix +++ b/modules/microvm.nix @@ -157,6 +157,7 @@ in ''; runOnServer = pkgs.writeShellScript "run-on-${server}" '' + # we cannot execute any other commands here because it grabs away $@ ssh root@${serverFQDN} -- $@ ''; }; diff --git a/packages.nix b/packages.nix index 7b0ea267..2406676a 100644 --- a/packages.nix +++ b/packages.nix @@ -115,9 +115,9 @@ lib.attrsets.mapAttrs exit 2 ''} - if [[ $(ssh ${target} cat /etc/hostname) != ${name} ]]; then - echo "hostname of the target machine does not match, please manually investigate!" - echo " $(ssh ${target} cat /etc/hostname) != ${name}" + hostname="$(ssh ${target} cat /etc/hostname)" + if [[ "$hostname" != ${name} ]]; then + echo "hostname of ${target} was expected to be ${name} but is $hostname. Aborting to be safe..." exit 2 fi nix copy --no-check-sigs --to ssh-ng://${target} ${inputPaths} @@ -125,7 +125,9 @@ lib.attrsets.mapAttrs # use nixos-rebuild from target config ssh ${target} bash -e <