diff --git a/maintainers/scripts/haskell/test-configurations.nix b/maintainers/scripts/haskell/test-configurations.nix new file mode 100644 index 000000000000..12287896b50d --- /dev/null +++ b/maintainers/scripts/haskell/test-configurations.nix @@ -0,0 +1,136 @@ +/* Nix expression to test for regressions in the Haskell configuration overlays. + + test-configurations.nix determines all attributes touched by given Haskell + configuration overlays (i. e. pkgs/development/haskell-modules/configuration-*.nix) + and builds all derivations (or at least a reasonable subset) affected by + these overrides. + + By default, it checks `configuration-{common,nix,ghc-8.10.x}.nix`. You can + invoke it like this: + + nix-build maintainers/scripts/haskell/test-configurations.nix --keep-going + + It is possible to specify other configurations: + + nix-build maintainers/scripts/haskell/test-configurations.nix \ + --arg files '[ "configuration-ghc-9.0.x.nix" "configuration-ghc-9.2.x.nix" ]' \ + --keep-going + + You can also just supply a single string: + + nix-build maintainers/scripts/haskell/test-configurations.nix \ + --argstr files "configuration-arm.nix" --keep-going + + You can even supply full paths which is handy, as it allows for tab-completing + the configurations: + + nix-build maintainers/scripts/haskell/test-configurations.nix \ + --argstr files pkgs/development/haskell-modules/configuration-arm.nix \ + --keep-going + + By default, derivation that fail to evaluate are skipped, unless they are + “just” marked as broken. You can check for other eval errors like this: + + nix-build maintainers/scripts/haskell/test-configurations.nix \ + --arg skipEvalErrors false --keep-going + + You can also disable checking broken packages by passing a nixpkgs config: + + nix-build maintainers/scripts/haskell/test-configurations.nix \ + --arg config '{ allowBroken = false; }' --keep-going + + By default the haskell.packages.ghc*Binary sets used for bootstrapping GHC + are _not_ tested. You can change this using: + + nix-build maintainers/scripts/haskell/test-configurations.nix \ + --arg skipBinaryGHCs false --keep-going + +*/ +{ files ? [ + "configuration-common.nix" + "configuration-nix.nix" + "configuration-ghc-8.10.x.nix" + ] +, nixpkgsPath ? ../../.. +, config ? { allowBroken = true; } +, skipEvalErrors ? true +, skipBinaryGHCs ? true +}: + +let + pkgs = import nixpkgsPath { inherit config; }; + inherit (pkgs) lib; + + # see usage explanation for the input format `files` allows + files' = builtins.map builtins.baseNameOf ( + if !builtins.isList files then [ files ] else files + ); + + setsForFile = fileName: + let + # extract the unique part of the config's file name + configName = builtins.head ( + builtins.match "configuration-(.+).nix" fileName + ); + # match the major and minor version of the GHC the config is intended for, if any + configVersion = lib.concatStrings ( + builtins.match "ghc-([0-9]+).([0-9]+).x" configName + ); + # return all package sets under haskell.packages matching the version components + setsForVersion = builtins.map (name: pkgs.haskell.packages.${name}) ( + builtins.filter (setName: + lib.hasPrefix "ghc${configVersion}" setName + && (skipBinaryGHCs -> !(lib.hasInfix "Binary" setName)) + ) ( + builtins.attrNames pkgs.haskell.packages + ) + ); + + defaultSets = [ pkgs.haskellPackages ]; + in { + # use plain haskellPackages for the version-agnostic files + # TODO(@sternenseemann): also consider currently selected versioned sets + "common" = defaultSets; + "nix" = defaultSets; + "arm" = defaultSets; + "darwin" = defaultSets; + }.${configName} or setsForVersion; + + # attribute set that has all the attributes of haskellPackages set to null + availableHaskellPackages = builtins.listToAttrs ( + builtins.map (attr: lib.nameValuePair attr null) ( + builtins.attrNames pkgs.haskellPackages + ) + ); + + # evaluate a configuration and only return the attributes changed by it, + # pass availableHaskellPackages as super in case intersectAttrs is used + overriddenAttrs = fileName: builtins.attrNames ( + lib.fix (self: + import (nixpkgsPath + "/pkgs/development/haskell-modules/${fileName}") { + haskellLib = pkgs.haskell.lib.compose; + inherit pkgs; + } self availableHaskellPackages + ) + ); + + # list of derivations that are affected by overrides in the given configuration + # overlays. For common, nix, darwin etc. only the derivation from the default + # package set will be emitted. + packages = builtins.filter (v: + lib.warnIf (v.meta.broken or false) "${v.pname} is marked as broken" ( + v != null + && (skipEvalErrors -> (builtins.tryEval (v.outPath or v)).success) + ) + ) ( + lib.concatMap (fileName: + let + sets = setsForFile fileName; + attrs = overriddenAttrs fileName; + in + lib.concatMap (set: builtins.map (attr: set.${attr}) attrs) sets + ) files' + ); +in + +packages diff --git a/pkgs/data/misc/hackage/pin.json b/pkgs/data/misc/hackage/pin.json index 9efdd76ce234..b5d5b4f42902 100644 --- a/pkgs/data/misc/hackage/pin.json +++ b/pkgs/data/misc/hackage/pin.json @@ -1,6 +1,6 @@ { - "commit": "5b1efa929ec68b76f8e84df53bf48b6e4a392feb", - "url": "https://github.com/commercialhaskell/all-cabal-hashes/archive/5b1efa929ec68b76f8e84df53bf48b6e4a392feb.tar.gz", - "sha256": "1azja4gm6yy8zs0fjfiscjamfn13w4wp9wwadqhzhv0dmisg9y8v", - "msg": "Update from Hackage at 2021-12-08T21:36:39Z" + "commit": "45e72928a9053df2938492a535a1b4351251d82f", + "url": "https://github.com/commercialhaskell/all-cabal-hashes/archive/45e72928a9053df2938492a535a1b4351251d82f.tar.gz", + "sha256": "1a87yf9bly5ayldgrkakyipxfkk7h9ifqb4dpd8l1f9zb1csdg1x", + "msg": "Update from Hackage at 2021-12-09T20:50:23Z" } diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index b99e50a934de..4ad099ff93a2 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -54,6 +54,16 @@ self: super: { ghc-datasize = disableLibraryProfiling super.ghc-datasize; ghc-vis = disableLibraryProfiling super.ghc-vis; + # `pinch`s test suite uses a function called `openSocket` that's available + # in `network` versions 3.1.2.0 and bigger. + # There's an open PR updating the lower bound for `network`: + # > https://github.com/abhinav/pinch/pull/46 + # With that said version tracked for `network` right now is 3.1.1.1 so we're + # replacing the network pinch uses with `network_3_1_2_5` for now. + pinch = super.pinch.overrideScope (self : super: { + network = self.network_3_1_2_5; + }); + # We can remove this once fakedata version gets to 1.0.1 as the test suite # works fine there. fakedata = dontCheck super.fakedata; @@ -967,6 +977,13 @@ self: super: { # dontCheck: use of non-standard strptime "%s" which musl doesn't support; only used in test unix-time = if pkgs.stdenv.hostPlatform.isMusl then dontCheck super.unix-time else super.unix-time; + # hslua has tests that appear to break when using musl. + # https://github.com/hslua/hslua/issues/106 + # Note that hslua is currently version 1.3. However, in the latest version + # (>= 2.0), hslua has been split into multiple packages and this override + # will likely need to be moved to the hslua-core package. + hslua = if pkgs.stdenv.hostPlatform.isMusl then dontCheck super.hslua else super.hslua; + # The test suite runs for 20+ minutes on a very fast machine, which feels kinda disproportionate. prettyprinter = dontCheck super.prettyprinter; brittany = doJailbreak (dontCheck super.brittany); # Outdated upperbound on ghc-exactprint: https://github.com/lspitzner/brittany/issues/342 @@ -1349,21 +1366,21 @@ self: super: { resource-pool = self.hasura-resource-pool; ekg-core = self.hasura-ekg-core; ekg-json = self.hasura-ekg-json; - hspec = dontCheck self.hspec_2_9_3; - hspec-core = dontCheck self.hspec-core_2_9_3; - hspec-discover = dontCheck super.hspec-discover_2_9_3; + hspec = dontCheck self.hspec_2_9_4; + hspec-core = dontCheck self.hspec-core_2_9_4; + hspec-discover = dontCheck super.hspec-discover_2_9_4; tasty-hspec = self.tasty-hspec_1_2; })); hasura-ekg-core = doJailbreak (super.hasura-ekg-core.overrideScope (self: super: { - hspec = dontCheck self.hspec_2_9_3; - hspec-core = dontCheck self.hspec-core_2_9_3; - hspec-discover = dontCheck super.hspec-discover_2_9_3; + hspec = dontCheck self.hspec_2_9_4; + hspec-core = dontCheck self.hspec-core_2_9_4; + hspec-discover = dontCheck super.hspec-discover_2_9_4; })); hasura-ekg-json = super.hasura-ekg-json.overrideScope (self: super: { ekg-core = self.hasura-ekg-core; - hspec = dontCheck self.hspec_2_9_3; - hspec-core = dontCheck self.hspec-core_2_9_3; - hspec-discover = dontCheck super.hspec-discover_2_9_3; + hspec = dontCheck self.hspec_2_9_4; + hspec-core = dontCheck self.hspec-core_2_9_4; + hspec-discover = dontCheck super.hspec-discover_2_9_4; }); pg-client = overrideCabal (drv: { librarySystemDepends = with pkgs; [ postgresql krb5.dev openssl.dev ]; @@ -1695,12 +1712,16 @@ self: super: { # Issue reported upstream, no bug tracker url yet. darcs = doJailbreak super.darcs; - # Too strict version bounds on base16-bytestring and http-link-header. - # This patch will be merged when next release comes. - github = appendPatch (pkgs.fetchpatch { - url = "https://github.com/phadej/github/commit/514b175851dd7c4a9722ff203dd6f652a15d33e8.patch"; - sha256 = "0pmx54xd7ah85y9mfi5366wbnwrp918j0wbx8yw8hrdac92qi4gh"; - }) super.github; + nix-thunk = appendPatches [ + (pkgs.fetchpatch { + url = "https://github.com/obsidiansystems/nix-thunk/commit/49d27a85dd39cd9413c99958c67e596756a502b5.patch"; + sha256 = "1p1n0123yrbdqyfk4kx3gq6bdv65l1bxgbsg51ckcwclg54xp2p5"; + }) + (pkgs.fetchpatch { + url = "https://github.com/obsidiansystems/nix-thunk/commit/512867c651977265d5d8f456b538f7a364ec8a8b.patch"; + sha256 = "121yg26y4g28k8xv7y1j6c3pxm17vsjn3vi62kkc8g928c47yd02"; + }) + ] super.nix-thunk; # list `modbus` in librarySystemDepends, correct to `libmodbus` libmodbus = overrideCabal (drv: { @@ -1866,27 +1887,22 @@ self: super: { # Build haskell-ci from git repository, including some useful fixes, # e. g. required for generating the workflows for the cabal2nix repository - haskell-ci-unstable = (overrideSrc { - version = "0.13.20211011"; + haskell-ci-unstable = (overrideSrc rec { + version = "0.13.20211116-${builtins.substring 0 7 src.rev}"; src = pkgs.fetchFromGitHub { owner = "haskell-CI"; repo = "haskell-ci"; - rev = "c88e67e675bc4a990da53863c7fb42e67bcf9847"; - sha256 = "1zhv1cg047lfyxfs3mvc73vv96pn240zaj7f2yl4lw5yj6y5rfk9"; + rev = "b61df11e7f6010ce09920c231321ab1545a990b5"; + sha256 = "0v6mqpavz5v161milq6a3x9gzap0pgksd3h4rwi2s3f9b15sczcy"; }; } super.haskell-ci).overrideScope (self: super: { - attoparsec = self.attoparsec_0_14_2; + attoparsec = self.attoparsec_0_14_3; Cabal = self.Cabal_3_6_2_0; }); - Frames-streamly = overrideCabal (drv: { - # https://github.com/adamConnerSax/Frames-streamly/issues/1 - patchPhase = '' -cat > example_data/acs100k.csv <