packages: re-use even more evaled results
This commit is contained in:
parent
33cfdfe099
commit
fc3b3137da
|
@ -110,16 +110,16 @@ lib.attrsets.mapAttrs
|
||||||
"${name}-nixos-rebuild" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
|
"${name}-nixos-rebuild" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
|
||||||
set -eou pipefail
|
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}"
|
echo "microvms cannot be updated with nixos-rebuild. Use nix run .#microvm-update-${name}"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
''}
|
||||||
|
|
||||||
[[ $(ssh ${target} cat /etc/hostname) == ${name} ]]
|
[[ $(ssh ${target} cat /etc/hostname) == ${name} ]]
|
||||||
nix copy --no-check-sigs --to ssh-ng://${target} ${inputPaths}
|
nix copy --no-check-sigs --to ssh-ng://${target} ${inputPaths}
|
||||||
|
|
||||||
# use nixos-rebuild from target config
|
# 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} "$@"
|
ssh ${target} $nixosRebuild/bin/nixos-rebuild ${rebuildArg} "$@"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user