Fix quoting and shell code for local building

This commit is contained in:
Sandro - 2023-12-10 02:48:30 +01:00
parent eb32931421
commit 083bef8dc6
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
1 changed files with 3 additions and 3 deletions

View File

@ -93,7 +93,7 @@ lib.attrsets.mapAttrs
let let
discardStringCtx = builtins.unsafeDiscardStringContext; discardStringCtx = builtins.unsafeDiscardStringContext;
host = getHostAddr name; host = getHostAddr name;
target = ''root@"${host}"''; target = "root@${host}";
rebuildArg = "--flake ${self}#${name} ${overrideInputsArgs} --accept-flake-config"; rebuildArg = "--flake ${self}#${name} ${overrideInputsArgs} --accept-flake-config";
hostConfig = self.nixosConfigurations."${name}".config; hostConfig = self.nixosConfigurations."${name}".config;
declaredRunnerDrvPath = discardStringCtx hostConfig.microvm.declaredRunner.drvPath; declaredRunnerDrvPath = discardStringCtx hostConfig.microvm.declaredRunner.drvPath;
@ -162,8 +162,8 @@ lib.attrsets.mapAttrs
"${name}-nixos-rebuild-local" = pkgs.writeScriptBin "${name}-nixos-rebuild" '' "${name}-nixos-rebuild-local" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
set -eou pipefail set -eou pipefail
if [[ ''${1:-} == build; then if [[ ''${1:-} == build ]]; then
hostname=$(ssh root@${target} cat /etc/hostname)" hostname="$(ssh root@${target} cat /etc/hostname)"
if [[ "$hostname" != ${name} ]]; then if [[ "$hostname" != ${name} ]]; then
echo "hostname of ${target} was expected to be ${name} but is $hostname. Aborting to be safe..." echo "hostname of ${target} was expected to be ${name} but is $hostname. Aborting to be safe..."
exit 2 exit 2