From 98d17b19d3b854a1d019e7ab31caa94d5b21e210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Bon=C3=A9?= Date: Wed, 27 Aug 2025 15:48:19 +0200 Subject: [PATCH 1/3] Enable custom sys-devices system feature Reviewed-by: Rodrigo Arias Mallo --- m/common/base.nix | 1 + m/common/base/sys-devices.nix | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 m/common/base/sys-devices.nix diff --git a/m/common/base.nix b/m/common/base.nix index cdd1dc19..ba53802e 100644 --- a/m/common/base.nix +++ b/m/common/base.nix @@ -11,6 +11,7 @@ ./base/hw.nix ./base/net.nix ./base/nix.nix + ./base/sys-devices.nix ./base/ntp.nix ./base/rev.nix ./base/ssh.nix diff --git a/m/common/base/sys-devices.nix b/m/common/base/sys-devices.nix new file mode 100644 index 00000000..414d8b66 --- /dev/null +++ b/m/common/base/sys-devices.nix @@ -0,0 +1,9 @@ +{ + nix.settings.system-features = [ "sys-devices" ]; + + programs.nix-required-mounts.enable = true; + programs.nix-required-mounts.allowedPatterns.sys-devices.paths = [ + "/sys/devices/system/cpu" + "/sys/devices/system/node" + ]; +} -- 2.49.0 From 64e2c39582637da9807f66fd8b3a7ff79a5720fa Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Tue, 7 Oct 2025 17:32:01 +0200 Subject: [PATCH 2/3] Add hwloc test with sys-devices feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Aleix Boné --- overlay.nix | 2 +- test/bugs/hwloc.nix | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/overlay.nix b/overlay.nix index 6d2af14b..d54ea481 100644 --- a/overlay.nix +++ b/overlay.nix @@ -62,7 +62,7 @@ let }; tests = rec { - #hwloc = callPackage ./test/bugs/hwloc.nix { }; # Broken, no /sys + hwloc = callPackage ./test/bugs/hwloc.nix { }; #sigsegv = callPackage ./test/reproducers/sigsegv.nix { }; hello-c = callPackage ./test/compilers/hello-c.nix { }; hello-cpp = callPackage ./test/compilers/hello-cpp.nix { }; diff --git a/test/bugs/hwloc.nix b/test/bugs/hwloc.nix index 2546d3d6..8dd73d37 100644 --- a/test/bugs/hwloc.nix +++ b/test/bugs/hwloc.nix @@ -6,6 +6,7 @@ stdenv.mkDerivation { name = "hwloc-test"; + requiredSystemFeatures = [ "sys-devices" ]; src = ./.; @@ -14,7 +15,7 @@ stdenv.mkDerivation { buildPhase = '' ls -l /sys gcc -lhwloc hwloc.c -o hwloc - strace ./hwloc + strace ./hwloc > $out ''; } -- 2.49.0 From dd7f24f45519b39cd381cc58ace902c34ce9ad9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Bon=C3=A9?= Date: Wed, 8 Oct 2025 13:53:11 +0200 Subject: [PATCH 3/3] Replace __noChroot with requiredSystemFeatures Reviewed-by: Rodrigo Arias Mallo Tested-by: Rodrigo Arias Mallo --- test/compilers/clang-openmp-ld.nix | 5 ++--- test/compilers/clang-openmp-nosv.nix | 5 ++--- test/compilers/clang-openmp.nix | 5 ++--- test/compilers/ompss2.nix | 7 ++++--- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/test/compilers/clang-openmp-ld.nix b/test/compilers/clang-openmp-ld.nix index 593706a9..1b9f0bb2 100644 --- a/test/compilers/clang-openmp-ld.nix +++ b/test/compilers/clang-openmp-ld.nix @@ -23,9 +23,8 @@ in stdenv.mkDerivation { dontUnpack = true; dontConfigure = true; - # nOS-V requires access to /sys/devices to request NUMA information. It will - # fail to run otherwise, so we disable the sandbox for this test. - __noChroot = true; + # nOS-V requires access to /sys/devices to request NUMA information + requiredSystemFeatures = [ "sys-devices" ]; buildInputs = [ openmp ]; diff --git a/test/compilers/clang-openmp-nosv.nix b/test/compilers/clang-openmp-nosv.nix index 237e4666..67b8189d 100644 --- a/test/compilers/clang-openmp-nosv.nix +++ b/test/compilers/clang-openmp-nosv.nix @@ -36,9 +36,8 @@ in stdenv.mkDerivation { dontUnpack = true; dontConfigure = true; - # nOS-V requires access to /sys/devices to request NUMA information. It will - # fail to run otherwise, so we disable the sandbox for this test. - __noChroot = true; + # nOS-V requires access to /sys/devices to request NUMA information + requiredSystemFeatures = [ "sys-devices" ]; buildInputs = [ nosv ]; diff --git a/test/compilers/clang-openmp.nix b/test/compilers/clang-openmp.nix index 42044c75..e0833c09 100644 --- a/test/compilers/clang-openmp.nix +++ b/test/compilers/clang-openmp.nix @@ -24,9 +24,8 @@ in stdenv.mkDerivation { dontUnpack = true; dontConfigure = true; - # nOS-V requires access to /sys/devices to request NUMA information. It will - # fail to run otherwise, so we disable the sandbox for this test. - __noChroot = true; + # nOS-V requires access to /sys/devices to request NUMA information + requiredSystemFeatures = [ "sys-devices" ]; buildPhase = '' set -x diff --git a/test/compilers/ompss2.nix b/test/compilers/ompss2.nix index 9ce3728f..60d68f32 100644 --- a/test/compilers/ompss2.nix +++ b/test/compilers/ompss2.nix @@ -25,9 +25,10 @@ stdenv.mkDerivation rec { hardeningDisable = [ "all" ]; #NIX_DEBUG = 1; buildInputs = [ ]; #strace gdb; - # NODES requires access to /sys/devices to request NUMA information. It will - # fail to run otherwise, so we disable the sandbox for this test. - __noChroot = true; + + # NODES requires access to /sys/devices to request NUMA information + requiredSystemFeatures = [ "sys-devices" ]; + buildPhase = '' set -x #$CC -v -- 2.49.0