about summary refs log tree commit diff
path: root/pkgs/development/haskell-modules/configuration-nix.nix
diff options
context:
space:
mode:
authorWolfgang Walther <walther@technowledgy.de>2024-02-10 15:15:56 +0100
committerWolfgang Walther <walther@technowledgy.de>2024-02-26 12:32:02 +0100
commitdf284fa43c9365e1e03b08cda09b5e3ff83e2cfc (patch)
tree66f2c2280129cde0551bdc8d76e0e6c5657639e3 /pkgs/development/haskell-modules/configuration-nix.nix
parent85ebf8847ebcfa8316b8ff21135163887c7fc481 (diff)
downloadnixlib-df284fa43c9365e1e03b08cda09b5e3ff83e2cfc.tar
nixlib-df284fa43c9365e1e03b08cda09b5e3ff83e2cfc.tar.gz
nixlib-df284fa43c9365e1e03b08cda09b5e3ff83e2cfc.tar.bz2
nixlib-df284fa43c9365e1e03b08cda09b5e3ff83e2cfc.tar.lz
nixlib-df284fa43c9365e1e03b08cda09b5e3ff83e2cfc.tar.xz
nixlib-df284fa43c9365e1e03b08cda09b5e3ff83e2cfc.tar.zst
nixlib-df284fa43c9365e1e03b08cda09b5e3ff83e2cfc.zip
haskellPackages: avoid re-enabling previously disabled tests
The intent of all doCheck = <condition>, where condition is possibly true, is to disable
the tests in a specific case. However, as currently written, this also has the effect of
re-enabling the tests, even if they have been disabled by an override before, e.g. to
mkDerivation.

This also affects the default value given in mkDerivation, which is !isCross. Before this
change, aeson for example, would have been built with tests when cross-compiling, which
was not intended.

The proper way is to set the doCheck = false attribute only conditionally, and otherwise
rely on a previous override or the default value given in mkDerivation.
Diffstat (limited to 'pkgs/development/haskell-modules/configuration-nix.nix')
-rw-r--r--pkgs/development/haskell-modules/configuration-nix.nix9
1 files changed, 4 insertions, 5 deletions
diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix
index 44780fe5e5db..8d976685e57a 100644
--- a/pkgs/development/haskell-modules/configuration-nix.nix
+++ b/pkgs/development/haskell-modules/configuration-nix.nix
@@ -1103,7 +1103,7 @@ self: super: builtins.intersectAttrs super {
   rel8 = pkgs.lib.pipe super.rel8 [
     (addTestToolDepend pkgs.postgresql)
     # https://github.com/NixOS/nixpkgs/issues/198495
-    (overrideCabal { doCheck = pkgs.postgresql.doCheck; })
+    (overrideCabal (lib.optionalAttrs (!pkgs.postgresql.doCheck) { doCheck = false; }))
   ];
 
   # Wants running postgresql database accessible over ip, so postgresqlTestHook
@@ -1178,10 +1178,9 @@ self: super: builtins.intersectAttrs super {
 
   # Some hash implementations are x86 only, but part of the test suite.
   # So executing and building it on non-x86 platforms will always fail.
-  hashes = overrideCabal {
-    doCheck = with pkgs.stdenv; hostPlatform == buildPlatform
-      && buildPlatform.isx86;
-  } super.hashes;
+  hashes = overrideCabal (lib.optionalAttrs (!pkgs.stdenv.hostPlatform.isx86) {
+    doCheck = false;
+  }) super.hashes;
 
   # Tries to access network
   aws-sns-verify = dontCheck super.aws-sns-verify;