From 255012c708de45390ac5bb8d15122bb5cd58b63a Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Mon, 25 Nov 2024 22:58:33 +0100 Subject: [PATCH] nixosTests.etc: fix with structuredAttrs The NIX_ATTRS_SH_FILE needs to be available visible inside the fakechroot environment, so that we can load it for structuredAttrs support. --- nixos/modules/system/etc/test.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nixos/modules/system/etc/test.nix b/nixos/modules/system/etc/test.nix index 5e43b155038d9..af2cf5af85c45 100644 --- a/nixos/modules/system/etc/test.nix +++ b/nixos/modules/system/etc/test.nix @@ -64,7 +64,14 @@ lib.recurseIntoAttrs { } '' mkdir fake-root export FAKECHROOT_EXCLUDE_PATH=/dev:/proc:/sys:${builtins.storeDir}:$out - fakechroot fakeroot chroot $PWD/fake-root bash -c 'source $stdenv/setup; eval "$fakeRootCommands"' + if [ -e "$NIX_ATTRS_SH_FILE" ]; then + export FAKECHROOT_EXCLUDE_PATH=$FAKECHROOT_EXCLUDE_PATH:$NIX_ATTRS_SH_FILE + fi + fakechroot fakeroot chroot $PWD/fake-root bash -e -c ' + if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; fi + source $stdenv/setup + eval "$fakeRootCommands" + ' ''; }