@cryptotaxi247 / infra-1 / commits / b481df7d

builders: add support for systemd-nspawn containers

This is part of https://github.com/NixOS/infra/issues/987. It gets standalone nspawn containers working, but not tests that include both nspawn containers and qemu vms. We discussed this at our last team meeting, and folks didn't seem to object to enabling these tests. At the time, I thought it was a purely hypothetical conversation, but it turns out that some of our jobsets in Hydra actually do [include these new tests](https://github.com/NixOS/nixpkgs/pull/478109#issuecomment-4116714697).

Jeremy Fleischman committed Mar 24, 2026 at 03:58 UTC b481df7d901544783a3e54fbbd36ffea109af018
2 files changed +18
builders/common/nspawn-test-containers.nix new
+17
@@ -0,0 +1,17 @@
1 +{
2 + # From <https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/development/running-nixos-tests.section.md#system-requirements-sec-running-nixos-tests-requirements>:
3 + # > NixOS tests using systemd-nspawn containers require the Nix daemon to be
4 + # > configured with the following settings:
5 + nix.settings = {
6 + auto-allocate-uids = true;
7 + extra-system-features = [ "uid-range" ];
8 + experimental-features = [
9 + "auto-allocate-uids"
10 + "cgroups"
11 + ];
12 + };
13 +
14 + # Required for communication between nspawn containers and qemu vms.
15 + # Disabled for now, see <https://github.com/NixOS/infra/issues/987>.
16 + # nix.settings.sandbox-paths = [ "/dev/net" ];
17 +}
builders/flake-module.nix
+1
@@ -17,6 +17,7 @@
17 ./common/network.nix
18 ./common/nix.nix
19 ./common/node-exporter.nix
20 + ./common/nspawn-test-containers.nix
21 ./common/hydra-queue-builder.nix
22 ./common/system.nix
23 ./common/tools.nix