Unverified Commit c029b7f0 authored by Naïm Favier's avatar Naïm Favier Committed by GitHub
Browse files

Merge pull request #307204 from NixOS/haskell-updates

haskellPackages: update stackage and hackage
parents 1cc90fe9 54b7ab5b
Loading
Loading
Loading
Loading
+65 −7
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ completely incompatible with packages from `haskellPackages`.

Every haskell package set has its own haskell-aware `mkDerivation` which is used
to build its packages. Generally you won't have to interact with this builder
since [cabal2nix][cabal2nix] can generate packages
since [cabal2nix](#haskell-cabal2nix) can generate packages
using it for an arbitrary cabal package definition. Still it is useful to know
the parameters it takes when you need to
[override](#haskell-overriding-haskell-packages) a generated Nix expression.
@@ -1123,17 +1123,74 @@ for [this to work][optparse-applicative-completions].
Note that this feature is automatically disabled when cross-compiling, since it
requires executing the binaries in question.

## Import-from-Derivation helpers {#haskell-import-from-derivation}

### cabal2nix {#haskell-cabal2nix}

[`cabal2nix`][cabal2nix] can generate Nix package definitions for arbitrary
Haskell packages using [import from derivation][import-from-derivation].
`cabal2nix` will generate Nix expressions that look like this:

```nix
# cabal get mtl-2.2.1 && cd mtl-2.2.1 && cabal2nix .
{ mkDerivation, base, lib, transformers }:
mkDerivation {
  pname = "mtl";
  version = "2.2.1";
  src = ./.;
  libraryHaskellDepends = [ base transformers ];
  homepage = "http://github.com/ekmett/mtl";
  description = "Monad classes, using functional dependencies";
  license = lib.licenses.bsd3;
}
```

This expression should be called with `haskellPackages.callPackage`, which will
supply [`haskellPackages.mkDerivation`](#haskell-mkderivation) and the Haskell
dependencies as arguments.

`callCabal2nix name src args`
: Create a package named `name` from the source derivation `src` using
  `cabal2nix`.

  `args` are extra arguments provided to `haskellPackages.callPackage`.

`callCabal2nixWithOptions name src opts args`
: Create a package named `name` from the source derivation `src` using
  `cabal2nix`.

  `opts` are extra options for calling `cabal2nix`. If `opts` is a string, it
  will be used as extra command line arguments for `cabal2nix`, e.g. `--subpath
  path/to/dir/containing/cabal-file`. Otherwise, `opts` should be an AttrSet
  which can contain the following attributes:

  `extraCabal2nixOptions`
  : Extra command line arguments for `cabal2nix`.

  `srcModifier`
  : A function which is used to modify the given `src` instead of the default
    filter.

    The default source filter will remove all files from `src` except for
    `.cabal` files and `package.yaml` files.

<!--

TODO(@NixOS/haskell): finish these planned sections
### Overriding the entire package set
`callHackage`
: TODO

`callHackageDirect`
: TODO

## Import-from-Derivation helpers
`developPackage`
: TODO

* `callCabal2nix`
* `callHackage`, `callHackageDirect`
* `developPackage`
-->

<!--

TODO(@NixOS/haskell): finish these planned sections
### Overriding the entire package set

## Contributing {#haskell-contributing}

@@ -1309,3 +1366,4 @@ relevant.
[profiling]: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/profiling.html
[search.nixos.org]: https://search.nixos.org
[turtle]: https://hackage.haskell.org/package/turtle
[import-from-derivation]: https://nixos.org/manual/nix/stable/language/import-from-derivation
+4 −4
Original line number Diff line number Diff line
{
  "commit": "4eb9a5fde06b5d7343665582243debaf1d77e0a9",
  "url": "https://github.com/commercialhaskell/all-cabal-hashes/archive/4eb9a5fde06b5d7343665582243debaf1d77e0a9.tar.gz",
  "sha256": "0dzyfr1gv79riy2vh840b5hqly8rs10zhj01zi9nfn7jd9pzql28",
  "msg": "Update from Hackage at 2024-04-16T17:36:35Z"
  "commit": "9e419b038d7108160caf4efc41ebd5dfc4d51821",
  "url": "https://github.com/commercialhaskell/all-cabal-hashes/archive/9e419b038d7108160caf4efc41ebd5dfc4d51821.tar.gz",
  "sha256": "1vqsxznsq6s1hfb3b7ghs0fqa1rapqccjcz5jy3h9w3dq4v3gfqz",
  "msg": "Update from Hackage at 2024-04-27T10:57:54Z"
}
+4 −0
Original line number Diff line number Diff line
import ./common-hadrian.nix rec {
  version = "9.10.1";
  sha256 = "bf386a302d4ee054791ffd51748900f15d71760fd199157922d120cc1f89e2f7";
}
+49 −28
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
, xattr
, autoSignDarwinBinariesHook
, bash
, srcOnly

, libiconv ? null, ncurses
, glibcLocales ? null
@@ -145,25 +146,60 @@
        return $ verbosity >= Verbose
  ''

, ghcSrc ? (if rev != null then fetchgit else fetchurl) ({
, ghcSrc ?
    srcOnly {
      name = "ghc-${version}"; # -source appended by srcOnly
      src =
        (if rev != null then fetchgit else fetchurl) ({
          inherit url sha256;
        } // lib.optionalAttrs (rev != null) {
          inherit rev;
        } // lib.optionalAttrs (postFetch != null) {
          inherit postFetch;
  })
        });

      patches =
        let
          # Disable haddock generating pretty source listings to stay under 3GB on aarch64-linux
          enableHyperlinkedSource =
            lib.versionAtLeast version "9.8" ||
            !(stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isLinux);
        in
        [
          # Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
          (if lib.versionAtLeast version "9.8"
           then ./docs-sphinx-7-ghc98.patch
           else ./docs-sphinx-7.patch )
        ]
        ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
          # Prevent the paths module from emitting symbols that we don't use
          # when building with separate outputs.
          #
          # These cause problems as they're not eliminated by GHC's dead code
          # elimination on aarch64-darwin. (see
          # https://github.com/NixOS/nixpkgs/issues/140774 for details).
          ./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
        ]
        # Prevents passing --hyperlinked-source to haddock. This is a custom
        # workaround as we wait for this to be configurable via userSettings or
        # similar. https://gitlab.haskell.org/ghc/ghc/-/issues/23625
        ++ lib.optionals (!enableHyperlinkedSource) [
          # TODO(@sternenseemann): Doesn't apply for GHC >= 9.8
          ../../tools/haskell/hadrian/disable-hyperlinked-source.patch
        ]
        # Incorrect bounds on Cabal in hadrian
        # https://gitlab.haskell.org/ghc/ghc/-/issues/24100
        ++ lib.optionals (lib.elem version [ "9.8.1" "9.8.2" ]) [
          ../../tools/haskell/hadrian/hadrian-9.8.1-allow-Cabal-3.10.patch
        ];
    }

  # GHC's build system hadrian built from the GHC-to-build's source tree
  # using our bootstrap GHC.
, hadrian ? import ../../tools/haskell/hadrian/make-hadrian.nix { inherit bootPkgs lib; } {
    ghcSrc = ghcSrc;
    inherit ghcSrc;
    ghcVersion = version;
    userSettings = hadrianUserSettings;
    # Disable haddock generating pretty source listings to stay under 3GB on aarch64-linux
    enableHyperlinkedSource =
      # TODO(@sternenseemann): Disabling currently doesn't work with GHC >= 9.8
      lib.versionAtLeast version "9.8" ||
      !(stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isLinux);
  }

, #  Whether to build sphinx documentation.
@@ -269,21 +305,6 @@ stdenv.mkDerivation ({

  enableParallelBuilding = true;

  patches = [
    # Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
    (if lib.versionAtLeast version "9.8"
      then ./docs-sphinx-7-ghc98.patch
      else ./docs-sphinx-7.patch )
  ] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
    # Prevent the paths module from emitting symbols that we don't use
    # when building with separate outputs.
    #
    # These cause problems as they're not eliminated by GHC's dead code
    # elimination on aarch64-darwin. (see
    # https://github.com/NixOS/nixpkgs/issues/140774 for details).
    ./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
  ];

  postPatch = ''
    patchShebangs --build .
  '';
+103 −43
Original line number Diff line number Diff line
@@ -732,7 +732,6 @@ self: super: {
  Rlang-QQ = dontCheck super.Rlang-QQ;
  safecopy = dontCheck super.safecopy;
  sai-shape-syb = dontCheck super.sai-shape-syb;
  saltine = dontCheck super.saltine; # https://github.com/tel/saltine/pull/56
  scp-streams = dontCheck super.scp-streams;
  sdl2 = dontCheck super.sdl2; # the test suite needs an x server
  separated = dontCheck super.separated;
@@ -752,6 +751,7 @@ self: super: {
  translatable-intset = dontCheck super.translatable-intset;
  ua-parser = dontCheck super.ua-parser;
  unagi-chan = dontCheck super.unagi-chan;
  universe-some = dontCheck super.universe-some;
  wai-logger = dontCheck super.wai-logger;
  WebBits = dontCheck super.WebBits;                    # http://hydra.cryp.to/build/499604/log/raw
  webdriver = dontCheck super.webdriver;
@@ -1304,9 +1304,6 @@ self: super: {
  # https://github.com/haskell/hoopl/issues/50
  hoopl = dontCheck super.hoopl;

  # Generate shell completion for spago
  spago = self.generateOptparseApplicativeCompletions [ "spago" ] super.spago;

  # https://github.com/DanielG/cabal-helper/pull/123
  cabal-helper = doJailbreak super.cabal-helper;

@@ -1345,11 +1342,21 @@ self: super: {
    (dontCheckIf (!pkgs.postgresql.doCheck))
  ];

  # Requires pqueue <1.5 but it works fine with pqueue-1.5.0.0
  # https://github.com/haskell-beam/beam/pull/705
  beam-migrate = doJailbreak super.beam-migrate;

  users-postgresql-simple = addTestToolDepends [
    pkgs.postgresql
    pkgs.postgresqlTestHook
  ] super.users-postgresql-simple;

  # Need https://github.com/obsidiansystems/gargoyle/pull/45
  gargoyle = doJailbreak super.gargoyle;
  gargoyle-postgresql = doJailbreak super.gargoyle-postgresql;
  gargoyle-postgresql-nix = doJailbreak (addBuildTool [pkgs.postgresql] super.gargoyle-postgresql-nix);
  gargoyle-postgresql-connect = doJailbreak super.gargoyle-postgresql-connect;

  # PortMidi needs an environment variable to have ALSA find its plugins:
  # https://github.com/NixOS/nixpkgs/issues/6860
  PortMidi = overrideCabal (drv: {
@@ -1379,8 +1386,6 @@ self: super: {
  # Fix build with attr-2.4.48 (see #53716)
  xattr = appendPatch ./patches/xattr-fix-build.patch super.xattr;

  patch = dontCheck super.patch;

  esqueleto =
    overrideCabal
      (drv: {
@@ -1530,11 +1535,6 @@ self: super: {
  # 2021-12-26: Too strict bounds on doctest
  polysemy-plugin = doJailbreak super.polysemy-plugin;

  # hasn’t bumped upper bounds
  # upstream: https://github.com/obsidiansystems/which/pull/6
  which = doJailbreak super.which;


  # 2024-02-28: The Hackage version dhall-lsp-server-1.1.3 requires
  # lsp-1.4.0.0 which is hard to build with this LTS. However, the latest
  # git version of dhall-lsp-server works with lsp-2.1.0.0, and only
@@ -1561,13 +1561,11 @@ self: super: {
      doJailbreak
    ];

  # 2022-03-16: lens bound can be loosened https://github.com/ghcjs/jsaddle-dom/issues/19
  jsaddle-dom = overrideCabal (old: {
    postPatch = old.postPatch or "" + ''
      sed -i 's/lens.*4.20/lens/' jsaddle-dom.cabal
      rm Setup.hs
    '';
  }) (doJailbreak super.jsaddle-dom);
  }) super.jsaddle-dom;
  jsaddle-hello = doJailbreak super.jsaddle-hello;
  ghcjs-dom-hello = doJailbreak super.ghcjs-dom-hello;

@@ -1833,9 +1831,6 @@ self: super: {
  # https://github.com/adnelson/semver-range/issues/15
  semver-range = dontCheck super.semver-range;

  # https://github.com/obsidiansystems/dependent-sum/issues/55
  dependent-sum = doJailbreak super.dependent-sum;

  # 2022-06-19: Disable checks because of https://github.com/reflex-frp/reflex/issues/475
  reflex = doJailbreak (dontCheck super.reflex);

@@ -2063,18 +2058,31 @@ self: super: {
  # Issue reported upstream, no bug tracker url yet.
  darcs = doJailbreak super.darcs;

  # Too strict version bounds on cryptonite and github.
  # PRs are merged, will be fixed next release or Hackage revision.
  nix-thunk = appendPatches [
    (fetchpatch {
      url = "https://github.com/obsidiansystems/nix-thunk/commit/49d27a85dd39cd9413c99958c67e596756a502b5.patch";
      sha256 = "1p1n0123yrbdqyfk4kx3gq6bdv65l1bxgbsg51ckcwclg54xp2p5";
    })
    (fetchpatch {
      url = "https://github.com/obsidiansystems/nix-thunk/commit/512867c651977265d5d8f456b538f7a364ec8a8b.patch";
      sha256 = "121yg26y4g28k8xv7y1j6c3pxm17vsjn3vi62kkc8g928c47yd02";
    })
  ] super.nix-thunk;
  # Need https://github.com/obsidiansystems/cli-extras/pull/12 and more
  cli-extras = doJailbreak super.cli-extras;

  # https://github.com/obsidiansystems/cli-git/pull/7 turned into a flat patch
  cli-git = lib.pipe super.cli-git [
    (appendPatch (fetchpatch {
      url = "https://github.com/obsidiansystems/cli-git/commit/be378a97e2f46522174231b77c952f759df3fad6.patch";
      sha256 = "sha256-6RrhqkKpnb+FTHxccHNx6pdC7ClfqcJ2eoo+W7h+JUo=";
      excludes = [ ".github/**" ];
    }))
    doJailbreak
    (addBuildTool pkgs.git)
  ];

  # Need https://github.com/obsidiansystems/cli-nix/pull/5 and more
  cli-nix = addBuildTools [
    pkgs.nix
    pkgs.nix-prefetch-git
  ] (doJailbreak super.cli-nix);

  # https://github.com/obsidiansystems/nix-thunk/pull/51/
  nix-thunk = appendPatch (fetchpatch {
    url = "https://github.com/obsidiansystems/nix-thunk/commit/c3dc3e799e8ce7756330f98b9f73f59c4b7a5502.patch";
    sha256 = "sha256-C1ii1FXiCPFfw5NzyQZ0cEG6kIYGohVsnHycpYEJ24Q=";
  }) (doJailbreak super.nix-thunk);

  # list `modbus` in librarySystemDepends, correct to `libmodbus`
  libmodbus = doJailbreak (addExtraLibrary pkgs.libmodbus super.libmodbus);
@@ -2087,9 +2095,14 @@ self: super: {

  ginger = doJailbreak super.ginger;

  # Too strict version bounds on cryptonite
  # https://github.com/obsidiansystems/haveibeenpwned/issues/7
  haveibeenpwned = doJailbreak super.haveibeenpwned;
  # 2024-05-05 syntax changes: https://github.com/obsidiansystems/haveibeenpwned/pull/9
  haveibeenpwned = appendPatch
    (fetchpatch {
      url = "https://github.com/obsidiansystems/haveibeenpwned/pull/9/commits/14c134eec7de12f755b2d4667727762a8a1a6476.patch";
      sha256 = "sha256-fau5+b6tufJ+MscrLgbYvvBsekPe8R6QAy/4H31dcQ4";
    })
    (doJailbreak super.haveibeenpwned);


  # Too strict version bounds on ghc-events
  # https://github.com/mpickering/hs-speedscope/issues/16
@@ -2172,11 +2185,6 @@ self: super: {
            compiler: ${self.ghc.haskellCompilerName}

            core-packages:
              # Hack: The following package is a core package of GHCJS. If we don't declare
              # it, then hackage2nix will generate a Hackage database where all dependants
              # of this library are marked as "broken".
              - ghcjs-base-0

            EOF

            ghc-pkg list \
@@ -2599,8 +2607,30 @@ self: super: {
  # 2022-03-16: Upstream stopped updating bounds https://github.com/haskell-hvr/base-noprelude/pull/15
  base-noprelude = doJailbreak super.base-noprelude;

  # 2022-03-16: Bounds need to be loosened https://github.com/obsidiansystems/dependent-sum-aeson-orphans/issues/10
  dependent-sum-aeson-orphans = doJailbreak super.dependent-sum-aeson-orphans;
  # 2025-05-05: Bounds need to be loosened https://github.com/obsidiansystems/dependent-sum-aeson-orphans/pull/13
  dependent-monoidal-map = appendPatch (fetchpatch {
    url = "https://github.com/obsidiansystems/dependent-monoidal-map/commit/3f8be15fa9bd2796d1c917e9f0979b4d6c62cf91.patch";
    hash = "sha256-QKDUh4jO8xZrThrkjTVNnkoVY+GejxOhpXOVA4+n1H8=";
  }) super.dependent-monoidal-map;

  # 2025-05-05: Bounds need to be loosened https://github.com/obsidiansystems/dependent-sum-aeson-orphans/pull/13
  dependent-sum-aeson-orphans = appendPatch (fetchpatch {
    url = "https://github.com/obsidiansystems/dependent-sum-aeson-orphans/commit/9b4698154303a9865d7d68a2f01d280a8a39f108.patch";
    hash = "sha256-Pzjl2yp01XsYWcyhpLnsuccg7bOACgv+RpafauUox8c=";
  }) super.dependent-sum-aeson-orphans;

  # https://github.com/obsidiansystems/dependent-sum/pull/73
  dependent-sum-template = appendPatch (fetchpatch {
    url = "https://github.com/obsidiansystems/dependent-sum/commit/619727ba1792e39a68d23c62e75a923672e87a54.patch";
    hash = "sha256-SyD1/KrX1KUjrR82fvI+BRcqLC2Q3AbvSeKNrdGstjg=";
    relative = "dependent-sum-template";
  }) super.dependent-sum-template;

  aeson-gadt-th = appendPatch (fetchpatch {
    url = "https://github.com/obsidiansystems/aeson-gadt-th/commit/8f6922a6440019dece637d73d70766c473bcd6c0.patch";
    hash = "sha256-564DhfiubwNV8nAj8L5DzsWn4MdzqqaYYNmOSPUa7ys=";
    excludes = [ ".github/**" ];
  }) super.aeson-gadt-th;

  # Too strict bounds on chell: https://github.com/fpco/haskell-filesystem/issues/24
  system-fileio = doJailbreak super.system-fileio;
@@ -2617,12 +2647,27 @@ self: super: {
  # https://github.com/ngless-toolkit/ngless/issues/152
  NGLess = dontCheck super.NGLess;

  # Raise version bounds for hspec
  # Raise version bounds: https://github.com/well-typed/lens-sop/pull/4
  lens-sop = appendPatches [
    (fetchpatch {
      url = "https://github.com/well-typed/lens-sop/commit/d8657f27c12191a7c0a91701c0fcd9a590e0090e.patch";
      sha256 = "sha256-9ODfbOb6Bs3EVTY9b7cUvkNmqzzZPWUmgmlAneaN3Tw=";
    })
    (fetchpatch {
      url = "https://github.com/well-typed/lens-sop/commit/b7ecffdeb836d19373871659e2f8cd24da6f7312.patch";
      sha256 = "sha256-hDUQ2fW9Qyom65YvtW9bsbz7XtueRmdsAbAB42D+gu4=";
    })
  ] super.lens-sop;

  # Raise version bounds: https://github.com/kosmikus/records-sop/pull/15
  records-sop = appendPatch (fetchpatch {
    url = "https://github.com/kosmikus/records-sop/pull/11/commits/d88831388ab3041190130fec3cdd679a4217b3c7.patch";
    sha256 = "sha256-O+v/OxvqnlWX3HaDvDIBZnJ+Og3xs/SJqI3gaouU3ZI=";
    url = "https://github.com/kosmikus/records-sop/commit/fb149f453a816ff14d0cb20b3ea56b80ff49d9f1.patch";
    sha256 = "sha256-iHiF4EWL/GjJFnr/6aR+yMZKLMLAZK+gsgSxG8YaeDI=";
  }) super.records-sop;

  # Need https://github.com/well-typed/large-records/pull/151
  large-generics = doJailbreak super.large-generics;

  # Fix build failures for ghc 9 (https://github.com/mokus0/polynomial/pull/20)
  polynomial = appendPatch (fetchpatch {
    name = "haskell-polynomial.20.patch";
@@ -2935,7 +2980,7 @@ self: super: {

  # Requires a newer zlib version than stackage provides
  futhark = super.futhark.override {
    zlib = self.zlib_0_7_0_0;
    zlib = self.zlib_0_7_1_0;
  };

  # Tests rely on (missing) submodule
@@ -2989,6 +3034,14 @@ self: super: {
  # 2024-03-25: HSH broken because of the unix-2.8.0.0 breaking change
  HSH = appendPatches [./patches/HSH-unix-openFd.patch] super.HSH;

  # Support unix < 2.8 to build in older ghc than 9.6
  linux-namespaces = appendPatch
    (fetchpatch {
      url = "https://github.com/redneb/hs-linux-namespaces/commit/f4a3546541bb6c7172fdd03e177a961da60e3951.patch";
      sha256 = "sha256-6Qv7NWIbzR3ktMGFogw5597bIqPH7Z4hoFvvBQAoquY=";
    })
    super.linux-namespaces;

  inherit
    (let
      unbreakRepa = packageName: drv: lib.pipe drv [
@@ -3047,4 +3100,11 @@ self: super: {

  # Too strict bounds on text. Can be removed after https://github.com/alx741/currencies/pull/3 is merged
  currencies = doJailbreak super.currencies;

  # https://github.com/awakesecurity/proto3-wire/pull/104
  proto3-wire = appendPatch (pkgs.fetchpatch {
    url = "https://github.com/awakesecurity/proto3-wire/commit/c1cadeb5fca2e82c5b28e2811c01f5b37eb21ed8.patch";
    hash = "sha256-tFOWpjGmZANC7H82QapZ36raaNWuZ6F3BgjxnfTXpMs=";
  }) super.proto3-wire;

} // import ./configuration-tensorflow.nix {inherit pkgs haskellLib;} self super
Loading