From dabf0339b9bbb79dab806c229089ce15dd7d9c73 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sun, 5 Jan 2025 10:38:42 +1000 Subject: [PATCH] tasks.py: use copy instead of archive for deploy this is faster but it assumes that the flake inputs can be substituted on the target --- tasks.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tasks.py b/tasks.py index 4e7ade6..be4269a 100644 --- a/tasks.py +++ b/tasks.py @@ -30,13 +30,17 @@ def deploy(c: Any, hosts: str) -> None: command = "sudo nixos-rebuild" target = f"{h.host}" - res = h.run_local( - ["nix", "flake", "archive", "--to", f"ssh://{target}", "--json"], + res = subprocess.run( + ["nix", "flake", "metadata", "--json"], + text=True, + check=True, stdout=subprocess.PIPE, ) data = json.loads(res.stdout) path = data["path"] + h.run_local(f"nix copy --to ssh://{target} {path}") + hostname = h.host.replace(".nix-community.org", "") h.run( f"{command} switch --option accept-flake-config true --flake {path}#{hostname}"