Error when running nixos-rebuild for a microvm
This commit is contained in:
parent
9d9cc81671
commit
6f98aedfa0
|
@ -111,9 +111,16 @@ lib.attrsets.mapAttrs
|
||||||
# remote machine and bulding and switching there.
|
# remote machine and bulding and switching there.
|
||||||
# Can be run with `nix run c3d2#…-nixos-rebuild switch`
|
# Can be run with `nix run c3d2#…-nixos-rebuild switch`
|
||||||
"${name}-nixos-rebuild" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
|
"${name}-nixos-rebuild" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''
|
||||||
#!${pkgs.runtimeShell} -ex
|
#!${pkgs.runtimeShell} -e
|
||||||
|
|
||||||
|
if nix eval .#nixosConfigurations.${name}.config.c3d2.deployment.server &>/dev/null; then
|
||||||
|
echo "microvms cannot be updated with nixos-rebuild. Use nix run .#microvm-update-${name}"
|
||||||
|
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=$(nix build ${self}#nixosConfigurations.${name}.config.system.build.nixos-rebuild --no-link --json | ${pkgs.jq}/bin/jq -r '.[0].outputs.out')
|
nixosRebuild=$(nix build ${self}#nixosConfigurations.${name}.config.system.build.nixos-rebuild --no-link --json | ${pkgs.jq}/bin/jq -r '.[0].outputs.out')
|
||||||
nix copy --no-check-sigs --to ssh-ng://${target} $nixosRebuild
|
nix copy --no-check-sigs --to ssh-ng://${target} $nixosRebuild
|
||||||
|
|
Loading…
Reference in New Issue