From f270bef4a12f67469bb62d42772d26b6a0e21675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Thu, 5 Jan 2023 00:47:10 +0100 Subject: [PATCH] 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. --- packages.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages.nix b/packages.nix index c62acf8a..e4deeda2 100644 --- a/packages.nix +++ b/packages.nix @@ -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" ''