deploy: use nix-flake-archive instead of rsync to upload
This commit is contained in:
parent
ac13c5b76b
commit
3b0701f275
|
@ -1,5 +1,6 @@
|
|||
import argparse
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
from ..ssh import Host, HostGroup, HostKeyCheck
|
||||
|
@ -13,11 +14,13 @@ def deploy_nixos(hosts: HostGroup) -> None:
|
|||
def deploy(h: Host) -> None:
|
||||
target = f"{h.user or 'root'}@{h.host}"
|
||||
ssh_arg = f"-p {h.port}" if h.port else ""
|
||||
env = os.environ.copy()
|
||||
env["NIX_SSHOPTS"] = ssh_arg
|
||||
res = h.run_local(
|
||||
["nix", "flake", "archive", "--to", f"ssh://{target}", "--json"],
|
||||
check=True,
|
||||
stdout=subprocess.PIPE,
|
||||
extra_env=dict(NIX_SSHOPTS=ssh_arg),
|
||||
extra_env=env
|
||||
)
|
||||
data = json.loads(res.stdout)
|
||||
path = data["path"]
|
||||
|
|
Loading…
Reference in New Issue
Block a user