about summary refs log tree commit diff
path: root/pkgs/development/haskell-modules/lib
diff options
context:
space:
mode:
authorWolfgang Walther <walther@technowledgy.de>2024-02-10 15:42:35 +0100
committerWolfgang Walther <walther@technowledgy.de>2024-02-26 12:32:02 +0100
commit72e03b91eaa7b2e631e6f642efdb538a5bcb29fa (patch)
treef96db0933ef903533f01861ddb8a2622514557a3 /pkgs/development/haskell-modules/lib
parentdf284fa43c9365e1e03b08cda09b5e3ff83e2cfc (diff)
haskellPackages: add dontCheckIf helper
Using this helper will prevent introducing problematic doCheck = condition overrides,
which accidentally re-enable previously disabled tests.
Diffstat (limited to 'pkgs/development/haskell-modules/lib')
-rw-r--r--pkgs/development/haskell-modules/lib/compose.nix5
-rw-r--r--pkgs/development/haskell-modules/lib/default.nix5
2 files changed, 10 insertions, 0 deletions
diff --git a/pkgs/development/haskell-modules/lib/compose.nix b/pkgs/development/haskell-modules/lib/compose.nix
index 40195ac7a801f..09cee08b91c1f 100644
--- a/pkgs/development/haskell-modules/lib/compose.nix
+++ b/pkgs/development/haskell-modules/lib/compose.nix
@@ -108,6 +108,11 @@ rec {
      of test suites listed in the package description file.
    */
   dontCheck = overrideCabal (drv: { doCheck = false; });
+  /* The dontCheckIf variant sets doCheck = false if the condition
+     applies. In any other case the previously set/default value is used.
+     This prevents accidentally re-enabling tests in a later override.
+     */
+  dontCheckIf = condition: if condition then dontCheck else lib.id;
 
   /* doBenchmark enables dependency checking and compilation
      for benchmarks listed in the package description file.
diff --git a/pkgs/development/haskell-modules/lib/default.nix b/pkgs/development/haskell-modules/lib/default.nix
index ffd9ac0578906..2bcd8f25d1146 100644
--- a/pkgs/development/haskell-modules/lib/default.nix
+++ b/pkgs/development/haskell-modules/lib/default.nix
@@ -105,6 +105,11 @@ rec {
      of test suites listed in the package description file.
    */
   dontCheck = compose.dontCheck;
+  /* The dontCheckIf variant sets doCheck = false if the condition
+     applies. In any other case the previously set/default value is used.
+     This prevents accidentally re-enabling tests in a later override.
+   */
+  dontCheckIf = drv: condition: compose.dontCheckIf condition drv;
 
   /* doBenchmark enables dependency checking, compilation and execution
      for benchmarks listed in the package description file.