diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index bda7211ec2ff..435d81b416e9 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -4448,6 +4448,12 @@ githubId = 1276854; name = "Florian Peter"; }; + farnoy = { + email = "jakub@okonski.org"; + github = "farnoy"; + githubId = 345808; + name = "Jakub OkoĊ„ski"; + }; fbeffa = { email = "beffa@fbengineering.ch"; github = "fedeinthemix"; diff --git a/nixos/modules/virtualisation/nixos-containers.nix b/nixos/modules/virtualisation/nixos-containers.nix index fae7c5768052..02414b7d60e9 100644 --- a/nixos/modules/virtualisation/nixos-containers.nix +++ b/nixos/modules/virtualisation/nixos-containers.nix @@ -138,6 +138,8 @@ let fi ''} + export SYSTEMD_NSPAWN_UNIFIED_HIERARCHY=1 + # Run systemd-nspawn without startup notification (we'll # wait for the container systemd to signal readiness) # Kill signal handling means systemd-nspawn will pass a system-halt signal diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 4fa102e3fd71..c7aa9ed78ba4 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -143,6 +143,7 @@ in { containers-reloadable = handleTest ./containers-reloadable.nix {}; containers-restart_networking = handleTest ./containers-restart_networking.nix {}; containers-tmpfs = handleTest ./containers-tmpfs.nix {}; + containers-unified-hierarchy = handleTest ./containers-unified-hierarchy.nix {}; convos = handleTest ./convos.nix {}; corerad = handleTest ./corerad.nix {}; coturn = handleTest ./coturn.nix {}; diff --git a/nixos/tests/containers-unified-hierarchy.nix b/nixos/tests/containers-unified-hierarchy.nix new file mode 100644 index 000000000000..978d59e12c8a --- /dev/null +++ b/nixos/tests/containers-unified-hierarchy.nix @@ -0,0 +1,21 @@ +import ./make-test-python.nix ({ pkgs, lib, ... }: { + name = "containers-unified-hierarchy"; + meta = { + maintainers = with lib.maintainers; [ farnoy ]; + }; + + nodes.machine = { ... }: { + containers = { + test-container = { + autoStart = true; + config = { }; + }; + }; + }; + + testScript = '' + machine.wait_for_unit("default.target") + + machine.succeed("echo 'stat -fc %T /sys/fs/cgroup/ | grep cgroup2fs' | nixos-container root-login test-container") + ''; +}) diff --git a/pkgs/tools/virtualization/nixos-container/default.nix b/pkgs/tools/virtualization/nixos-container/default.nix index be17753b3436..0b44bde4719f 100644 --- a/pkgs/tools/virtualization/nixos-container/default.nix +++ b/pkgs/tools/virtualization/nixos-container/default.nix @@ -25,6 +25,7 @@ substituteAll { containers-ip containers-tmpfs containers-ephemeral + containers-unified-hierarchy ; }; };