From a992484fb915f6aecc0a3f05164d18f85c1a2ff7 Mon Sep 17 00:00:00 2001 From: Qubasa Date: Fri, 28 Mar 2025 18:47:36 +0100 Subject: [PATCH] clan-cli: Fix deployment as non root with a buildHost set --- pkgs/clan-cli/clan_cli/machines/update.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/clan-cli/clan_cli/machines/update.py b/pkgs/clan-cli/clan_cli/machines/update.py index 3300df038..6600a4b6b 100644 --- a/pkgs/clan-cli/clan_cli/machines/update.py +++ b/pkgs/clan-cli/clan_cli/machines/update.py @@ -152,6 +152,7 @@ def deploy_machines(machines: list[Machine]) -> None: "--flake", f"{path}#{machine.name}", ] + switch_cmd = ["nixos-rebuild", "switch", *nix_options] test_cmd = ["nixos-rebuild", "test", *nix_options] @@ -160,6 +161,10 @@ def deploy_machines(machines: list[Machine]) -> None: switch_cmd.extend(["--target-host", target_host.target]) test_cmd.extend(["--target-host", target_host.target]) + if target_host and target_host.user != "root": + switch_cmd.extend(["--use-remote-sudo"]) + test_cmd.extend(["--use-remote-sudo"]) + env = host.nix_ssh_env(None) ret = host.run( switch_cmd,