From 9067423950df8dcc4a73ef2666d25ae269963cc5 Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Fri, 5 Dec 2025 05:04:38 +0000 Subject: [PATCH] haskellPackages: support cross tests in checkPhase --- pkgs/development/haskell-modules/generic-builder.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 0d488ed48ef21..6a017777fe371 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -580,6 +580,12 @@ let shouldSymlink = shouldAdd && doInstallIntermediates; }; + testRunner = + "exec" + + lib.optionalString isCross ( + " " + (if stdenv.hostPlatform.isGhcjs then "node" else crossSupport.emulator) + ); + # This is a script suitable for --test-wrapper of Setup.hs' test command # (https://cabal.readthedocs.io/en/3.12/setup-commands.html#cmdoption-runhaskell-Setup.hs-test-test-wrapper). # We use it to set some environment variables that the test suite may need, @@ -602,7 +608,7 @@ let export GHC_PACKAGE_PATH="''${NIX_GHC_PACKAGE_PATH_FOR_TEST}" fi - exec "$@" + ${testRunner} "$@" ''; testTargetsString =