aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-12 01:19:54 +0000
committertv <tv@krebsco.de>2026-11-12 01:19:54 +0000
commitea6d6b16fa422d3fb0a7fea671d3637b89751721 (patch)
tree43ed25bab755e8884d8b1f070464ebe63415ffb8 /pkgs
parent69f0ab4533a6b233dca1193ee558de8994df1ffb (diff)
krops writeDeploy: pass --use-remote-sudo only with a separate build target
For targets using sudo, writeDeploy runs nixos-rebuild on the target via sudo, so --use-remote-sudo has no effect there. It only matters when nixos-rebuild runs on a separate build target and activates the system on the target, so writeDeploy passes it only then. A new VM test, deploy, runs writeDeploy with a stand-in for nixos-rebuild, which records the user it runs as, NIX_PATH, and its arguments, for deploying flakes and other sources, with and without a separate build target, to every kind of target.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/krops/default.nix3
1 files changed, 2 insertions, 1 deletions
diff --git a/pkgs/krops/default.nix b/pkgs/krops/default.nix
index dcda28f..429fc61 100644
--- a/pkgs/krops/default.nix
+++ b/pkgs/krops/default.nix
@@ -135,7 +135,8 @@ in
] ++ lib.optionals (buildTarget' != target') [
"--build-host" "${buildTarget'.user}@${buildTarget'.host}"
"--target-host" "${target'.user}@${target'.host}"
- ] ++ lib.optionals target'.sudo [
+ ] ++ lib.optionals (buildTarget' != target' && target'.sudo) [
+ # nixos-rebuild runs on the target itself via sudo otherwise.
"--use-remote-sudo"
]) buildTarget'}
''