generated from Luis/nextjs-python-web-template
secrets deploy/generate: use nix_build_machine
This commit is contained in:
@@ -4,25 +4,20 @@ import sys
|
|||||||
|
|
||||||
from clan_cli.errors import ClanError
|
from clan_cli.errors import ClanError
|
||||||
|
|
||||||
from ..dirs import get_clan_flake_toplevel
|
from ..nix import nix_build_machine
|
||||||
|
|
||||||
|
|
||||||
def deploy_secrets(machine: str) -> None:
|
def deploy_secrets(machine: str) -> None:
|
||||||
clan_flake = get_clan_flake_toplevel()
|
|
||||||
proc = subprocess.run(
|
proc = subprocess.run(
|
||||||
[
|
nix_build_machine(
|
||||||
"nix",
|
machine=machine,
|
||||||
"build",
|
attr=[
|
||||||
"--impure",
|
"config",
|
||||||
"--print-out-paths",
|
"system",
|
||||||
"--expr",
|
"clan",
|
||||||
f'let f = builtins.getFlake "{clan_flake}"; in '
|
"deploySecrets",
|
||||||
"(f.nixosConfigurations."
|
|
||||||
f"{machine}"
|
|
||||||
".extendModules { modules = [{ clanCore.clanDir = "
|
|
||||||
f"{clan_flake}"
|
|
||||||
"; }]; }).config.system.clan.deploySecrets",
|
|
||||||
],
|
],
|
||||||
|
),
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
)
|
)
|
||||||
@@ -32,7 +27,10 @@ def deploy_secrets(machine: str) -> None:
|
|||||||
|
|
||||||
secret_deploy_script = proc.stdout.strip()
|
secret_deploy_script = proc.stdout.strip()
|
||||||
secret_deploy = subprocess.run(
|
secret_deploy = subprocess.run(
|
||||||
[secret_deploy_script],
|
[
|
||||||
|
secret_deploy_script,
|
||||||
|
f"root@{machine}",
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
if secret_deploy.returncode != 0:
|
if secret_deploy.returncode != 0:
|
||||||
|
|||||||
@@ -4,25 +4,20 @@ import sys
|
|||||||
|
|
||||||
from clan_cli.errors import ClanError
|
from clan_cli.errors import ClanError
|
||||||
|
|
||||||
from ..dirs import get_clan_flake_toplevel
|
from ..nix import nix_build_machine
|
||||||
|
|
||||||
|
|
||||||
def generate_secrets(machine: str) -> None:
|
def generate_secrets(machine: str) -> None:
|
||||||
clan_flake = get_clan_flake_toplevel()
|
|
||||||
proc = subprocess.run(
|
proc = subprocess.run(
|
||||||
[
|
nix_build_machine(
|
||||||
"nix",
|
machine=machine,
|
||||||
"build",
|
attr=[
|
||||||
"--impure",
|
"config",
|
||||||
"--print-out-paths",
|
"system",
|
||||||
"--expr",
|
"clan",
|
||||||
f'let f = builtins.getFlake "{clan_flake}"; in '
|
"generateSecrets",
|
||||||
"(f.nixosConfigurations."
|
|
||||||
f"{machine}"
|
|
||||||
".extendModules { modules = [{ clanCore.clanDir = "
|
|
||||||
f"{clan_flake}"
|
|
||||||
"; }]; }).config.system.clan.generateSecrets",
|
|
||||||
],
|
],
|
||||||
|
),
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user