lol

haskellPackages: add dontCheckIf helper

Using this helper will prevent introducing problematic doCheck = condition overrides,
which accidentally re-enable previously disabled tests.

+54 -46
+5
doc/languages-frameworks/haskell.section.md
··· 1020 1020 : Sets `doCheck` to `false` for `drv`. Useful if a package has a broken, 1021 1021 flaky or otherwise problematic test suite breaking the build. 1022 1022 1023 + `dontCheckIf condition drv` 1024 + : Sets `doCheck` to `false` for `drv`, but only if `condition` applies. 1025 + Otherwise it's a no-op. Useful to conditionally disable tests for a package 1026 + without interfering with previous overrides or default values. 1027 + 1023 1028 <!-- Purposefully omitting the non-list variants here. They are a bit 1024 1029 ugly, and we may want to deprecate them at some point. --> 1025 1030
+37 -42
pkgs/development/haskell-modules/configuration-common.nix
··· 144 144 # https://github.com/lspitzner/czipwith/issues/5 145 145 czipwith = doJailbreak super.czipwith; 146 146 147 - # Deal with infinite and NaN values generated by QuickCheck-2.14.3 148 - aeson = overrideCabal (lib.optionalAttrs pkgs.stdenv.hostPlatform.is32bit { 147 + aeson = 149 148 # aeson's test suite includes some tests with big numbers that fail on 32bit 150 149 # https://github.com/haskell/aeson/issues/1060 151 - doCheck = false; 152 - }) (appendPatches [ 153 - (pkgs.fetchpatch { 154 - name = "aeson-quickcheck-2.14.3-double-workaround.patch"; 155 - url = "https://github.com/haskell/aeson/commit/58766a1916b4980792763bab74f0c86e2a7ebf20.patch"; 156 - sha256 = "1jk2xyi9g6dfjsi6hvpvkpmag3ivimipwy1izpbidf3wvc9cixs3"; 157 - }) 158 - ] super.aeson); 150 + dontCheckIf pkgs.stdenv.hostPlatform.is32bit 151 + # Deal with infinite and NaN values generated by QuickCheck-2.14.3 152 + (appendPatches [ 153 + (pkgs.fetchpatch { 154 + name = "aeson-quickcheck-2.14.3-double-workaround.patch"; 155 + url = "https://github.com/haskell/aeson/commit/58766a1916b4980792763bab74f0c86e2a7ebf20.patch"; 156 + sha256 = "1jk2xyi9g6dfjsi6hvpvkpmag3ivimipwy1izpbidf3wvc9cixs3"; 157 + }) 158 + ] super.aeson); 159 159 160 160 # Lifts bounds on hoauth2, skylighting, and json adds compat with mtl >= 2.3 161 161 gitit = appendPatches [ ··· 1318 1318 # https://github.com/mgajda/json-autotype/issues/25 1319 1319 json-autotype = dontCheck super.json-autotype; 1320 1320 1321 - # Requires pg_ctl command during tests 1322 - beam-postgres = overrideCabal (drv: { 1323 - testToolDepends = (drv.testToolDepends or []) ++ [pkgs.postgresql]; 1324 - } // lib.optionalAttrs (!pkgs.postgresql.doCheck) { 1321 + beam-postgres = lib.pipe super.beam-postgres [ 1322 + # Requires pg_ctl command during tests 1323 + (addTestToolDepends [pkgs.postgresql]) 1325 1324 # https://github.com/NixOS/nixpkgs/issues/198495 1326 - doCheck = false; 1327 - }) super.beam-postgres; 1325 + (dontCheckIf (!pkgs.postgresql.doCheck)) 1326 + ]; 1328 1327 1329 1328 # PortMidi needs an environment variable to have ALSA find its plugins: 1330 1329 # https://github.com/NixOS/nixpkgs/issues/6860 ··· 1378 1377 pkgs.postgresql 1379 1378 pkgs.postgresqlTestHook 1380 1379 ]; 1381 - } // lib.optionalAttrs (!pkgs.postgresql.doCheck) { 1382 - # https://github.com/NixOS/nixpkgs/issues/198495 1383 - doCheck = false; 1384 1380 }) 1385 - super.esqueleto; 1381 + # https://github.com/NixOS/nixpkgs/issues/198495 1382 + (dontCheckIf (!pkgs.postgresql.doCheck) super.esqueleto); 1386 1383 1387 1384 # Requires API keys to run tests 1388 1385 algolia = dontCheck super.algolia; ··· 1497 1494 pkgs.postgresql 1498 1495 pkgs.postgresqlTestHook 1499 1496 ]; 1500 - } // lib.optionalAttrs (!pkgs.postgresql.doCheck) { 1501 - # https://github.com/NixOS/nixpkgs/issues/198495 1502 - doCheck = false; 1503 1497 }) 1504 - super.persistent-postgresql; 1498 + # https://github.com/NixOS/nixpkgs/issues/198495 1499 + (dontCheckIf (!pkgs.postgresql.doCheck) super.persistent-postgresql); 1505 1500 1506 1501 # Test suite requires a later version of persistent-test which depends on persistent 2.14 1507 1502 # https://github.com/commercialhaskell/stackage/issues/6884 ··· 1662 1657 hasura-ekg-json = super.hasura-ekg-json.override { 1663 1658 ekg-core = self.hasura-ekg-core; 1664 1659 }; 1665 - pg-client = overrideCabal (drv: { 1666 - librarySystemDepends = with pkgs; [ postgresql krb5.dev openssl.dev ]; 1667 - testToolDepends = drv.testToolDepends or [] ++ [ 1668 - pkgs.postgresql pkgs.postgresqlTestHook 1660 + pg-client = lib.pipe 1661 + (super.pg-client.override { 1662 + resource-pool = self.hasura-resource-pool; 1663 + ekg-core = self.hasura-ekg-core; 1664 + }) [ 1665 + (overrideCabal (drv: { 1666 + librarySystemDepends = with pkgs; [ postgresql krb5.dev openssl.dev ]; 1667 + testToolDepends = drv.testToolDepends or [] ++ [ 1668 + pkgs.postgresql pkgs.postgresqlTestHook 1669 + ]; 1670 + preCheck = drv.preCheck or "" + '' 1671 + # empty string means use default connection 1672 + export DATABASE_URL="" 1673 + ''; 1674 + })) 1675 + # https://github.com/NixOS/nixpkgs/issues/198495 1676 + (dontCheckIf (!pkgs.postgresql.doCheck)) 1669 1677 ]; 1670 - preCheck = drv.preCheck or "" + '' 1671 - # empty string means use default connection 1672 - export DATABASE_URL="" 1673 - ''; 1674 - } // lib.optionalAttrs (!pkgs.postgresql.doCheck) { 1675 - # https://github.com/NixOS/nixpkgs/issues/198495 1676 - doCheck = false; 1677 - }) (super.pg-client.override { 1678 - resource-pool = self.hasura-resource-pool; 1679 - ekg-core = self.hasura-ekg-core; 1680 - }); 1681 1678 1682 1679 hcoord = overrideCabal (drv: { 1683 1680 # Remove when https://github.com/danfran/hcoord/pull/8 is merged. ··· 2136 2133 2137 2134 # Tests need to lookup target triple x86_64-unknown-linux 2138 2135 # https://github.com/llvm-hs/llvm-hs/issues/334 2139 - llvm-hs = overrideCabal (lib.optionalAttrs (pkgs.stdenv.targetPlatform.system != "x86_64-linux") { 2140 - doCheck = false; 2141 - }) super.llvm-hs; 2136 + llvm-hs = dontCheckIf (pkgs.stdenv.targetPlatform.system != "x86_64-linux") super.llvm-hs; 2142 2137 2143 2138 # Fix build with bytestring >= 0.11 (GHC 9.2) 2144 2139 # https://github.com/llvm-hs/llvm-hs/pull/389
+2 -4
pkgs/development/haskell-modules/configuration-nix.nix
··· 1103 1103 rel8 = pkgs.lib.pipe super.rel8 [ 1104 1104 (addTestToolDepend pkgs.postgresql) 1105 1105 # https://github.com/NixOS/nixpkgs/issues/198495 1106 - (overrideCabal (lib.optionalAttrs (!pkgs.postgresql.doCheck) { doCheck = false; })) 1106 + (dontCheckIf (!pkgs.postgresql.doCheck)) 1107 1107 ]; 1108 1108 1109 1109 # Wants running postgresql database accessible over ip, so postgresqlTestHook ··· 1178 1178 1179 1179 # Some hash implementations are x86 only, but part of the test suite. 1180 1180 # So executing and building it on non-x86 platforms will always fail. 1181 - hashes = overrideCabal (lib.optionalAttrs (!pkgs.stdenv.hostPlatform.isx86) { 1182 - doCheck = false; 1183 - }) super.hashes; 1181 + hashes = dontCheckIf (!pkgs.stdenv.hostPlatform.isx86) super.hashes; 1184 1182 1185 1183 # Tries to access network 1186 1184 aws-sns-verify = dontCheck super.aws-sns-verify;
+5
pkgs/development/haskell-modules/lib/compose.nix
··· 108 108 of test suites listed in the package description file. 109 109 */ 110 110 dontCheck = overrideCabal (drv: { doCheck = false; }); 111 + /* The dontCheckIf variant sets doCheck = false if the condition 112 + applies. In any other case the previously set/default value is used. 113 + This prevents accidentally re-enabling tests in a later override. 114 + */ 115 + dontCheckIf = condition: if condition then dontCheck else lib.id; 111 116 112 117 /* doBenchmark enables dependency checking and compilation 113 118 for benchmarks listed in the package description file.
+5
pkgs/development/haskell-modules/lib/default.nix
··· 105 105 of test suites listed in the package description file. 106 106 */ 107 107 dontCheck = compose.dontCheck; 108 + /* The dontCheckIf variant sets doCheck = false if the condition 109 + applies. In any other case the previously set/default value is used. 110 + This prevents accidentally re-enabling tests in a later override. 111 + */ 112 + dontCheckIf = drv: condition: compose.dontCheckIf condition drv; 108 113 109 114 /* doBenchmark enables dependency checking, compilation and execution 110 115 for benchmarks listed in the package description file.