virtiofsd: fix nix chroot store support

This commit is contained in:
Jörg Thalheim
2025-08-18 12:32:47 +02:00
parent 815c6c9438
commit 8fe7cb1b3d
3 changed files with 11 additions and 2 deletions

View File

@@ -96,6 +96,7 @@
./nixosModules/flake-module.nix
./pkgs/flake-module.nix
./templates/flake-module.nix
./pkgs/clan-cli/clan_cli/tests/flake-module.nix
]
++ [
(if pathExists ./flakeModules/clan.nix then import ./flakeModules/clan.nix inputs.self else { })

View File

@@ -1,4 +1,5 @@
import contextlib
import logging
import shutil
import subprocess
import time
@@ -6,7 +7,9 @@ from collections.abc import Iterator
from pathlib import Path
from clan_lib.errors import ClanError
from clan_lib.nix import nix_shell
from clan_lib.nix import nix_shell, nix_test_store
log = logging.getLogger(__name__)
@contextlib.contextmanager
@@ -14,6 +17,9 @@ def start_virtiofsd(socket_path: Path) -> Iterator[None]:
sandbox = "namespace"
if shutil.which("newuidmap") is None:
sandbox = "none"
store_root = nix_test_store() or Path("/")
store = store_root / "nix" / "store"
virtiofsd = nix_shell(
["virtiofsd"],
[
@@ -25,9 +31,10 @@ def start_virtiofsd(socket_path: Path) -> Iterator[None]:
"--sandbox",
sandbox,
"--shared-dir",
"/nix/store",
str(store),
],
)
log.debug("$ {}".format(" ".join(virtiofsd)))
with subprocess.Popen(virtiofsd) as proc:
try:
while not socket_path.exists():

View File

@@ -25,6 +25,7 @@
"clanServices"
"pkgs/zerotierone"
"pkgs/minifakeroot"
"pkgs/clan-cli/clan_cli/tests/flake-module.nix"
];
};
};