Skip to content

Commit

Permalink
tasks.py: use archive for deploy when the flake has file or path inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
zowoq committed Jan 19, 2025
1 parent 68e63db commit a68fa35
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,19 @@ def deploy(h: DeployHost) -> None:
data = json.loads(res.stdout)
path = data["path"]

h.run_local(f"nix copy --to ssh://{target} {path}")
send = (
"nix flake archive"
if any(
(
n.get("locked", {}).get("type") == "path"
or n.get("locked", {}).get("url", "").startswith("file:")
)
for n in data["locks"]["nodes"].values()
)
else f"nix copy {path}"
)

h.run_local(f"{send} --to ssh://{target}")

hostname = h.host.replace(".nix-community.org", "")
h.run(
Expand Down

0 comments on commit a68fa35

Please sign in to comment.