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