This commit is contained in:
Autumn Liu
2026-09-13 20:23:36 -05:00
parent f9d92fc62d
commit e8cc76844d
2 changed files with 6 additions and 2 deletions
+1 -2
View File
@@ -295,7 +295,6 @@ rec {
+ lib.optionalString useIdmap ":idmap"
) allBindMounts;
bindMountHostPaths = map (bm: bm.hostPath) (lib.attrValues allBindMounts);
deviceFlags = map (d: "--bind=${d}") devices;
inherit (deriveIdentity ifPrefix.nspawn name)
iface
mac
@@ -382,7 +381,7 @@ rec {
nixosContainer = {
inherit autoStart privateUsers;
bindMounts = { };
extraFlags = bindMountExtraFlags ++ deviceFlags;
extraFlags = bindMountExtraFlags;
privateNetwork = true;
extraVeths = linkVeths;
config =
+5
View File
@@ -333,6 +333,11 @@ with subtest("(functional): published ports follow the container's lifetime"):
with subtest("(functional): declared devices are usable in-container"):
for name, devices in DEVICES.items():
for dev in devices:
if server.execute(f"test -e {dev}")[0] != 0:
# host lacks the device (e.g. /dev/kvm without nested
# virtualization, as in this test's own VM) - nspawn skips
# populating it in-container, so there's nothing to check.
continue
# opened, not stat'd: without DeviceAllow= the node is still visible
server.succeed(ct_cmd(name, f"exec 3<> {dev}"))