Revert "clan-cli: deprecate nix_shell() in favor of run_cmd()"

This reverts commit a598b878a5.
This commit is contained in:
Jörg Thalheim
2024-07-17 14:04:49 +02:00
parent 0518f875cd
commit 64956a7a0a
24 changed files with 116 additions and 104 deletions

View File

@@ -19,7 +19,7 @@ from ..errors import ClanError
from ..git import commit_files
from ..machines.inventory import get_all_machines, get_selected_machines
from ..machines.machines import Machine
from ..nix import run_cmd
from ..nix import nix_shell
from .check import check_secrets
from .public_modules import FactStoreBase
from .secret_modules import SecretStoreBase
@@ -39,10 +39,10 @@ def read_multiline_input(prompt: str = "Finish with Ctrl-D") -> str:
def bubblewrap_cmd(generator: str, facts_dir: Path, secrets_dir: Path) -> list[str]:
# fmt: off
return run_cmd(
return nix_shell(
[
"bash",
"bubblewrap",
"nixpkgs#bash",
"nixpkgs#bubblewrap",
],
[
"bwrap",

View File

@@ -3,7 +3,7 @@ import subprocess
from pathlib import Path
from clan_cli.machines.machines import Machine
from clan_cli.nix import run_cmd
from clan_cli.nix import nix_shell
from . import SecretStoreBase
@@ -16,8 +16,8 @@ class SecretStore(SecretStoreBase):
self, service: str, name: str, value: bytes, groups: list[str]
) -> Path | None:
subprocess.run(
run_cmd(
["pass"],
nix_shell(
["nixpkgs#pass"],
["pass", "insert", "-m", f"machines/{self.machine.name}/{name}"],
),
input=value,
@@ -27,8 +27,8 @@ class SecretStore(SecretStoreBase):
def get(self, service: str, name: str) -> bytes:
return subprocess.run(
run_cmd(
["pass"],
nix_shell(
["nixpkgs#pass"],
["pass", "show", f"machines/{self.machine.name}/{name}"],
),
check=True,
@@ -49,8 +49,8 @@ class SecretStore(SecretStoreBase):
hashes = []
hashes.append(
subprocess.run(
run_cmd(
["git"],
nix_shell(
["nixpkgs#git"],
[
"git",
"-C",
@@ -68,8 +68,8 @@ class SecretStore(SecretStoreBase):
if symlink.is_symlink():
hashes.append(
subprocess.run(
run_cmd(
["git"],
nix_shell(
["nixpkgs#git"],
[
"git",
"-C",

View File

@@ -7,7 +7,7 @@ from tempfile import TemporaryDirectory
from ..cmd import Log, run
from ..completions import add_dynamic_completer, complete_machines
from ..machines.machines import Machine
from ..nix import run_cmd
from ..nix import nix_shell
log = logging.getLogger(__name__)
@@ -25,8 +25,8 @@ def upload_secrets(machine: Machine) -> None:
ssh_cmd = host.ssh_cmd()
run(
run_cmd(
["rsync"],
nix_shell(
["nixpkgs#rsync"],
[
"rsync",
"-e",