clan-cli: move clan_cli.nix to clan_lib.nix
This commit is contained in:
@@ -2,8 +2,9 @@ import os
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
from clan_lib.nix import nix_shell
|
||||
|
||||
from clan_cli.cmd import Log, RunOpts, run
|
||||
from clan_cli.nix import nix_shell
|
||||
|
||||
_works: bool | None = None
|
||||
|
||||
|
||||
@@ -7,11 +7,11 @@ from pathlib import Path
|
||||
from clan_lib.api import API
|
||||
from clan_lib.errors import ClanError
|
||||
from clan_lib.flake import Flake
|
||||
from clan_lib.nix import nix_command, nix_metadata, nix_shell
|
||||
from clan_lib.nix_models.inventory import Inventory
|
||||
from clan_lib.persist.inventory_store import InventoryStore
|
||||
|
||||
from clan_cli.cmd import CmdOut, RunOpts, run
|
||||
from clan_cli.nix import nix_command, nix_metadata, nix_shell
|
||||
from clan_cli.templates import (
|
||||
InputPrio,
|
||||
TemplateName,
|
||||
|
||||
@@ -5,18 +5,18 @@ from typing import Any
|
||||
|
||||
from clan_lib.errors import ClanError
|
||||
from clan_lib.flake import Flake
|
||||
|
||||
from clan_cli.cmd import run
|
||||
from clan_cli.dirs import machine_gcroot
|
||||
from clan_cli.machines.list import list_machines
|
||||
from clan_cli.machines.machines import Machine
|
||||
from clan_cli.nix import (
|
||||
from clan_lib.nix import (
|
||||
nix_add_to_gcroots,
|
||||
nix_build,
|
||||
nix_config,
|
||||
nix_eval,
|
||||
nix_metadata,
|
||||
)
|
||||
|
||||
from clan_cli.cmd import run
|
||||
from clan_cli.dirs import machine_gcroot
|
||||
from clan_cli.machines.list import list_machines
|
||||
from clan_cli.machines.machines import Machine
|
||||
from clan_cli.vms.inspect import VmConfig, inspect_vm
|
||||
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ from urllib.parse import urlparse
|
||||
from clan_lib.api import API
|
||||
from clan_lib.errors import ClanCmdError, ClanError
|
||||
from clan_lib.flake import Flake
|
||||
from clan_lib.nix import nix_eval
|
||||
from clan_lib.nix_models.inventory import Meta
|
||||
|
||||
from clan_cli.cmd import run
|
||||
from clan_cli.nix import nix_eval
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -7,8 +7,9 @@ from collections.abc import Callable, Iterable
|
||||
from types import ModuleType
|
||||
from typing import Any
|
||||
|
||||
from clan_lib.nix import nix_eval
|
||||
|
||||
from .cmd import run
|
||||
from .nix import nix_eval
|
||||
|
||||
"""
|
||||
This module provides dynamic completions.
|
||||
|
||||
@@ -8,6 +8,7 @@ from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from clan_lib.errors import ClanError
|
||||
from clan_lib.nix import nix_shell
|
||||
|
||||
from clan_cli.cmd import RunOpts, run
|
||||
from clan_cli.completions import (
|
||||
@@ -18,7 +19,6 @@ from clan_cli.completions import (
|
||||
from clan_cli.git import commit_files
|
||||
from clan_cli.machines.list import list_machines
|
||||
from clan_cli.machines.machines import Machine
|
||||
from clan_cli.nix import nix_shell
|
||||
|
||||
from .check import check_secrets
|
||||
from .public_modules import FactStoreBase
|
||||
|
||||
@@ -3,9 +3,10 @@ import subprocess
|
||||
from pathlib import Path
|
||||
from typing import override
|
||||
|
||||
from clan_lib.nix import nix_shell
|
||||
|
||||
from clan_cli.cmd import Log, RunOpts
|
||||
from clan_cli.machines.machines import Machine
|
||||
from clan_cli.nix import nix_shell
|
||||
from clan_cli.ssh.host import Host
|
||||
|
||||
from . import SecretStoreBase
|
||||
|
||||
@@ -8,11 +8,11 @@ from typing import Any
|
||||
|
||||
from clan_lib.api import API
|
||||
from clan_lib.errors import ClanError
|
||||
from clan_lib.nix import nix_shell
|
||||
|
||||
from clan_cli.cmd import Log, RunOpts, cmd_with_root, run
|
||||
from clan_cli.facts.generate import generate_facts
|
||||
from clan_cli.machines.machines import Machine
|
||||
from clan_cli.nix import nix_shell
|
||||
from clan_cli.vars.generate import generate_vars
|
||||
from clan_cli.vars.upload import populate_secret_vars
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ from pathlib import Path
|
||||
|
||||
from clan_lib.api import API
|
||||
from clan_lib.errors import ClanError
|
||||
from clan_lib.nix import nix_build
|
||||
|
||||
from clan_cli.cmd import Log, RunOpts, run
|
||||
from clan_cli.nix import nix_build
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@ import os
|
||||
from pathlib import Path
|
||||
|
||||
from clan_lib.errors import ClanError
|
||||
from clan_lib.nix import nix_shell
|
||||
|
||||
from .cmd import Log, RunOpts, run
|
||||
from .locked_open import locked_open
|
||||
from .nix import nix_shell
|
||||
|
||||
|
||||
def commit_file(
|
||||
|
||||
@@ -7,13 +7,13 @@ from pathlib import Path
|
||||
|
||||
from clan_lib.api import API
|
||||
from clan_lib.errors import ClanCmdError, ClanError
|
||||
from clan_lib.nix import nix_config, nix_eval
|
||||
|
||||
from clan_cli.cmd import RunOpts, run
|
||||
from clan_cli.completions import add_dynamic_completer, complete_machines
|
||||
from clan_cli.dirs import specific_machine_dir
|
||||
from clan_cli.git import commit_file
|
||||
from clan_cli.machines.machines import Machine
|
||||
from clan_cli.nix import nix_config, nix_eval
|
||||
|
||||
from .types import machine_name_type
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ from tempfile import TemporaryDirectory
|
||||
|
||||
from clan_lib.api import API
|
||||
from clan_lib.errors import ClanError
|
||||
from clan_lib.nix import nix_shell
|
||||
|
||||
from clan_cli.cmd import Log, RunOpts, run
|
||||
from clan_cli.completions import (
|
||||
@@ -19,7 +20,6 @@ from clan_cli.completions import (
|
||||
from clan_cli.facts.generate import generate_facts
|
||||
from clan_cli.machines.hardware import HardwareConfig
|
||||
from clan_cli.machines.machines import Machine
|
||||
from clan_cli.nix import nix_shell
|
||||
from clan_cli.ssh.deploy_info import DeployInfo, find_reachable_host, ssh_command_parse
|
||||
from clan_cli.ssh.host_key import HostKeyCheck
|
||||
from clan_cli.vars.generate import generate_vars
|
||||
|
||||
@@ -11,11 +11,11 @@ from typing import TYPE_CHECKING, Any
|
||||
|
||||
from clan_lib.errors import ClanCmdError, ClanError
|
||||
from clan_lib.flake import Flake
|
||||
from clan_lib.nix import nix_config, nix_eval, nix_test_store
|
||||
|
||||
from clan_cli.cmd import Log, RunOpts, run
|
||||
from clan_cli.facts import public_modules as facts_public_modules
|
||||
from clan_cli.facts import secret_modules as facts_secret_modules
|
||||
from clan_cli.nix import nix_config, nix_eval, nix_test_store
|
||||
from clan_cli.ssh.host import Host
|
||||
from clan_cli.ssh.host_key import HostKeyCheck
|
||||
from clan_cli.ssh.parse import parse_deployment_address
|
||||
|
||||
@@ -9,13 +9,13 @@ from tempfile import TemporaryDirectory
|
||||
|
||||
from clan_lib.errors import ClanError
|
||||
from clan_lib.flake import Flake
|
||||
from clan_lib.nix import nix_build, nix_command
|
||||
from clan_lib.nix_models.inventory import Machine as InventoryMachine
|
||||
|
||||
from clan_cli.cmd import Log, RunOpts, run
|
||||
from clan_cli.dirs import get_clan_flake_toplevel_or_env
|
||||
from clan_cli.machines.create import CreateOptions, create_machine
|
||||
from clan_cli.machines.machines import Machine
|
||||
from clan_cli.nix import nix_build, nix_command
|
||||
from clan_cli.vars.generate import generate_vars
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -9,6 +9,7 @@ from contextlib import ExitStack
|
||||
|
||||
from clan_lib.api import API
|
||||
from clan_lib.errors import ClanError
|
||||
from clan_lib.nix import nix_command, nix_config, nix_metadata
|
||||
|
||||
from clan_cli.async_run import AsyncContext, AsyncOpts, AsyncRuntime, is_async_cancelled
|
||||
from clan_cli.cmd import Log, MsgColor, RunOpts, run
|
||||
@@ -21,7 +22,6 @@ from clan_cli.facts.generate import generate_facts
|
||||
from clan_cli.facts.upload import upload_secrets
|
||||
from clan_cli.machines.list import list_machines
|
||||
from clan_cli.machines.machines import Machine
|
||||
from clan_cli.nix import nix_command, nix_config, nix_metadata
|
||||
from clan_cli.ssh.host import Host, HostKeyCheck
|
||||
from clan_cli.vars.generate import generate_vars
|
||||
from clan_cli.vars.upload import upload_secret_vars
|
||||
|
||||
@@ -1,169 +0,0 @@
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
from functools import cache
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from clan_lib.errors import ClanError
|
||||
|
||||
from clan_cli.cmd import run
|
||||
from clan_cli.dirs import nixpkgs_flake, nixpkgs_source
|
||||
from clan_cli.locked_open import locked_open
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def nix_command(flags: list[str]) -> list[str]:
|
||||
args = ["nix", "--extra-experimental-features", "nix-command flakes", *flags]
|
||||
if store := nix_test_store():
|
||||
args += ["--store", str(store)]
|
||||
return args
|
||||
|
||||
|
||||
def nix_flake_show(flake_url: str | Path) -> list[str]:
|
||||
return nix_command(
|
||||
[
|
||||
"flake",
|
||||
"show",
|
||||
"--json",
|
||||
*(["--show-trace"] if log.isEnabledFor(logging.DEBUG) else []),
|
||||
str(flake_url),
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def nix_build(flags: list[str], gcroot: Path | None = None) -> list[str]:
|
||||
return nix_command(
|
||||
[
|
||||
"build",
|
||||
"--print-out-paths",
|
||||
"--print-build-logs",
|
||||
*(["--show-trace"] if log.isEnabledFor(logging.DEBUG) else []),
|
||||
*(["--out-root", str(gcroot)] if gcroot is not None else ["--no-link"]),
|
||||
*flags,
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def nix_add_to_gcroots(nix_path: Path, dest: Path) -> None:
|
||||
if not os.environ.get("IN_NIX_SANDBOX"):
|
||||
cmd = ["nix-store", "--realise", f"{nix_path}", "--add-root", f"{dest}"]
|
||||
run(cmd)
|
||||
|
||||
|
||||
@cache
|
||||
def nix_config() -> dict[str, Any]:
|
||||
cmd = nix_command(["config", "show", "--json"])
|
||||
proc = run(cmd)
|
||||
data = json.loads(proc.stdout)
|
||||
config = {}
|
||||
for key, value in data.items():
|
||||
config[key] = value["value"]
|
||||
return config
|
||||
|
||||
|
||||
def nix_test_store() -> Path | None:
|
||||
store = os.environ.get("CLAN_TEST_STORE", None)
|
||||
lock_nix = os.environ.get("LOCK_NIX", "")
|
||||
|
||||
if not lock_nix:
|
||||
lock_nix = tempfile.NamedTemporaryFile().name # NOQA: SIM115
|
||||
if not os.environ.get("IN_NIX_SANDBOX"):
|
||||
return None
|
||||
if store:
|
||||
Path.mkdir(Path(store), exist_ok=True)
|
||||
with locked_open(Path(lock_nix), "w"):
|
||||
return Path(store)
|
||||
return None
|
||||
|
||||
|
||||
def nix_eval(flags: list[str]) -> list[str]:
|
||||
default_flags = nix_command(
|
||||
[
|
||||
"eval",
|
||||
*(["--show-trace"] if log.isEnabledFor(logging.DEBUG) else []),
|
||||
"--json",
|
||||
"--print-build-logs",
|
||||
]
|
||||
)
|
||||
if os.environ.get("IN_NIX_SANDBOX"):
|
||||
return [
|
||||
*default_flags,
|
||||
"--override-input",
|
||||
"nixpkgs",
|
||||
str(nixpkgs_source()),
|
||||
*flags,
|
||||
]
|
||||
return default_flags + flags
|
||||
|
||||
|
||||
def nix_metadata(flake_url: str | Path) -> dict[str, Any]:
|
||||
cmd = nix_command(["flake", "metadata", "--json", f"{flake_url}"])
|
||||
proc = run(cmd)
|
||||
data = json.loads(proc.stdout)
|
||||
return data
|
||||
|
||||
|
||||
# lazy loads list of allowed and static programs
|
||||
class Packages:
|
||||
allowed_packages: set[str] | None = None
|
||||
static_packages: set[str] | None = None
|
||||
|
||||
@classmethod
|
||||
def ensure_allowed(cls: type["Packages"], package: str) -> None:
|
||||
if cls.allowed_packages is None:
|
||||
with (Path(__file__).parent / "allowed-packages.json").open() as f:
|
||||
cls.allowed_packages = allowed_packages = set(json.load(f))
|
||||
else:
|
||||
allowed_packages = cls.allowed_packages
|
||||
|
||||
if package not in allowed_packages:
|
||||
msg = f"Package not allowed: '{package}', allowed packages are:\n{'\n'.join(allowed_packages)}"
|
||||
raise ClanError(msg)
|
||||
|
||||
@classmethod
|
||||
def is_provided(cls: type["Packages"], program: str) -> bool:
|
||||
"""
|
||||
Determines if a program is shipped with the clan package.
|
||||
"""
|
||||
if cls.static_packages is None:
|
||||
cls.static_packages = set(
|
||||
os.environ.get("CLAN_PROVIDED_PACKAGES", "").split(":")
|
||||
)
|
||||
|
||||
if program in cls.static_packages:
|
||||
if shutil.which(program) is None:
|
||||
log.warning(
|
||||
"Program %s is not in the path even though it should be shipped with clan",
|
||||
program,
|
||||
)
|
||||
return False
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
# Features:
|
||||
# - allow list for programs (need to be specified in allowed-packages.json)
|
||||
# - be abe to compute a closure of all deps for testing
|
||||
# - build clan distributions that ship some or all packages (eg. clan-cli-full)
|
||||
def nix_shell(packages: list[str], cmd: list[str]) -> list[str]:
|
||||
for program in packages:
|
||||
Packages.ensure_allowed(program)
|
||||
if os.environ.get("IN_NIX_SANDBOX"):
|
||||
return cmd
|
||||
missing_packages = [
|
||||
f"nixpkgs#{package}"
|
||||
for package in packages
|
||||
if not Packages.is_provided(package)
|
||||
]
|
||||
if not missing_packages:
|
||||
return cmd
|
||||
return [
|
||||
*nix_command(["shell", "--inputs-from", f"{nixpkgs_flake()!s}"]),
|
||||
*missing_packages,
|
||||
"-c",
|
||||
*cmd,
|
||||
]
|
||||
@@ -1,34 +0,0 @@
|
||||
[
|
||||
"age",
|
||||
"age-plugin-fido2-hmac",
|
||||
"age-plugin-ledger",
|
||||
"age-plugin-se",
|
||||
"age-plugin-sss",
|
||||
"age-plugin-tpm",
|
||||
"age-plugin-yubikey",
|
||||
"age-plugin-1p",
|
||||
"avahi",
|
||||
"bash",
|
||||
"bubblewrap",
|
||||
"disko",
|
||||
"e2fsprogs",
|
||||
"git",
|
||||
"gnupg",
|
||||
"mypy",
|
||||
"netcat",
|
||||
"nix",
|
||||
"nixos-anywhere",
|
||||
"openssh",
|
||||
"pass",
|
||||
"qemu",
|
||||
"rsync",
|
||||
"shellcheck-minimal",
|
||||
"sops",
|
||||
"sshpass",
|
||||
"tor",
|
||||
"util-linux",
|
||||
"virt-viewer",
|
||||
"virtiofsd",
|
||||
"waypipe",
|
||||
"zbar"
|
||||
]
|
||||
@@ -4,6 +4,7 @@ import sys
|
||||
from pathlib import Path
|
||||
|
||||
from clan_lib.errors import ClanError
|
||||
from clan_lib.nix import nix_shell
|
||||
|
||||
from clan_cli.cmd import RunOpts, run
|
||||
from clan_cli.completions import (
|
||||
@@ -12,7 +13,6 @@ from clan_cli.completions import (
|
||||
complete_machines,
|
||||
complete_users,
|
||||
)
|
||||
from clan_cli.nix import nix_shell
|
||||
|
||||
from .secrets import encrypt_secret, sops_secrets_folder
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@ from typing import IO, Any
|
||||
from clan_lib.api import API
|
||||
from clan_lib.errors import ClanError
|
||||
from clan_lib.flake import Flake
|
||||
from clan_lib.nix import nix_shell
|
||||
|
||||
from clan_cli.cmd import Log, RunOpts, run
|
||||
from clan_cli.dirs import user_config_dir
|
||||
from clan_cli.nix import nix_shell
|
||||
|
||||
from .folders import sops_users_folder
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from clan_lib.errors import ClanError
|
||||
from clan_lib.nix import nix_shell
|
||||
|
||||
from clan_cli.async_run import AsyncRuntime
|
||||
from clan_cli.cmd import run
|
||||
@@ -15,7 +16,6 @@ from clan_cli.completions import (
|
||||
complete_machines,
|
||||
)
|
||||
from clan_cli.machines.machines import Machine
|
||||
from clan_cli.nix import nix_shell
|
||||
from clan_cli.ssh.host import Host, is_ssh_reachable
|
||||
from clan_cli.ssh.host_key import HostKeyCheck
|
||||
from clan_cli.ssh.parse import parse_deployment_address
|
||||
|
||||
@@ -14,10 +14,10 @@ from tempfile import TemporaryDirectory
|
||||
from typing import Any
|
||||
|
||||
from clan_lib.errors import ClanError
|
||||
from clan_lib.nix import nix_shell
|
||||
|
||||
from clan_cli.cmd import CmdOut, RunOpts, run
|
||||
from clan_cli.colors import AnsiColor
|
||||
from clan_cli.nix import nix_shell
|
||||
from clan_cli.ssh.host_key import HostKeyCheck
|
||||
|
||||
cmdlog = logging.getLogger(__name__)
|
||||
|
||||
@@ -8,10 +8,10 @@ import time
|
||||
from dataclasses import dataclass
|
||||
|
||||
from clan_lib.errors import TorConnectionError, TorSocksError
|
||||
from clan_lib.nix import nix_shell
|
||||
|
||||
from clan_cli.async_run import AsyncRuntime
|
||||
from clan_cli.cmd import Log, RunOpts, run
|
||||
from clan_cli.nix import nix_shell
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import logging
|
||||
from pathlib import Path
|
||||
|
||||
from clan_lib.errors import ClanCmdError, ClanError
|
||||
from clan_lib.nix import nix_eval
|
||||
|
||||
from clan_cli.cmd import RunOpts, run
|
||||
from clan_cli.completions import (
|
||||
@@ -13,7 +14,6 @@ from clan_cli.completions import (
|
||||
)
|
||||
from clan_cli.dirs import get_clan_flake_toplevel_or_env
|
||||
from clan_cli.machines.machines import Machine
|
||||
from clan_cli.nix import nix_eval
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -18,12 +18,12 @@ from clan_cli.dirs import (
|
||||
)
|
||||
from clan_cli.locked_open import locked_open
|
||||
from clan_cli.machines.machines import Machine
|
||||
from clan_cli.nix import nix_test_store
|
||||
from clan_cli.tests import age_keys
|
||||
from clan_cli.tests.fixture_error import FixtureError
|
||||
from clan_cli.tests.root import CLAN_CORE
|
||||
from clan_cli.tests.temporary_dir import TEMPDIR
|
||||
from clan_lib.flake import Flake
|
||||
from clan_lib.nix import nix_test_store
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from clan_cli.nix import nix_shell
|
||||
from clan_lib.nix import nix_shell
|
||||
|
||||
|
||||
# fixture for git_repo
|
||||
|
||||
@@ -8,7 +8,6 @@ import pytest
|
||||
from clan_cli.cmd import run
|
||||
from clan_cli.git import commit_file
|
||||
from clan_cli.locked_open import locked_open
|
||||
from clan_cli.nix import nix_command
|
||||
from clan_cli.templates import (
|
||||
ClanExports,
|
||||
InputName,
|
||||
@@ -20,6 +19,7 @@ from clan_cli.templates import (
|
||||
)
|
||||
from clan_cli.tests.fixtures_flakes import FlakeForTest
|
||||
from clan_lib.flake import Flake
|
||||
from clan_lib.nix import nix_command
|
||||
|
||||
|
||||
# Function to write clan attributes to a file
|
||||
|
||||
@@ -4,10 +4,10 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from clan_cli.cmd import run
|
||||
from clan_cli.nix import nix_flake_show
|
||||
from clan_cli.tests.fixtures_flakes import FlakeForTest, substitute
|
||||
from clan_cli.tests.helpers import cli
|
||||
from clan_cli.tests.stdout import CaptureOutput
|
||||
from clan_lib.nix import nix_flake_show
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@ from typing import TYPE_CHECKING
|
||||
|
||||
import pytest
|
||||
from clan_cli.machines.create import CreateOptions, create_machine
|
||||
from clan_cli.nix import nix_eval, run
|
||||
from clan_cli.tests.fixtures_flakes import FlakeForTest
|
||||
from clan_lib.api.modules import list_modules
|
||||
from clan_lib.flake import Flake
|
||||
from clan_lib.nix import nix_eval, run
|
||||
from clan_lib.nix_models.inventory import (
|
||||
Inventory,
|
||||
Machine,
|
||||
|
||||
@@ -5,7 +5,6 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from clan_cli.machines.machines import Machine
|
||||
from clan_cli.nix import nix_eval, run
|
||||
from clan_cli.tests.age_keys import SopsSetup
|
||||
from clan_cli.tests.fixtures_flakes import ClanFlake
|
||||
from clan_cli.tests.helpers import cli
|
||||
@@ -24,6 +23,7 @@ from clan_cli.vars.secret_modules import password_store, sops
|
||||
from clan_cli.vars.set import set_var
|
||||
from clan_lib.errors import ClanError
|
||||
from clan_lib.flake import Flake
|
||||
from clan_lib.nix import nix_eval, run
|
||||
|
||||
|
||||
def test_dependencies_as_files(temp_dir: Path) -> None:
|
||||
@@ -451,7 +451,7 @@ def test_generate_secret_for_multiple_machines(
|
||||
) -> None:
|
||||
flake = flake_with_sops
|
||||
|
||||
from clan_cli.nix import nix_config
|
||||
from clan_lib.nix import nix_config
|
||||
|
||||
local_system = nix_config()["system"]
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@ from contextlib import ExitStack
|
||||
import pytest
|
||||
from clan_cli import cmd
|
||||
from clan_cli.machines.machines import Machine
|
||||
from clan_cli.nix import nix_eval, run
|
||||
from clan_cli.tests.age_keys import SopsSetup
|
||||
from clan_cli.tests.fixtures_flakes import ClanFlake
|
||||
from clan_cli.tests.helpers import cli
|
||||
from clan_cli.tests.nix_config import ConfigItem
|
||||
from clan_cli.vms.run import inspect_vm, spawn_vm
|
||||
from clan_lib.flake import Flake
|
||||
from clan_lib.nix import nix_eval, run
|
||||
|
||||
|
||||
@pytest.mark.impure
|
||||
|
||||
@@ -17,12 +17,12 @@ from clan_cli.completions import (
|
||||
)
|
||||
from clan_cli.git import commit_files
|
||||
from clan_cli.machines.list import list_machines
|
||||
from clan_cli.nix import nix_config, nix_shell, nix_test_store
|
||||
from clan_cli.vars._types import StoreBase
|
||||
from clan_cli.vars.migration import check_can_migrate, migrate_files
|
||||
from clan_lib.api import API
|
||||
from clan_lib.errors import ClanError
|
||||
from clan_lib.flake import Flake
|
||||
from clan_lib.nix import nix_config, nix_shell, nix_test_store
|
||||
|
||||
from .check import check_vars
|
||||
from .graph import (
|
||||
|
||||
@@ -9,11 +9,11 @@ from tempfile import TemporaryDirectory
|
||||
|
||||
from clan_cli.cmd import CmdOut, Log, RunOpts, run
|
||||
from clan_cli.machines.machines import Machine
|
||||
from clan_cli.nix import nix_shell
|
||||
from clan_cli.ssh.host import Host
|
||||
from clan_cli.ssh.upload import upload
|
||||
from clan_cli.vars._types import StoreBase
|
||||
from clan_cli.vars.generate import Generator, Var
|
||||
from clan_lib.nix import nix_shell
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@ from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from clan_lib.errors import ClanCmdError, ClanError
|
||||
from clan_lib.nix import nix_shell
|
||||
|
||||
from clan_cli.cmd import CmdOut, Log, RunOpts, handle_io, run
|
||||
from clan_cli.completions import add_dynamic_completer, complete_machines
|
||||
from clan_cli.dirs import module_root, user_cache_dir, vm_state_dir
|
||||
from clan_cli.facts.generate import generate_facts
|
||||
from clan_cli.machines.machines import Machine
|
||||
from clan_cli.nix import nix_shell
|
||||
from clan_cli.qemu.qga import QgaSession
|
||||
from clan_cli.qemu.qmp import QEMUMonitorProtocol
|
||||
from clan_cli.vars.generate import generate_vars
|
||||
|
||||
@@ -6,8 +6,7 @@ from collections.abc import Iterator
|
||||
from pathlib import Path
|
||||
|
||||
from clan_lib.errors import ClanError
|
||||
|
||||
from clan_cli.nix import nix_shell
|
||||
from clan_lib.nix import nix_shell
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
|
||||
@@ -6,8 +6,7 @@ import time
|
||||
from collections.abc import Iterator
|
||||
|
||||
from clan_lib.errors import ClanError
|
||||
|
||||
from clan_cli.nix import nix_shell
|
||||
from clan_lib.nix import nix_shell
|
||||
|
||||
VMADDR_CID_HYPERVISOR = 2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user