change deployment to use flake only
This commit is contained in:
parent
a7145c7ca3
commit
447094bb01
1 changed files with 10 additions and 12 deletions
22
tasks.py
22
tasks.py
|
@ -9,15 +9,6 @@ from typing import Any, List
|
||||||
from deploykit import DeployGroup, DeployHost
|
from deploykit import DeployGroup, DeployHost
|
||||||
from invoke import task
|
from invoke import task
|
||||||
|
|
||||||
RSYNC_EXCLUDES = [
|
|
||||||
".direnv",
|
|
||||||
".git",
|
|
||||||
".mypy-cache",
|
|
||||||
".ruff_cache",
|
|
||||||
".terraform",
|
|
||||||
"result*",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
def deploy_nixos(hosts: List[DeployHost]) -> None:
|
def deploy_nixos(hosts: List[DeployHost]) -> None:
|
||||||
"""
|
"""
|
||||||
|
@ -25,11 +16,18 @@ def deploy_nixos(hosts: List[DeployHost]) -> None:
|
||||||
"""
|
"""
|
||||||
g = DeployGroup(hosts)
|
g = DeployGroup(hosts)
|
||||||
|
|
||||||
|
res = subprocess.run(
|
||||||
|
["nix", "flake", "metadata", "--json"],
|
||||||
|
check=True,
|
||||||
|
text=True,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
)
|
||||||
|
data = json.loads(res.stdout)
|
||||||
|
path = data["path"]
|
||||||
|
|
||||||
def deploy(h: DeployHost) -> None:
|
def deploy(h: DeployHost) -> None:
|
||||||
target = f"{h.user or 'root'}@{h.host}"
|
target = f"{h.user or 'root'}@{h.host}"
|
||||||
h.run_local(
|
h.run_local(f"rsync -vaF --delete -e ssh {path}/ {target}:/etc/nixos")
|
||||||
f"rsync {' --exclude '.join([''] + RSYNC_EXCLUDES)} -vaF --delete -e ssh . {target}:/etc/nixos"
|
|
||||||
)
|
|
||||||
|
|
||||||
h.run("nixos-rebuild switch --option accept-flake-config true")
|
h.run("nixos-rebuild switch --option accept-flake-config true")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue