Reapply "remove nix_shell_legacy"

This reverts commit c5001f19fc.
This commit is contained in:
Jörg Thalheim
2025-04-21 13:03:25 +02:00
parent 7c57b853e6
commit 723d72255c
24 changed files with 91 additions and 119 deletions

View File

@@ -19,7 +19,7 @@ from clan_cli.dirs import module_root, user_cache_dir, vm_state_dir
from clan_cli.errors import ClanCmdError, ClanError
from clan_cli.facts.generate import generate_facts
from clan_cli.machines.machines import Machine
from clan_cli.nix import nix_shell_legacy
from clan_cli.nix import nix_shell
from clan_cli.qemu.qga import QgaSession
from clan_cli.qemu.qmp import QEMUMonitorProtocol
@@ -96,8 +96,8 @@ def prepare_disk(
file_name: str = "disk.img",
) -> Path:
disk_img = directory / file_name
cmd = nix_shell_legacy(
["nixpkgs#qemu"],
cmd = nix_shell(
["qemu"],
[
"qemu-img",
"create",
@@ -127,7 +127,7 @@ def start_vm(
) -> Iterator[subprocess.Popen]:
env = os.environ.copy()
env.update(extra_env)
cmd = nix_shell_legacy(packages, args)
cmd = nix_shell(packages, args)
machine.debug(f"Starting VM with command: {cmd}")
with subprocess.Popen(
@@ -280,11 +280,11 @@ def spawn_vm(
interactive=stdin is None,
)
packages = ["nixpkgs#qemu"]
packages = ["qemu"]
extra_env = {}
if vm.graphics and not vm.waypipe.enable:
packages.append("nixpkgs#virt-viewer")
packages.append("virt-viewer")
remote_viewer_mimetypes = module_root() / "vms" / "mimetypes"
extra_env["XDG_DATA_DIRS"] = (
f"{remote_viewer_mimetypes}:{os.environ.get('XDG_DATA_DIRS', '')}"