secrets deploy/generate: use nix_build_machine

This commit is contained in:
lassulus
2023-09-13 23:18:05 +02:00
committed by Mic92
parent 6153a9ee71
commit 23c979f8db
2 changed files with 24 additions and 31 deletions

View File

@@ -4,25 +4,20 @@ import sys
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:
clan_flake = get_clan_flake_toplevel()
proc = subprocess.run(
[
"nix",
"build",
"--impure",
"--print-out-paths",
"--expr",
f'let f = builtins.getFlake "{clan_flake}"; in '
"(f.nixosConfigurations."
f"{machine}"
".extendModules { modules = [{ clanCore.clanDir = "
f"{clan_flake}"
"; }]; }).config.system.clan.generateSecrets",
],
nix_build_machine(
machine=machine,
attr=[
"config",
"system",
"clan",
"generateSecrets",
],
),
capture_output=True,
text=True,
)