Revert "remove nix_shell_legacy"

This reverts commit 8cde32c76f.
This commit is contained in:
Johannes Kirschbauer
2025-04-18 14:47:37 +02:00
parent 83542b20b4
commit 1232fb5af2
24 changed files with 119 additions and 91 deletions

View File

@@ -2,19 +2,21 @@ import subprocess
from pathlib import Path
import pytest
from clan_cli.nix import nix_shell
from clan_cli.nix import nix_shell_legacy
# fixture for git_repo
@pytest.fixture
def git_repo(temp_dir: Path) -> Path:
# initialize a git repository
cmd = nix_shell(["git"], ["git", "init"])
cmd = nix_shell_legacy(["nixpkgs#git"], ["git", "init"])
subprocess.run(cmd, cwd=temp_dir, check=True)
# set user.name and user.email
cmd = nix_shell(["git"], ["git", "config", "user.name", "test"])
cmd = nix_shell_legacy(["nixpkgs#git"], ["git", "config", "user.name", "test"])
subprocess.run(cmd, cwd=temp_dir, check=True)
cmd = nix_shell(["git"], ["git", "config", "user.email", "test@test.test"])
cmd = nix_shell_legacy(
["nixpkgs#git"], ["git", "config", "user.email", "test@test.test"]
)
subprocess.run(cmd, cwd=temp_dir, check=True)
# return the path to the git repository
return temp_dir

View File

@@ -6,7 +6,7 @@ from clan_cli.facts.secret_modules.password_store import SecretStore
from clan_cli.flake import Flake
from clan_cli.machines.facts import machine_get_fact
from clan_cli.machines.machines import Machine
from clan_cli.nix import nix_shell
from clan_cli.nix import nix_shell_legacy
from clan_cli.ssh.host import Host
from clan_cli.tests.fixtures_flakes import ClanFlake
from clan_cli.tests.helpers import cli
@@ -58,10 +58,14 @@ def test_upload_secret(
"""
)
subprocess.run(
nix_shell(["gnupg"], ["gpg", "--batch", "--gen-key", str(gpg_key_spec)]),
nix_shell_legacy(
["nixpkgs#gnupg"], ["gpg", "--batch", "--gen-key", str(gpg_key_spec)]
),
check=True,
)
subprocess.run(nix_shell(["pass"], ["pass", "init", "test@local"]), check=True)
subprocess.run(
nix_shell_legacy(["nixpkgs#pass"], ["pass", "init", "test@local"]), check=True
)
cli.run(["facts", "generate", "vm1", "--flake", str(flake.path)])
store = SecretStore(Machine(name="vm1", flake=Flake(str(flake.path))))