packages: re-use even more evaled results

This commit is contained in:
Sandro - 2023-10-16 01:55:37 +02:00
parent 33cfdfe099
commit fc3b3137da
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
1 changed files with 3 additions and 3 deletions

View File

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