Use target nixos-rebuild on target machine

This is required when using a modified nixos-rebuild that crashes when
using the executable from the currently deployed system.
This commit is contained in:
Sandro - 2023-01-05 00:47:10 +01:00
parent c22fb2b034
commit f270bef4a1
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
1 changed files with 4 additions and 1 deletions

View File

@ -110,7 +110,10 @@ lib.attrsets.mapAttrs
#!${pkgs.runtimeShell} -ex
[[ $(ssh ${target} cat /etc/hostname) == ${name} ]]
nix copy --no-check-sigs --to ssh-ng://${target} ${inputPaths}
ssh ${target} nixos-rebuild ${rebuildArg} "$@"
# 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')
nix copy --no-check-sigs --to ssh-ng://${target} $nixosRebuild
ssh ${target} $nixosRebuild/bin/nixos-rebuild ${rebuildArg} "$@"
'';
"${name}-nixos-rebuild-hydra" = pkgs.writeScriptBin "${name}-nixos-rebuild" ''