diff options
author | Robert Hensing <robert@roberthensing.nl> | 2021-10-31 18:22:25 +0100 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2021-10-31 18:25:19 +0100 |
commit | 56c4f9d0052c60aba6b2b8a8a7976cc3f808000d (patch) | |
tree | 8c37c1ef9cf33e11c7832fe9ca6adcbdf1492d30 /nixos/lib/testing-python.nix | |
parent | 67e9f0551f9a5f53bc80d4abb2f9cbfcaacc3b81 (diff) |
nixosTest: Fix infinite recursion involving hasContext testScript when useNixStoreImage = true
The involved test was nixosTests.nextcloud.basic21. It has a testScript that is strict in nodes.nextcloud.config.system.build.vm, in assertions about imagemagick being in the system closure. The recursion was introduced in 329a4461a7a1898b3aad13968a232a054422c4fb from https://github.com/NixOS/nixpkgs/pull/140792
Diffstat (limited to 'nixos/lib/testing-python.nix')
-rw-r--r-- | nixos/lib/testing-python.nix | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/nixos/lib/testing-python.nix b/nixos/lib/testing-python.nix index b1e9bed4a5c11..cce017a6441db 100644 --- a/nixos/lib/testing-python.nix +++ b/nixos/lib/testing-python.nix @@ -218,6 +218,7 @@ rec { build-vms = import ./build-vms.nix { inherit system lib pkgs minimal specialArgs; extraConfigurations = extraConfigurations ++ [( + { config, ... }: { virtualisation.qemu.package = qemu_pkg; @@ -230,7 +231,17 @@ rec { # copied to the image. virtualisation.additionalPaths = lib.optional - (builtins.hasContext testScript') + # A testScript may evaluate nodes, which has caused + # infinite recursions. The demand cycle involves: + # testScript --> + # nodes --> + # toplevel --> + # additionalPaths --> + # hasContext testScript' --> + # testScript (ad infinitum) + # If we don't need to build an image, we can break this + # cycle by short-circuiting when useNixStoreImage is false. + (config.virtualisation.useNixStoreImage && builtins.hasContext testScript') (pkgs.writeStringReferencesToFile testScript'); # Ensure we do not use aliases. Ideally this is only set |