diff --git a/pkgs/applications/misc/gitit/default.nix b/pkgs/applications/misc/gitit/default.nix index a4ffd3bf88d3b..365b3f6acd977 100644 --- a/pkgs/applications/misc/gitit/default.nix +++ b/pkgs/applications/misc/gitit/default.nix @@ -14,13 +14,13 @@ let plugins = if pluginSupport then plain - else haskell.lib.disableCabalFlag plain "plugins"; - static = haskell.lib.justStaticExecutables plugins; + else haskell.lib.compose.disableCabalFlag "plugins" plain; + static = haskell.lib.compose.justStaticExecutables plugins; in - (haskell.lib.overrideCabal static (drv: { + (haskell.lib.compose.overrideCabal (drv: { buildTools = (drv.buildTools or []) ++ [ removeReferencesTo ]; - })).overrideAttrs (drv: { + }) static).overrideAttrs (drv: { # These libraries are still referenced, because they generate # a `Paths_*` module for figuring out their version. diff --git a/pkgs/applications/virtualization/arion/default.nix b/pkgs/applications/virtualization/arion/default.nix index f144ec976779e..33b2b000cbfcf 100644 --- a/pkgs/applications/virtualization/arion/default.nix +++ b/pkgs/applications/virtualization/arion/default.nix @@ -18,11 +18,11 @@ let arion = justStaticExecutables ( overrideCabal - arion-compose cabalOverrides + arion-compose ); - inherit (haskell.lib) justStaticExecutables overrideCabal; + inherit (haskell.lib.compose) justStaticExecutables overrideCabal; inherit (haskellPackages) arion-compose; diff --git a/pkgs/development/compilers/elm/default.nix b/pkgs/development/compilers/elm/default.nix index 837855d2bddca..b82f14d9ef9f9 100644 --- a/pkgs/development/compilers/elm/default.nix +++ b/pkgs/development/compilers/elm/default.nix @@ -8,9 +8,9 @@ let fetchElmDeps = import ./fetchElmDeps.nix { inherit stdenv lib fetchurl; }; hsPkgs = haskellPackages.override { - overrides = self: super: with haskell.lib; with lib; + overrides = self: super: with haskell.lib.compose; with lib; let elmPkgs = rec { - elm = overrideCabal (self.callPackage ./packages/elm.nix { }) (drv: { + elm = overrideCabal (drv: { # sadly with parallelism most of the time breaks compilation enableParallelBuilding = false; preConfigure = self.fetchElmDeps { @@ -29,22 +29,22 @@ let homepage = "https://elm-lang.org/"; license = licenses.bsd3; maintainers = with maintainers; [ domenkozar turbomack ]; - }); + }) (self.callPackage ./packages/elm.nix { }); /* The elm-format expression is updated via a script in the https://github.com/avh4/elm-format repo: `package/nix/build.sh` */ - elm-format = justStaticExecutables (overrideCabal (self.callPackage ./packages/elm-format.nix {}) (drv: { + elm-format = justStaticExecutables (overrideCabal (drv: { jailbreak = true; description = "Formats Elm source code according to a standard set of rules based on the official Elm Style Guide"; homepage = "https://github.com/avh4/elm-format"; license = licenses.bsd3; maintainers = with maintainers; [ avh4 turbomack ]; - })); + }) (self.callPackage ./packages/elm-format.nix {})); - elmi-to-json = justStaticExecutables (overrideCabal (self.callPackage ./packages/elmi-to-json.nix {}) (drv: { + elmi-to-json = justStaticExecutables (overrideCabal (drv: { prePatch = '' substituteInPlace package.yaml --replace "- -Werror" "" hpack @@ -55,9 +55,9 @@ let homepage = "https://github.com/stoeffel/elmi-to-json"; license = licenses.bsd3; maintainers = [ maintainers.turbomack ]; - })); + }) (self.callPackage ./packages/elmi-to-json.nix {})); - elm-instrument = justStaticExecutables (overrideCabal (self.callPackage ./packages/elm-instrument.nix {}) (drv: { + elm-instrument = justStaticExecutables (overrideCabal (drv: { prePatch = '' sed "s/desc <-.*/let desc = \"${drv.version}\"/g" Setup.hs --in-place ''; @@ -69,7 +69,7 @@ let homepage = "https://github.com/zwilias/elm-instrument"; license = licenses.bsd3; maintainers = [ maintainers.turbomack ]; - })); + }) (self.callPackage ./packages/elm-instrument.nix {})); inherit fetchElmDeps; elmVersion = elmPkgs.elm.version; diff --git a/pkgs/development/compilers/pakcs/default.nix b/pkgs/development/compilers/pakcs/default.nix index e2dceaab3975c..a08a1b245dbda 100644 --- a/pkgs/development/compilers/pakcs/default.nix +++ b/pkgs/development/compilers/pakcs/default.nix @@ -16,14 +16,14 @@ let curry-frontend = (haskellPackages.override { overrides = self: super: { - curry-base = haskell.lib.overrideCabal (super.callPackage ./curry-base.nix {}) (drv: { + curry-base = haskell.lib.compose.overrideCabal (drv: { inherit src; postUnpack = "sourceRoot+=/frontend/curry-base"; - }); - curry-frontend = haskell.lib.overrideCabal (super.callPackage ./curry-frontend.nix {}) (drv: { + }) (super.callPackage ./curry-base.nix {}); + curry-frontend = haskell.lib.compose.overrideCabal (drv: { inherit src; postUnpack = "sourceRoot+=/frontend/curry-frontend"; - }); + }) (super.callPackage ./curry-frontend.nix {}); }; }).curry-frontend; in stdenv.mkDerivation { diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 7bf11fa2a451c..6ce3c9cdb59f0 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -27,10 +27,10 @@ self: super: { bin-package-db = null; # waiting for release: https://github.com/jwiegley/c2hsc/issues/41 - c2hsc = appendPatch super.c2hsc (pkgs.fetchpatch { + c2hsc = appendPatch (pkgs.fetchpatch { url = "https://github.com/jwiegley/c2hsc/commit/490ecab202e0de7fc995eedf744ad3cb408b53cc.patch"; sha256 = "1c7knpvxr7p8c159jkyk6w29653z5yzgjjqj11130bbb8mk9qhq7"; - }); + }) super.c2hsc; # Some Hackage packages reference this attribute, which exists only in the # GHCJS package set. We provide a dummy version here to fix potential @@ -60,7 +60,7 @@ self: super: { # The Hackage tarball is purposefully broken, because it's not intended to be, like, useful. # https://git-annex.branchable.com/bugs/bash_completion_file_is_missing_in_the_6.20160527_tarball_on_hackage/ - git-annex = (overrideSrc super.git-annex { + git-annex = (overrideSrc { src = pkgs.fetchgit { name = "git-annex-${super.git-annex.version}-src"; url = "git://git-annex.branchable.com/"; @@ -74,16 +74,16 @@ self: super: { rm -r $out/doc/?ndroid* ''; }; - }).override { + } super.git-annex).override { dbus = if pkgs.stdenv.isLinux then self.dbus else null; fdo-notify = if pkgs.stdenv.isLinux then self.fdo-notify else null; hinotify = if pkgs.stdenv.isLinux then self.hinotify else self.fsnotify; }; # Fix test trying to access /home directory - shell-conduit = overrideCabal super.shell-conduit (drv: { + shell-conduit = overrideCabal (drv: { postPatch = "sed -i s/home/tmp/ test/Spec.hs"; - }); + }) super.shell-conduit; # https://github.com/froozen/kademlia/issues/2 kademlia = dontCheck super.kademlia; @@ -99,14 +99,14 @@ self: super: { # Tests require a Kafka broker running locally haskakafka = dontCheck super.haskakafka; - bindings-levmar = overrideCabal super.bindings-levmar (drv: { + bindings-levmar = overrideCabal (drv: { extraLibraries = [ pkgs.blas ]; - }); + }) super.bindings-levmar; # Requires wrapQtAppsHook - qtah-cpp-qt5 = overrideCabal super.qtah-cpp-qt5 (drv: { + qtah-cpp-qt5 = overrideCabal (drv: { buildDepends = [ pkgs.qt5.wrapQtAppsHook ]; - }); + }) super.qtah-cpp-qt5; # The Haddock phase fails for one reason or another. deepseq-magic = dontHaddock super.deepseq-magic; @@ -119,15 +119,15 @@ self: super: { # sse2 flag due to https://github.com/haskell/vector/issues/47. # Jailbreak is necessary for QuickCheck dependency. - vector = doJailbreak (if pkgs.stdenv.isi686 then appendConfigureFlag super.vector "--ghc-options=-msse2" else super.vector); + vector = doJailbreak (if pkgs.stdenv.isi686 then appendConfigureFlag "--ghc-options=-msse2" super.vector else super.vector); - inline-c-cpp = overrideCabal super.inline-c-cpp (drv: { + inline-c-cpp = overrideCabal (drv: { postPatch = (drv.postPatch or "") + '' substituteInPlace inline-c-cpp.cabal --replace "-optc-std=c++11" "" ''; - }); + }) super.inline-c-cpp; - inline-java = addBuildDepend super.inline-java pkgs.jdk; + inline-java = addBuildDepend pkgs.jdk super.inline-java; # Upstream notified by e-mail. permutation = dontCheck super.permutation; @@ -171,13 +171,13 @@ self: super: { digit = doJailbreak super.digit; hnix = generateOptparseApplicativeCompletion "hnix" - (overrideCabal (super.hnix.override { + (overrideCabal (drv: { + # 2020-06-05: HACK: does not pass own build suite - `dontCheck` + doCheck = false; + }) (super.hnix.override { # needs newer version of relude and semialign than stackage has relude = self.relude_1_0_0_1; semialign = self.semialign_1_2_0_1; - }) (drv: { - # 2020-06-05: HACK: does not pass own build suite - `dontCheck` - doCheck = false; })); # Fails for non-obvious reasons while attempting to use doctest. @@ -185,8 +185,8 @@ self: super: { search = dontCheck super.search; # see https://github.com/LumiGuide/haskell-opencv/commit/cd613e200aa20887ded83256cf67d6903c207a60 - opencv = dontCheck (appendPatch super.opencv ./patches/opencv-fix-116.patch); - opencv-extra = dontCheck (appendPatch super.opencv-extra ./patches/opencv-fix-116.patch); + opencv = dontCheck (appendPatch ./patches/opencv-fix-116.patch super.opencv); + opencv-extra = dontCheck (appendPatch ./patches/opencv-fix-116.patch super.opencv-extra); # https://github.com/ekmett/structures/issues/3 structures = dontCheck super.structures; @@ -257,17 +257,17 @@ self: super: { hgdbmi = dontCheck super.hgdbmi; hi = dontCheck super.hi; hierarchical-clustering = dontCheck super.hierarchical-clustering; - hlibgit2 = disableHardening super.hlibgit2 [ "format" ]; + hlibgit2 = disableHardening [ "format" ] super.hlibgit2; hmatrix-tests = dontCheck super.hmatrix-tests; hquery = dontCheck super.hquery; hs2048 = dontCheck super.hs2048; hsbencher = dontCheck super.hsbencher; hsexif = dontCheck super.hsexif; hspec-server = dontCheck super.hspec-server; - HTF = overrideCabal super.HTF (orig: { + HTF = overrideCabal (orig: { # The scripts in scripts/ are needed to build the test suite. preBuild = "patchShebangs --build scripts"; - }); + }) super.HTF; htsn = dontCheck super.htsn; htsn-import = dontCheck super.htsn-import; http-link-header = dontCheck super.http-link-header; # non deterministic failure https://hydra.nixos.org/build/75041105 @@ -278,7 +278,7 @@ self: super: { language-slice = dontCheck super.language-slice; ldap-client = dontCheck super.ldap-client; lensref = dontCheck super.lensref; - lvmrun = disableHardening (dontCheck super.lvmrun) ["format"]; + lvmrun = disableHardening ["format"] (dontCheck super.lvmrun); matplotlib = dontCheck super.matplotlib; # https://github.com/matterhorn-chat/matterhorn/issues/679 they do not want to be on stackage matterhorn = doJailbreak (super.matterhorn.overrideScope (self: super: { @@ -371,7 +371,7 @@ self: super: { duplo = dontCheck super.duplo; # https://github.com/evanrinehart/mikmod/issues/1 - mikmod = addExtraLibrary super.mikmod pkgs.libmikmod; + mikmod = addExtraLibrary pkgs.libmikmod super.mikmod; # https://github.com/basvandijk/threads/issues/10 threads = dontCheck super.threads; @@ -387,7 +387,7 @@ self: super: { CHXHtml = dontDistribute super.CHXHtml; # https://github.com/NixOS/nixpkgs/issues/6350 - paypal-adaptive-hoops = overrideCabal super.paypal-adaptive-hoops (drv: { testTarget = "local"; }); + paypal-adaptive-hoops = overrideCabal (drv: { testTarget = "local"; }) super.paypal-adaptive-hoops; # Avoid "QuickCheck >=2.3 && <2.10" dependency we cannot fulfill in lts-11.x. test-framework = dontCheck super.test-framework; @@ -447,11 +447,11 @@ self: super: { doctest-discover = dontCheck super.doctest-discover; # Depends on itself for testing - tasty-discover = overrideCabal super.tasty-discover (drv: { + tasty-discover = overrideCabal (drv: { preBuild = '' export PATH="$PWD/dist/build/tasty-discover:$PATH" '' + (drv.preBuild or ""); - }); + }) super.tasty-discover; # Known issue with nondeterministic test suite failure # https://github.com/nomeata/tasty-expected-failure/issues/21 @@ -485,7 +485,7 @@ self: super: { fft = dontCheck super.fft; # This package can't be built on non-Windows systems. - Win32 = overrideCabal super.Win32 (drv: { broken = !pkgs.stdenv.isCygwin; }); + Win32 = overrideCabal (drv: { broken = !pkgs.stdenv.isCygwin; }) super.Win32; inline-c-win32 = dontDistribute super.inline-c-win32; Southpaw = dontDistribute super.Southpaw; @@ -493,7 +493,7 @@ self: super: { lhs2tex = dontDistribute super.lhs2tex; # https://ghc.haskell.org/trac/ghc/ticket/9825 - vimus = overrideCabal super.vimus (drv: { broken = pkgs.stdenv.isLinux && pkgs.stdenv.isi686; }); + vimus = overrideCabal (drv: { broken = pkgs.stdenv.isLinux && pkgs.stdenv.isi686; }) super.vimus; # https://github.com/kazu-yamamoto/logger/issues/42 logger = dontCheck super.logger; @@ -520,16 +520,16 @@ self: super: { Euterpea = doJailbreak super.Euterpea; # Install icons, metadata and cli program. - bustle = overrideCabal super.bustle (drv: { + bustle = overrideCabal (drv: { buildDepends = [ pkgs.libpcap ]; buildTools = with pkgs.buildPackages; [ gettext perl help2man ]; postInstall = '' make install PREFIX=$out ''; - }); + }) super.bustle; # Byte-compile elisp code for Emacs. - ghc-mod = overrideCabal super.ghc-mod (drv: { + ghc-mod = overrideCabal (drv: { preCheck = "export HOME=$TMPDIR"; testToolDepends = drv.testToolDepends or [] ++ [self.cabal-install]; doCheck = false; # https://github.com/kazu-yamamoto/ghc-mod/issues/335 @@ -540,11 +540,11 @@ self: super: { mkdir -p $data/share/emacs/site-lisp ln -s "$lispdir/"*.el{,c} $data/share/emacs/site-lisp/ ''; - }); + }) super.ghc-mod; # Build the latest git version instead of the official release. This isn't # ideal, but Chris doesn't seem to make official releases any more. - structured-haskell-mode = overrideCabal super.structured-haskell-mode (drv: { + structured-haskell-mode = overrideCabal (drv: { src = pkgs.fetchFromGitHub { owner = "projectional-haskell"; repo = "structured-haskell-mode"; @@ -561,10 +561,10 @@ self: super: { mkdir -p $data/share/emacs ln -s $lispdir $data/share/emacs/site-lisp ''; - }); + }) super.structured-haskell-mode; # Make elisp files available at a location where people expect it. - hindent = (overrideCabal super.hindent (drv: { + hindent = (overrideCabal (drv: { # We cannot easily byte-compile these files, unfortunately, because they # depend on a new version of haskell-mode that we don't have yet. postInstall = '' @@ -573,7 +573,7 @@ self: super: { ln -s $lispdir $data/share/emacs/site-lisp ''; doCheck = false; # https://github.com/chrisdone/hindent/issues/299 - })); + }) super.hindent); # https://github.com/bos/configurator/issues/22 configurator = dontCheck super.configurator; @@ -582,36 +582,36 @@ self: super: { concurrent-extra = dontCheck super.concurrent-extra; # https://github.com/bos/bloomfilter/issues/7 - bloomfilter = appendPatch super.bloomfilter ./patches/bloomfilter-fix-on-32bit.patch; + bloomfilter = appendPatch ./patches/bloomfilter-fix-on-32bit.patch super.bloomfilter; # https://github.com/ashutoshrishi/hunspell-hs/pull/3 - hunspell-hs = addPkgconfigDepend (dontCheck (appendPatch super.hunspell-hs ./patches/hunspell.patch)) pkgs.hunspell; + hunspell-hs = addPkgconfigDepend pkgs.hunspell (dontCheck (appendPatch ./patches/hunspell.patch super.hunspell-hs)); # https://github.com/pxqr/base32-bytestring/issues/4 base32-bytestring = dontCheck super.base32-bytestring; # Djinn's last release was 2014, incompatible with Semigroup-Monoid Proposal # https://github.com/augustss/djinn/pull/8 - djinn = appendPatch super.djinn (pkgs.fetchpatch { + djinn = appendPatch (pkgs.fetchpatch { url = "https://github.com/augustss/djinn/commit/6cb9433a137fb6b5194afe41d616bd8b62b95630.patch"; sha256 = "0s021y5nzrh74gfp8xpxpxm11ivzfs3jwg6mkrlyry3iy584xqil"; - }); + }) super.djinn; # We cannot build this package w/o the C library from . phash = markBroken super.phash; # https://github.com/Philonous/hs-stun/pull/1 # Remove if a version > 0.1.0.1 ever gets released. - stunclient = overrideCabal super.stunclient (drv: { + stunclient = overrideCabal (drv: { postPatch = (drv.postPatch or "") + '' substituteInPlace source/Network/Stun/MappedAddress.hs --replace "import Network.Endian" "" ''; - }); + }) super.stunclient; d-bus = let # The latest release on hackage is missing necessary patches for recent compilers # https://github.com/Philonous/d-bus/issues/24 - newer = overrideSrc super.d-bus { + newer = overrideSrc { version = "unstable-2021-01-08"; src = pkgs.fetchFromGitHub { owner = "Philonous"; @@ -619,13 +619,13 @@ self: super: { rev = "fb8a948a3b9d51db618454328dbe18fb1f313c70"; hash = "sha256-R7/+okb6t9DAkPVUV70QdYJW8vRcvBdz4zKJT13jb3A="; }; - }; + } super.d-bus; # Add now required extension on recent compilers. # https://github.com/Philonous/d-bus/pull/23 - in appendPatch newer (pkgs.fetchpatch { + in appendPatch (pkgs.fetchpatch { url = "https://github.com/Philonous/d-bus/commit/e5f37900a3a301c41d98bdaa134754894c705681.patch"; sha256 = "6rQ7H9t483sJe1x95yLPAZ0BKTaRjgqQvvrQv7HkJRE="; - }); + }) newer; # * The standard libraries are compiled separately. # * We need multiple patches from master to fix compilation with @@ -704,10 +704,10 @@ self: super: { # Test suite fails: https://github.com/lymar/hastache/issues/46. # Don't install internal mkReadme tool. - hastache = overrideCabal super.hastache (drv: { + hastache = overrideCabal (drv: { doCheck = false; postInstall = "rm $out/bin/mkReadme && rmdir $out/bin"; - }); + }) super.hastache; # Has a dependency on outdated versions of directory. cautious-file = doJailbreak (dontCheck super.cautious-file); @@ -725,14 +725,14 @@ self: super: { # Wrap the generated binaries to include their run-time dependencies in # $PATH. Also, cryptol needs a version of sbl that's newer than what we have # in LTS-13.x. - cryptol = overrideCabal super.cryptol (drv: { + cryptol = overrideCabal (drv: { buildTools = drv.buildTools or [] ++ [ pkgs.buildPackages.makeWrapper ]; postInstall = drv.postInstall or "" + '' for b in $out/bin/cryptol $out/bin/cryptol-html; do wrapProgram $b --prefix 'PATH' ':' "${pkgs.lib.getBin pkgs.z3}/bin" done ''; - }); + }) super.cryptol; # Tests try to invoke external process and process == 1.4 grakn = dontCheck (doJailbreak super.grakn); @@ -748,7 +748,7 @@ self: super: { c2hs = dontCheck super.c2hs; # Needs pginit to function and pgrep to verify. - tmp-postgres = overrideCabal super.tmp-postgres (drv: { + tmp-postgres = overrideCabal (drv: { # Flaky tests: https://github.com/jfischoff/tmp-postgres/issues/274 doCheck = false; @@ -757,7 +757,7 @@ self: super: { '' + (drv.preCheck or ""); libraryToolDepends = drv.libraryToolDepends or [] ++ [pkgs.buildPackages.postgresql]; testToolDepends = drv.testToolDepends or [] ++ [pkgs.procps]; - }); + }) super.tmp-postgres; # Needs QuickCheck <2.10, which we don't have. edit-distance = doJailbreak super.edit-distance; @@ -786,11 +786,11 @@ self: super: { # Jailbreak is necessary to break out of tasty < 1.x dependency. # hackage2nix generates this as a broken package due to the (fake) dependency # missing from hackage, so we need to fix the meta attribute set. - cryptohash-sha256 = overrideCabal super.cryptohash-sha256 (drv: { + cryptohash-sha256 = overrideCabal (drv: { jailbreak = true; broken = false; hydraPlatforms = pkgs.lib.platforms.all; - }); + }) super.cryptohash-sha256; # The test suite has all kinds of out-dated dependencies, so it feels easier # to just disable it. @@ -821,17 +821,17 @@ self: super: { protobuf = dontCheck super.protobuf; # Is this package still maintained? https://github.com/haskell/text-icu/issues/30 - text-icu = overrideCabal super.text-icu (drv: { + text-icu = overrideCabal (drv: { doCheck = false; # https://github.com/bos/text-icu/issues/32 configureFlags = ["--ghc-option=-DU_DEFINE_FALSE_AND_TRUE=1"]; # https://github.com/haskell/text-icu/issues/49 - }); + }) super.text-icu; # jailbreak tasty < 1.2 until servant-docs > 0.11.3 is on hackage. servant-docs = doJailbreak super.servant-docs; snap-templates = doJailbreak super.snap-templates; # https://github.com/snapframework/snap-templates/issues/22 # hledger-lib requires the latest version of pretty-simple - hledger-lib = appendPatch super.hledger-lib + hledger-lib = appendPatch # This patch has been merged but not released yet: # https://github.com/simonmichael/hledger/pull/1512. It is # important for ledger-autosync test suite: @@ -842,7 +842,8 @@ self: super: { sha256 = "10knvrd5bl9nrmi27i0pm82sfr64jy04xgbjp228qywyijpr3pqv"; includes = [ "Hledger/Read/CsvReader.hs" ]; stripLen = 1; - }); + }) + super.hledger-lib; # hledger-lib 1.23 depends on doctest >= 0.18 hledger-lib_1_23 = super.hledger-lib_1_23.override { @@ -851,7 +852,7 @@ self: super: { # Copy hledger man pages from data directory into the proper place. This code # should be moved into the cabal2nix generator. - hledger = overrideCabal super.hledger (drv: { + hledger = overrideCabal (drv: { postInstall = '' # Don't install files that don't belong into this package to avoid # conflicts when hledger and hledger-ui end up in the same profile. @@ -865,8 +866,8 @@ self: super: { mkdir -p $out/share/info cp -v embeddedfiles/*.info* $out/share/info/ ''; - }); - hledger-ui = overrideCabal super.hledger-ui (drv: { + }) super.hledger; + hledger-ui = overrideCabal (drv: { postInstall = '' for i in $(seq 1 9); do for j in *.$i; do @@ -877,8 +878,8 @@ self: super: { mkdir -p $out/share/info cp -v *.info* $out/share/info/ ''; - }); - hledger-web = overrideCabal super.hledger-web (drv: { + }) super.hledger-ui; + hledger-web = overrideCabal (drv: { preCheck = "export HOME=$TMPDIR"; postInstall = '' for i in $(seq 1 9); do @@ -890,7 +891,7 @@ self: super: { mkdir -p $out/share/info cp -v *.info* $out/share/info/ ''; - }); + }) super.hledger-web; # https://github.com/haskell-hvr/resolv/pull/6 @@ -901,20 +902,20 @@ self: super: { spdx = dontCheck super.spdx; # The test suite does not know how to find the 'alex' binary. - alex = overrideCabal super.alex (drv: { + alex = overrideCabal (drv: { testSystemDepends = (drv.testSystemDepends or []) ++ [pkgs.which]; preCheck = ''export PATH="$PWD/dist/build/alex:$PATH"''; - }); + }) super.alex; # This package refers to the wrong library (itself in fact!) vulkan = super.vulkan.override { vulkan = pkgs.vulkan-loader; }; # Compiles some C or C++ source which requires these headers - VulkanMemoryAllocator = addExtraLibrary super.VulkanMemoryAllocator pkgs.vulkan-headers; - vulkan-utils = addExtraLibrary super.vulkan-utils pkgs.vulkan-headers; + VulkanMemoryAllocator = addExtraLibrary pkgs.vulkan-headers super.VulkanMemoryAllocator; + vulkan-utils = addExtraLibrary pkgs.vulkan-headers super.vulkan-utils; # https://github.com/dmwit/encoding/pull/3 - encoding = doJailbreak (appendPatch super.encoding ./patches/encoding-Cabal-2.0.patch); + encoding = doJailbreak (appendPatch ./patches/encoding-Cabal-2.0.patch super.encoding); # Work around overspecified constraint on github ==0.18. github-backup = doJailbreak super.github-backup; @@ -963,17 +964,17 @@ self: super: { brittany = doJailbreak (dontCheck super.brittany); # Outdated upperbound on ghc-exactprint: https://github.com/lspitzner/brittany/issues/342 # Fix with Cabal 2.2, https://github.com/guillaume-nargeot/hpc-coveralls/pull/73 - hpc-coveralls = appendPatch super.hpc-coveralls (pkgs.fetchpatch { + hpc-coveralls = appendPatch (pkgs.fetchpatch { url = "https://github.com/guillaume-nargeot/hpc-coveralls/pull/73/commits/344217f513b7adfb9037f73026f5d928be98d07f.patch"; sha256 = "056rk58v9h114mjx62f41x971xn9p3nhsazcf9zrcyxh1ymrdm8j"; - }); + }) super.hpc-coveralls; # sexpr is old, broken and has no issue-tracker. Let's fix it the best we can. - sexpr = - appendPatch (overrideCabal super.sexpr (drv: { + sexpr = appendPatch ./patches/sexpr-0.2.1.patch + (overrideCabal (drv: { isExecutable = false; libraryHaskellDepends = drv.libraryHaskellDepends ++ [self.QuickCheck]; - })) ./patches/sexpr-0.2.1.patch; + }) super.sexpr); # https://github.com/haskell/hoopl/issues/50 hoopl = dontCheck super.hoopl; @@ -1011,9 +1012,9 @@ self: super: { # TODO(Profpatsch): factor out local nix store setup from # lib/tests/release.nix and use that for the tests of libnix - # libnix = overrideCabal super.libnix (old: { + # libnix = overrideCabal (old: { # testToolDepends = old.testToolDepends or [] ++ [ pkgs.nix ]; - # }); + # }) super.libnix; libnix = dontCheck super.libnix; # dontCheck: The test suite tries to mess with ALSA, which doesn't work in the build sandbox. @@ -1027,20 +1028,20 @@ self: super: { beam-core = doJailbreak super.beam-core; # Requires pg_ctl command during tests - beam-postgres = overrideCabal super.beam-postgres (drv: { + beam-postgres = overrideCabal (drv: { testToolDepends = (drv.testToolDepends or []) ++ [pkgs.postgresql]; - }); + }) super.beam-postgres; # Fix for base >= 4.11 - scat = overrideCabal super.scat (drv: { + scat = overrideCabal (drv: { patches = [(pkgs.fetchpatch { url = "https://github.com/redelmann/scat/pull/6.diff"; sha256 = "07nj2p0kg05livhgp1hkkdph0j0a6lb216f8x348qjasy0lzbfhl"; })]; - }); + }) super.scat; # Fix build with attr-2.4.48 (see #53716) - xattr = appendPatch super.xattr ./patches/xattr-fix-build.patch; + xattr = appendPatch ./patches/xattr-fix-build.patch super.xattr; # Some tests depend on a postgresql instance esqueleto = dontCheck super.esqueleto; @@ -1066,13 +1067,13 @@ self: super: { openid = markBroken super.openid; # The test suite needs the packages's executables in $PATH to succeed. - arbtt = overrideCabal super.arbtt (drv: { + arbtt = overrideCabal (drv: { preCheck = '' for i in $PWD/dist/build/*; do export PATH="$i:$PATH" done ''; - }); + }) super.arbtt; # https://github.com/erikd/hjsmin/issues/32 hjsmin = dontCheck super.hjsmin; @@ -1081,7 +1082,7 @@ self: super: { language-ats = dontCheck super.language-ats; # Remove for hail > 0.2.0.0 - hail = overrideCabal super.hail (drv: { + hail = overrideCabal (drv: { patches = [ (pkgs.fetchpatch { # Relax dependency constraints, @@ -1096,7 +1097,7 @@ self: super: { sha256 = "0dpagpn654zjrlklihsg911lmxjj8msylbm3c68xa5aad1s9gcf7"; }) ]; - }); + }) super.hail; # https://github.com/kazu-yamamoto/dns/issues/150 dns = dontCheck super.dns; @@ -1112,20 +1113,20 @@ self: super: { perhaps = doJailbreak super.perhaps; # it wants to build a statically linked binary by default - hledger-flow = overrideCabal super.hledger-flow ( drv: { + hledger-flow = overrideCabal (drv: { postPatch = (drv.postPatch or "") + '' substituteInPlace hledger-flow.cabal --replace "-static" "" ''; - }); + }) super.hledger-flow; # Chart-tests needs and compiles some modules from Chart itself - Chart-tests = overrideCabal (addExtraLibrary super.Chart-tests self.QuickCheck) (old: { + Chart-tests = overrideCabal (old: { # https://github.com/timbod7/haskell-chart/issues/233 jailbreak = true; preCheck = old.preCheck or "" + '' tar --one-top-level=../chart --strip-components=1 -xf ${self.Chart.src} ''; - }); + }) (addExtraLibrary self.QuickCheck super.Chart-tests); # This breaks because of version bounds, but compiles and runs fine. # Last commit is 5 years ago, so we likely won't get upstream fixed soon. @@ -1152,32 +1153,32 @@ self: super: { # Fix EdisonAPI and EdisonCore for GHC 8.8: # https://github.com/robdockins/edison/pull/16 - EdisonAPI = appendPatch super.EdisonAPI (pkgs.fetchpatch { + EdisonAPI = appendPatch (pkgs.fetchpatch { url = "https://github.com/robdockins/edison/pull/16/commits/8da6c0f7d8666766e2f0693425c347c0adb492dc.patch"; postFetch = '' ${pkgs.buildPackages.patchutils}/bin/filterdiff --include='a/edison-api/*' --strip=1 "$out" > "$tmpfile" mv "$tmpfile" "$out" ''; sha256 = "0yi5pz039lcm4pl9xnl6krqxyqq5rgb5b6m09w0sfy06x0n4x213"; - }); + }) super.EdisonAPI; - EdisonCore = appendPatch super.EdisonCore (pkgs.fetchpatch { + EdisonCore = appendPatch (pkgs.fetchpatch { url = "https://github.com/robdockins/edison/pull/16/commits/8da6c0f7d8666766e2f0693425c347c0adb492dc.patch"; postFetch = '' ${pkgs.buildPackages.patchutils}/bin/filterdiff --include='a/edison-core/*' --strip=1 "$out" > "$tmpfile" mv "$tmpfile" "$out" ''; sha256 = "097wqn8hxsr50b9mhndg5pjim5jma2ym4ylpibakmmb5m98n17zp"; - }); + }) super.EdisonCore; # Pick patch from 1.6.0 which allows compilation with doctest 0.18 - polysemy = appendPatches super.polysemy [ + polysemy = appendPatches [ (pkgs.fetchpatch { name = "allow-doctest-0.18.patch"; url = "https://github.com/polysemy-research/polysemy/commit/dbcf851eb69395ce3143ecf2dd616dcad953a339.patch"; sha256 = "1qf5pghc8p1glwaadkr95x12d74vhb98mg8dqwilyxbc6gq763w2"; }) - ]; + ] super.polysemy; # polysemy-plugin 0.2.5.0 has constraint ghc-tcplugins-extra (==0.3.*) # This upstream issue is relevant: @@ -1223,10 +1224,10 @@ self: super: { # add unreleased commit fixing version constraint as a patch # Can be removed if https://github.com/lpeterse/haskell-utc/issues/8 is resolved - utc = appendPatch super.utc (pkgs.fetchpatch { + utc = appendPatch (pkgs.fetchpatch { url = "https://github.com/lpeterse/haskell-utc/commit/e4502c08591e80d411129bb7c0414539f6302aaf.diff"; sha256 = "0v6kv1d4syjzgzc2s7a76c6k4vminlcq62n7jg3nn9xd00gwmmv7"; - }); + }) super.utc; # Tests disabled because they assume to run in the whole jsaddle repo and not the hackage tarbal of jsaddle-warp. jsaddle-warp = dontCheck super.jsaddle-warp; @@ -1251,9 +1252,9 @@ self: super: { # Fixed upstream but not released to Hackage yet: # https://github.com/k0001/hs-libsodium/issues/2 - libsodium = overrideCabal super.libsodium (drv: { + libsodium = overrideCabal (drv: { libraryToolDepends = (drv.libraryToolDepends or []) ++ [self.buildHaskellPackages.c2hs]; - }); + }) super.libsodium; # https://github.com/kowainik/policeman/issues/57 policeman = doJailbreak super.policeman; @@ -1262,7 +1263,7 @@ self: super: { gi-cairo-render = doJailbreak super.gi-cairo-render; gi-cairo-connector = doJailbreak super.gi-cairo-connector; - svgcairo = appendPatches super.svgcairo [ + svgcairo = appendPatches [ # Remove when https://github.com/gtk2hs/svgcairo/pull/12 goes in. (pkgs.fetchpatch { url = "https://github.com/gtk2hs/svgcairo/commit/348c60b99c284557a522baaf47db69322a0a8b67.patch"; @@ -1273,17 +1274,17 @@ self: super: { url = "https://github.com/dalpd/svgcairo/commit/d1e0d7ae04c1edca83d5b782e464524cdda6ae85.patch"; sha256 = "1pq9ld9z67zsxj8vqjf82qwckcp69lvvnrjb7wsyb5jc6jaj3q0a"; }) - ]; + ] super.svgcairo; # Missing -Iinclude parameter to doc-tests (pull has been accepted, so should be resolved when 0.5.3 released) # https://github.com/lehins/massiv/pull/104 massiv = dontCheck super.massiv; # Upstream PR: https://github.com/jkff/splot/pull/9 - splot = appendPatch super.splot (pkgs.fetchpatch { + splot = appendPatch (pkgs.fetchpatch { url = "https://github.com/jkff/splot/commit/a6710b05470d25cb5373481cf1cfc1febd686407.patch"; sha256 = "1c5ck2ibag2gcyag6rjivmlwdlp5k0dmr8nhk7wlkzq2vh7zgw63"; - }); + }) super.splot; # Tests are broken because of missing files in hackage tarball. # https://github.com/jgm/commonmark-hs/issues/55 @@ -1304,7 +1305,11 @@ self: super: { Spock-core = dontCheck super.Spock-core; # hasura packages need some extra care - graphql-engine = overrideCabal (super.graphql-engine.overrideScope (self: super: { + graphql-engine = overrideCabal (drv: { + patches = [ ./patches/graphql-engine-mapkeys.patch ]; + doHaddock = false; + version = "2.0.9"; + }) (super.graphql-engine.overrideScope (self: super: { immortal = self.immortal_0_2_2_1; resource-pool = self.hasura-resource-pool; ekg-core = self.hasura-ekg-core; @@ -1313,11 +1318,7 @@ self: super: { hspec-core = dontCheck self.hspec-core_2_8_3; hspec-discover = dontCheck super.hspec-discover_2_8_3; tasty-hspec = self.tasty-hspec_1_2; - })) (drv: { - patches = [ ./patches/graphql-engine-mapkeys.patch ]; - doHaddock = false; - version = "2.0.9"; - }); + })); hasura-ekg-core = super.hasura-ekg-core.overrideScope (self: super: { hspec = dontCheck self.hspec_2_8_3; hspec-core = dontCheck self.hspec-core_2_8_3; @@ -1329,18 +1330,18 @@ self: super: { hspec-core = dontCheck self.hspec-core_2_8_3; hspec-discover = dontCheck super.hspec-discover_2_8_3; }); - pg-client = overrideCabal (super.pg-client.override { - resource-pool = self.hasura-resource-pool; - }) (drv: { + pg-client = overrideCabal (drv: { librarySystemDepends = with pkgs; [ postgresql krb5.dev openssl.dev ]; # wants a running DB to check against doCheck = false; + }) (super.pg-client.override { + resource-pool = self.hasura-resource-pool; }); # https://github.com/bos/statistics/issues/170 statistics = dontCheck super.statistics; - hcoord = overrideCabal super.hcoord (drv: { + hcoord = overrideCabal (drv: { # Remove when https://github.com/danfran/hcoord/pull/8 is merged. patches = [ (pkgs.fetchpatch { @@ -1350,7 +1351,7 @@ self: super: { ]; # Remove when https://github.com/danfran/hcoord/issues/9 is closed. doCheck = false; - }); + }) super.hcoord; # Tests rely on `Int` being 64-bit: https://github.com/hspec/hspec/issues/431. # Also, we need QuickCheck-2.14.x to build the test suite, which isn't easy in LTS-16.x. @@ -1375,14 +1376,14 @@ self: super: { # PATH. update-nix-fetchgit = let deps = [ pkgs.git pkgs.nix pkgs.nix-prefetch-git ]; in generateOptparseApplicativeCompletion "update-nix-fetchgit" (overrideCabal - (addTestToolDepends super.update-nix-fetchgit deps) (drv: { + (drv: { buildTools = drv.buildTools or [ ] ++ [ pkgs.buildPackages.makeWrapper ]; postInstall = drv.postInstall or "" + '' wrapProgram "$out/bin/update-nix-fetchgit" --prefix 'PATH' ':' "${ pkgs.lib.makeBinPath deps }" ''; - })); + }) (addTestToolDepends deps super.update-nix-fetchgit)); # Our quickcheck-instances is too old for the newer binary-instances, but # quickcheck-instances is only used in the tests of binary-instances. @@ -1475,15 +1476,15 @@ self: super: { hercules-ci-cli = generateOptparseApplicativeCompletion "hci" ( # See hercules-ci-optparse-applicative in non-hackage-packages.nix. addBuildDepend - (overrideCabal - (unmarkBroken super.hercules-ci-cli) - (drv: { hydraPlatforms = super.hercules-ci-cli.meta.platforms; })) super.hercules-ci-optparse-applicative + (overrideCabal + (drv: { hydraPlatforms = super.hercules-ci-cli.meta.platforms; }) + (unmarkBroken super.hercules-ci-cli)) ); # Readline uses Distribution.Simple from Cabal 2, in a way that is not # compatible with Cabal 3. No upstream repository found so far - readline = appendPatch super.readline ./patches/readline-fix-for-cabal-3.patch; + readline = appendPatch ./patches/readline-fix-for-cabal-3.patch super.readline; # 2020-12-05: this package requires a newer version of http-client, # but it still compiles with older version: @@ -1543,9 +1544,7 @@ self: super: { # Dependency to regex-tdfa-text can be removed for later regex-tdfa versions. # Fix protolude compilation error by applying patch from pull-request. # Override can be removed for the next release > 0.8.0. - yarn2nix = overrideCabal (super.yarn2nix.override { - regex-tdfa-text = null; - }) (attrs: { + yarn2nix = overrideCabal (attrs: { jailbreak = true; # remove dependency on regex-tdfa-text # which has been merged into regex-tdfa @@ -1560,6 +1559,8 @@ self: super: { includes = [ "*/ResolveLockfile.hs" ]; }) ]; + }) (super.yarn2nix.override { + regex-tdfa-text = null; }); # cabal-install switched to build type simple in 3.2.0.0 @@ -1570,26 +1571,26 @@ self: super: { # override. # The commit that introduced this change: # https://github.com/haskell/cabal/commit/91ac075930c87712eeada4305727a4fa651726e7 - cabal-install = overrideCabal super.cabal-install (old: { + cabal-install = overrideCabal (old: { postInstall = old.postInstall + '' mkdir -p "$out/share/man/man1" "$out/bin/cabal" man --raw > "$out/share/man/man1/cabal.1" ''; - }); + }) super.cabal-install; # while waiting for a new release: https://github.com/brendanhay/amazonka/pull/572 - amazonka = appendPatches (doJailbreak super.amazonka) [ + amazonka = appendPatches [ (pkgs.fetchpatch { stripLen = 1; url = "https://github.com/brendanhay/amazonka/commit/43ddd87b1ebd6af755b166e16336259ec025b337.patch"; sha256 = "1x9l5xgvrh908di6whpavyp08cys11v3yn6rc21zw87xiyigdbi3"; }) - ]; + ] (doJailbreak super.amazonka); # Test suite does not compile. feed = dontCheck super.feed; - spacecookie = overrideCabal super.spacecookie (old: { + spacecookie = overrideCabal (old: { buildTools = (old.buildTools or []) ++ [ pkgs.buildPackages.installShellFiles ]; # let testsuite discover the resulting binary preCheck = '' @@ -1599,7 +1600,7 @@ self: super: { postInstall = '' installManPage docs/man/* '' + (old.postInstall or ""); - }); + }) super.spacecookie; # Patch and jailbreak can be removed at next release, chatter > 0.9.1.0 # * Remove dependency on regex-tdfa-text @@ -1607,11 +1608,11 @@ self: super: { # * Disable test suite which doesn't compile # https://github.com/creswick/chatter/issues/38 chatter = appendPatch - (dontCheck (doJailbreak (super.chatter.override { regex-tdfa-text = null; }))) (pkgs.fetchpatch { url = "https://github.com/creswick/chatter/commit/e8c15a848130d7d27b8eb5e73e8a0db1366b2e62.patch"; sha256 = "1dzak8d12h54vss5fxnrclygz0fz9ygbqvxd5aifz5n3vrwwpj3g"; - }); + }) + (dontCheck (doJailbreak (super.chatter.override { regex-tdfa-text = null; }))); # test suite doesn't compile anymore due to changed hunit/tasty APIs fullstop = dontCheck super.fullstop; @@ -1647,15 +1648,15 @@ self: super: { # Too strict version bounds on base16-bytestring and http-link-header. # This patch will be merged when next release comes. - github = appendPatch super.github (pkgs.fetchpatch { + github = appendPatch (pkgs.fetchpatch { url = "https://github.com/phadej/github/commit/514b175851dd7c4a9722ff203dd6f652a15d33e8.patch"; sha256 = "0pmx54xd7ah85y9mfi5366wbnwrp918j0wbx8yw8hrdac92qi4gh"; - }); + }) super.github; # list `modbus` in librarySystemDepends, correct to `libmodbus` - libmodbus = overrideCabal super.libmodbus (drv: { + libmodbus = overrideCabal (drv: { librarySystemDepends = [ pkgs.libmodbus ]; - }); + }) super.libmodbus; # 2021-04-02: Outdated optparse-applicative bound is fixed but not realeased on upstream. trial-optparse-applicative = assert super.trial-optparse-applicative.version == "0.0.0.0"; doJailbreak super.trial-optparse-applicative; @@ -1665,18 +1666,18 @@ self: super: { # 2021-04-02: iCalendar is basically unmaintained. # There are PRs for bumping the bounds: https://github.com/chrra/iCalendar/pull/46 - iCalendar = overrideCabal (doJailbreak super.iCalendar) { + iCalendar = overrideCabal { # Overriding bounds behind a cabal flag preConfigure = ''substituteInPlace iCalendar.cabal --replace "network >=2.6 && <2.7" "network -any"''; - }; + } (doJailbreak super.iCalendar); # Apply patch from master relaxing the version bounds on tasty. # Can be removed at next release (current is 0.10.1.0). - ginger = appendPatch super.ginger + ginger = appendPatch (pkgs.fetchpatch { url = "https://github.com/tdammers/ginger/commit/bd8cb39c1853d4fb4f663c4c201884575906acea.patch"; sha256 = "1rdy53k0384g52bnc59j1f0i13hr4lbnbksfsabr4av6zmw9wmzf"; - }); + }) super.ginger; # Too strict version bounds on cryptonite # https://github.com/obsidiansystems/haveibeenpwned/issues/7 @@ -1711,7 +1712,7 @@ self: super: { # is merged and released: # * https://gitlab.haskell.org/ghc/ghc/-/issues/19638 # * https://gitlab.haskell.org/ghc/ghc/-/merge_requests/5454 - ghc-bignum = overrideCabal super.ghc-bignum (old: { + ghc-bignum = overrideCabal (old: { configureFlags = (old.configureFlags or []) ++ [ "-f" "Native" ]; patches = (old.patches or []) ++ [ (pkgs.fetchpatch { @@ -1720,7 +1721,7 @@ self: super: { stripLen = 2; }) ]; - }); + }) super.ghc-bignum; # 2021-04-09: outdated base and alex-tools # PR pending https://github.com/glguy/language-lua/pull/6 @@ -1735,19 +1736,19 @@ self: super: { lzma-static = doJailbreak super.lzma-static; # Fix haddock errors: https://github.com/koalaman/shellcheck/issues/2216 - ShellCheck = appendPatch super.ShellCheck (pkgs.fetchpatch { + ShellCheck = appendPatch (pkgs.fetchpatch { url = "https://github.com/koalaman/shellcheck/commit/9e60b3ea841bcaf48780bfcfc2e44aa6563a62de.patch"; sha256 = "1vmg8mmmnph34x7y0mhkcd5nzky8f1rh10pird750xbkp9zlk099"; excludes = ["test/buildtest"]; - }); + }) super.ShellCheck; # Too strict version bounds on base: # https://github.com/obsidiansystems/database-id/issues/1 database-id-class = doJailbreak super.database-id-class; - cabal2nix-unstable = overrideCabal super.cabal2nix-unstable { + cabal2nix-unstable = overrideCabal { passthru.updateScript = ../../../maintainers/scripts/haskell/update-cabal2nix-unstable.sh; - }; + } super.cabal2nix-unstable; # Too strict version bounds on base # https://github.com/gibiansky/IHaskell/issues/1217 @@ -1756,37 +1757,38 @@ self: super: { # Fixes too strict version bounds on regex libraries # Presumably to be removed at the next release - yi-language = appendPatch super.yi-language (pkgs.fetchpatch { + yi-language = appendPatch (pkgs.fetchpatch { url = "https://github.com/yi-editor/yi/commit/0d3bcb5ba4c237d57ce33a3dc39b63c56d890765.patch"; sha256 = "0r4mzngs0x1akqpajzx7ssa9rax977fvj5ra8d3grfbpx6z0nm01"; includes = [ "yi-language.cabal" ]; stripLen = 2; extraPrefix = ""; - }); + }) super.yi-language; # https://github.com/ghcjs/jsaddle/issues/123 - jsaddle = overrideCabal super.jsaddle (drv: { + jsaddle = overrideCabal (drv: { # lift conditional version constraint on ref-tf postPatch = '' sed -i 's/ref-tf.*,/ref-tf,/' jsaddle.cabal '' + (drv.postPatch or ""); - }); + }) super.jsaddle; # Tests need to lookup target triple x86_64-unknown-linux # https://github.com/llvm-hs/llvm-hs/issues/334 - llvm-hs = overrideCabal super.llvm-hs { + llvm-hs = overrideCabal { doCheck = pkgs.stdenv.targetPlatform.system == "x86_64-linux"; - }; + } super.llvm-hs; # * Fix build failure by picking patch from 8.5, we need # this version of sbv for petrinizer # * Pin version of crackNum that still exposes its library - sbv_7_13 = appendPatch (super.sbv_7_13.override { - crackNum = self.crackNum_2_4; - }) (pkgs.fetchpatch { - url = "https://github.com/LeventErkok/sbv/commit/57014b9c7c67dd9b63619a996e2c66e32c33c958.patch"; - sha256 = "10npa8nh2413n6p6qld795qfkbld08icm02bspmk93y0kabpgmgm"; - }); + sbv_7_13 = appendPatch (pkgs.fetchpatch { + url = "https://github.com/LeventErkok/sbv/commit/57014b9c7c67dd9b63619a996e2c66e32c33c958.patch"; + sha256 = "10npa8nh2413n6p6qld795qfkbld08icm02bspmk93y0kabpgmgm"; + }) + (super.sbv_7_13.override { + crackNum = self.crackNum_2_4; + }); # Too strict bounds on dimensional # https://github.com/enomsg/science-constants-dimensional/pull/1 @@ -1815,7 +1817,7 @@ 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 super.haskell-ci { + haskell-ci-unstable = (overrideSrc { version = "0.13.20211011"; src = pkgs.fetchFromGitHub { owner = "haskell-CI"; @@ -1823,23 +1825,23 @@ self: super: { rev = "c88e67e675bc4a990da53863c7fb42e67bcf9847"; sha256 = "1zhv1cg047lfyxfs3mvc73vv96pn240zaj7f2yl4lw5yj6y5rfk9"; }; - }).overrideScope (self: super: { + } super.haskell-ci).overrideScope (self: super: { attoparsec = self.attoparsec_0_14_2; Cabal = self.Cabal_3_6_2_0; }); - Frames-streamly = overrideCabal (super.Frames-streamly.override { relude = super.relude_1_0_0_1; }) (drv: { + Frames-streamly = overrideCabal (drv: { # https://github.com/adamConnerSax/Frames-streamly/issues/1 patchPhase = '' cat > example_data/acs100k.csv < 1.3.1.0 - hashable = overrideCabal super.hashable (drv: { + hashable = overrideCabal (drv: { patches = [ (pkgs.fetchpatch { url = "https://github.com/haskell-unordered-containers/hashable/commit/78fa8fdb4f8bec5d221f34110d6afa0d0a00b5f9.patch"; @@ -1887,7 +1889,7 @@ EOT prePatch = '' ${pkgs.buildPackages.dos2unix}/bin/dos2unix hashable.cabal '' + (drv.prePatch or ""); - }); + }) super.hashable; # Too strict bound on random # https://github.com/haskell-hvr/missingh/issues/56 @@ -1895,17 +1897,17 @@ EOT # Disable flaky tests # https://github.com/DavidEichmann/alpaca-netcode/issues/2 - alpaca-netcode = overrideCabal super.alpaca-netcode { + alpaca-netcode = overrideCabal { testFlags = [ "--pattern" "!/[NOCI]/" ]; - }; + } super.alpaca-netcode; # 2021-05-22: Tests fail sometimes (even consistently on hydra) # when running a fs-related test with >= 12 jobs. To work around # this, run tests with only a single job. # https://github.com/vmchale/libarchive/issues/20 - libarchive = overrideCabal super.libarchive { + libarchive = overrideCabal { testFlags = [ "-j1" ]; - }; + } super.libarchive; # unrestrict bounds for hashable and semigroups # https://github.com/HeinrichApfelmus/reactive-banana/issues/215 @@ -1989,16 +1991,16 @@ EOT # * https://gitlab.haskell.org/ghc/ghc/-/issues/17203 # * https://github.com/gtk2hs/gtk2hs/issues/305 # * https://github.com/gtk2hs/gtk2hs/issues/279 - gtk2hs-buildtools = appendConfigureFlags super.gtk2hs-buildtools + gtk2hs-buildtools = appendConfigureFlags (pkgs.lib.optionals (with pkgs.stdenv.hostPlatform; isAarch64 || isPowerPC) [ "--ghc-option=-O0" - ]); + ]) super.gtk2hs-buildtools; # https://github.com/ajscholl/basic-cpuid/pull/1 - basic-cpuid = appendPatch super.basic-cpuid (pkgs.fetchpatch { + basic-cpuid = appendPatch (pkgs.fetchpatch { url = "https://github.com/ajscholl/basic-cpuid/commit/2f2bd7a7b53103fb0cf26883f094db9d7659887c.patch"; sha256 = "0l15ccfdys100jf50s9rr4p0d0ikn53bkh7a9qlk9i0y0z5jc6x1"; - }); + }) super.basic-cpuid; # Needs Cabal >= 3.4 chs-cabal = super.chs-cabal.override { @@ -2014,7 +2016,7 @@ EOT lsp-types = doDistribute self.lsp-types_1_3_0_1; # Not running the "example" test because it requires a binary from lsps test # suite which is not part of the output of lsp. - lsp-test = doDistribute (overrideCabal self.lsp-test_0_14_0_1 (old: { testTarget = "tests func-test"; })); + lsp-test = doDistribute (overrideCabal (old: { testTarget = "tests func-test"; }) self.lsp-test_0_14_0_1); # 2021-09-14: Tests are flaky. hls-splice-plugin = dontCheck super.hls-splice-plugin; @@ -2041,22 +2043,22 @@ EOT # Fixes https://github.com/NixOS/nixpkgs/issues/140613 # https://github.com/recursion-schemes/recursion-schemes/issues/128 - recursion-schemes = appendPatch super.recursion-schemes ./patches/recursion-schemes-128.patch; + recursion-schemes = appendPatch ./patches/recursion-schemes-128.patch super.recursion-schemes; # Fix from https://github.com/brendanhay/gogol/pull/144 which has seen no release # Can't use fetchpatch as it required tweaking the line endings as the .cabal # file revision on hackage was gifted CRLF line endings - gogol-core = appendPatch super.gogol-core ./patches/gogol-core-144.patch; + gogol-core = appendPatch ./patches/gogol-core-144.patch super.gogol-core; # 2021-11-05: patch to permit our language-docker version # This is based on c931c0a9689cd6dff4d2083fa002414c1f08a586 from # language-docker upstream - hadolint = appendPatch (super.hadolint.override { - language-docker = self.language-docker_10_3_0; - }) (pkgs.fetchpatch { + hadolint = appendPatch (pkgs.fetchpatch { url = "https://github.com/hadolint/hadolint/commit/c931c0a9689cd6dff4d2083fa002414c1f08a586.patch"; sha256 = "1kv06hfn7lgrcrg56q8lq0pvdffqvmjbshazg3prlhl3kjs541f8"; excludes = [ "stack.yaml" "package.yaml" "hadolint.cabal" ]; + }) (super.hadolint.override { + language-docker = self.language-docker_10_3_0; }); # These should be updated in lockstep diff --git a/pkgs/development/haskell-modules/configuration-darwin.nix b/pkgs/development/haskell-modules/configuration-darwin.nix index 39e025cbd2687..d679ad88d67de 100644 --- a/pkgs/development/haskell-modules/configuration-darwin.nix +++ b/pkgs/development/haskell-modules/configuration-darwin.nix @@ -18,21 +18,21 @@ self: super: ({ __darwinAllowLocalNetworking = true; }); - halive = addBuildDepend super.halive darwin.apple_sdk.frameworks.AppKit; + halive = addBuildDepend darwin.apple_sdk.frameworks.AppKit super.halive; # Hakyll's tests are broken on Darwin (3 failures); and they require util-linux - hakyll = overrideCabal super.hakyll { + hakyll = overrideCabal { testToolDepends = []; doCheck = false; - }; + } super.hakyll; - barbly = addBuildDepend super.barbly darwin.apple_sdk.frameworks.AppKit; + barbly = addBuildDepend darwin.apple_sdk.frameworks.AppKit super.barbly; - double-conversion = addExtraLibrary super.double-conversion pkgs.libcxx; + double-conversion = addExtraLibrary pkgs.libcxx super.double-conversion; - apecs-physics = addPkgconfigDepends super.apecs-physics [ + apecs-physics = addPkgconfigDepends [ darwin.apple_sdk.frameworks.ApplicationServices - ]; + ] super.apecs-physics; # "erf table" test fails on Darwin # https://github.com/bos/math-functions/issues/63 @@ -40,11 +40,11 @@ self: super: ({ # darwin doesn't have sub-second resolution # https://github.com/hspec/mockery/issues/11 - mockery = overrideCabal super.mockery (drv: { + mockery = overrideCabal (drv: { preCheck = '' export TRAVIS=true '' + (drv.preCheck or ""); - }); + }) super.mockery; # https://github.com/ndmitchell/shake/issues/206 shake = dontCheck super.shake; @@ -53,18 +53,18 @@ self: super: ({ # gtk/gtk3 needs to be told on Darwin to use the Quartz # rather than X11 backend (see eg https://github.com/gtk2hs/gtk2hs/issues/249). - gtk3 = appendConfigureFlag super.gtk3 "-f have-quartz-gtk"; - gtk = appendConfigureFlag super.gtk "-f have-quartz-gtk"; + gtk3 = appendConfigureFlag "-f have-quartz-gtk" super.gtk3; + gtk = appendConfigureFlag "-f have-quartz-gtk" super.gtk; - OpenAL = addExtraLibrary super.OpenAL darwin.apple_sdk.frameworks.OpenAL; + OpenAL = addExtraLibrary darwin.apple_sdk.frameworks.OpenAL super.OpenAL; - al = overrideCabal super.al (drv: { + al = overrideCabal (drv: { libraryFrameworkDepends = [ darwin.apple_sdk.frameworks.OpenAL ] ++ (drv.libraryFrameworkDepends or []); - }); + }) super.al; - proteaaudio = addExtraLibrary super.proteaaudio darwin.apple_sdk.frameworks.AudioToolbox; + proteaaudio = addExtraLibrary darwin.apple_sdk.frameworks.AudioToolbox super.proteaaudio; # the system-fileio tests use canonicalizePath, which fails in the sandbox system-fileio = dontCheck super.system-fileio; @@ -80,17 +80,17 @@ self: super: ({ # TODO(matthewbauer): If someone really needs this to work in sandboxes, # I think we can add a propagatedImpureHost dep here, but I’m hoping to # get a proper fix available soonish. - x509-system = overrideCabal super.x509-system (drv: + x509-system = overrideCabal (drv: lib.optionalAttrs (!pkgs.stdenv.cc.nativeLibc) { postPatch = '' substituteInPlace System/X509/MacOS.hs --replace security /usr/bin/security '' + (drv.postPatch or ""); - }); + }) super.x509-system; # https://github.com/haskell-foundation/foundation/pull/412 foundation = dontCheck super.foundation; - llvm-hs = overrideCabal super.llvm-hs (oldAttrs: { + llvm-hs = overrideCabal (oldAttrs: { # One test fails on darwin. doCheck = false; # llvm-hs's Setup.hs file tries to add the lib/ directory from LLVM8 to @@ -100,20 +100,20 @@ self: super: ({ preCompileBuildDriver = '' substituteInPlace Setup.hs --replace "addToLdLibraryPath libDir" "pure ()" '' + (oldAttrs.preCompileBuildDriver or ""); - }); + }) super.llvm-hs; - yesod-bin = addBuildDepend super.yesod-bin darwin.apple_sdk.frameworks.Cocoa; + yesod-bin = addBuildDepend darwin.apple_sdk.frameworks.Cocoa super.yesod-bin; - hmatrix = addBuildDepend super.hmatrix darwin.apple_sdk.frameworks.Accelerate; + hmatrix = addBuildDepend darwin.apple_sdk.frameworks.Accelerate super.hmatrix; - blas-hs = overrideCabal super.blas-hs (drv: { + blas-hs = overrideCabal (drv: { libraryFrameworkDepends = [ darwin.apple_sdk.frameworks.Accelerate ] ++ (drv.libraryFrameworkDepends or []); - }); + }) super.blas-hs; # Ensure the necessary frameworks are propagatedBuildInputs on darwin - OpenGLRaw = overrideCabal super.OpenGLRaw (drv: { + OpenGLRaw = overrideCabal (drv: { librarySystemDepends = []; libraryHaskellDepends = drv.libraryHaskellDepends ++ [ darwin.apple_sdk.frameworks.OpenGL @@ -123,14 +123,14 @@ self: super: ({ frameworkPaths=$(IFS=, ; echo "''${frameworkPaths[@]}") configureFlags+=$(if [ -n "$frameworkPaths" ]; then echo -n "--ghc-options=-optl=$frameworkPaths"; fi) '' + (drv.preConfigure or ""); - }); - GLURaw = overrideCabal super.GLURaw (drv: { + }) super.OpenGLRaw; + GLURaw = overrideCabal (drv: { librarySystemDepends = []; libraryHaskellDepends = drv.libraryHaskellDepends ++ [ darwin.apple_sdk.frameworks.OpenGL ]; - }); - bindings-GLFW = overrideCabal super.bindings-GLFW (drv: { + }) super.GLURaw; + bindings-GLFW = overrideCabal (drv: { librarySystemDepends = []; libraryHaskellDepends = drv.libraryHaskellDepends ++ [ darwin.apple_sdk.frameworks.AGL @@ -141,13 +141,13 @@ self: super: ({ darwin.apple_sdk.frameworks.CoreVideo darwin.CF ]; - }); - OpenCL = overrideCabal super.OpenCL (drv: { + }) super.bindings-GLFW; + OpenCL = overrideCabal (drv: { librarySystemDepends = []; libraryHaskellDepends = drv.libraryHaskellDepends ++ [ darwin.apple_sdk.frameworks.OpenCL ]; - }); + }) super.OpenCL; # cabal2nix likes to generate dependencies on hinotify when hfsevents is # really required on darwin: https://github.com/NixOS/cabal2nix/issues/146. @@ -155,37 +155,37 @@ self: super: ({ # FSEvents API is very buggy and tests are unreliable. See # http://openradar.appspot.com/10207999 and similar issues. - fsnotify = addBuildDepend (dontCheck super.fsnotify) - darwin.apple_sdk.frameworks.Cocoa; + fsnotify = addBuildDepend darwin.apple_sdk.frameworks.Cocoa + (dontCheck super.fsnotify); - FractalArt = overrideCabal super.FractalArt (drv: { + FractalArt = overrideCabal (drv: { librarySystemDepends = [ darwin.libobjc darwin.apple_sdk.frameworks.AppKit ] ++ (drv.librarySystemDepends or []); - }); + }) super.FractalArt; - arbtt = overrideCabal super.arbtt (drv: { + arbtt = overrideCabal (drv: { librarySystemDepends = [ darwin.apple_sdk.frameworks.Foundation darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.IOKit ] ++ (drv.librarySystemDepends or []); - }); + }) super.arbtt; - HTF = overrideCabal super.HTF (drv: { + HTF = overrideCabal (drv: { # GNU find is not prefixed in stdenv postPatch = '' substituteInPlace scripts/local-htfpp --replace "find=gfind" "find=find" '' + (drv.postPatch or ""); - }); + }) super.HTF; # conditional dependency via a cabal flag - cas-store = overrideCabal super.cas-store (drv: { + cas-store = overrideCabal (drv: { libraryHaskellDepends = [ self.kqueue ] ++ (drv.libraryHaskellDepends or []); - }); + }) super.cas-store; # 2021-05-25: Tests fail and I have no way to debug them. hls-class-plugin = dontCheck super.hls-class-plugin; @@ -204,13 +204,13 @@ self: super: ({ # On darwin librt doesn't exist and will fail to link against, # however linking against it is also not necessary there - GLHUI = overrideCabal super.GLHUI (drv: { + GLHUI = overrideCabal (drv: { postPatch = '' substituteInPlace GLHUI.cabal --replace " rt" "" '' + (drv.postPatch or ""); - }); + }) super.GLHUI; - SDL-image = overrideCabal super.SDL-image (drv: { + SDL-image = overrideCabal (drv: { # Prevent darwin-specific configuration code path being taken # which doesn't work with nixpkgs' SDL libraries postPatch = '' @@ -220,18 +220,18 @@ self: super: ({ # Work around SDL_main.h redefining main to SDL_main ./patches/SDL-image-darwin-hsc.patch ]; - }); + }) super.SDL-image; # Prevent darwin-specific configuration code path being taken which # doesn't work with nixpkgs' SDL libraries - SDL-mixer = overrideCabal super.SDL-mixer (drv: { + SDL-mixer = overrideCabal (drv: { postPatch = '' substituteInPlace configure --replace xDarwin noDarwinSpecialCasing '' + (drv.postPatch or ""); - }); + }) super.SDL-mixer; # Work around SDL_main.h redefining main to SDL_main - SDL-ttf = appendPatch super.SDL-ttf ./patches/SDL-ttf-darwin-hsc.patch; + SDL-ttf = appendPatch ./patches/SDL-ttf-darwin-hsc.patch super.SDL-ttf; # Disable a bunch of test suites that fail because of darwin's case insensitive # file system: When a test suite has a test suite file that has the same name @@ -252,7 +252,7 @@ self: super: ({ acid-state = dontCheck super.acid-state; # Otherwise impure gcc is used, which is Apple's weird wrapper - c2hsc = addTestToolDepends super.c2hsc [ pkgs.gcc ]; + c2hsc = addTestToolDepends [ pkgs.gcc ] super.c2hsc; } // lib.optionalAttrs pkgs.stdenv.isAarch64 { # aarch64-darwin diff --git a/pkgs/development/haskell-modules/configuration-ghc-8.10.x.nix b/pkgs/development/haskell-modules/configuration-ghc-8.10.x.nix index 4d0c33208944a..d5523fd07cf85 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-8.10.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-8.10.x.nix @@ -72,20 +72,20 @@ self: super: { shower = doJailbreak super.shower; # The shipped Setup.hs file is broken. - csv = overrideCabal super.csv (drv: { preCompileBuildDriver = "rm Setup.hs"; }); + csv = overrideCabal (drv: { preCompileBuildDriver = "rm Setup.hs"; }) super.csv; # Apply patch from https://github.com/finnsson/template-helper/issues/12#issuecomment-611795375 to fix the build. - language-haskell-extract = appendPatch (doJailbreak super.language-haskell-extract) (pkgs.fetchpatch { + language-haskell-extract = appendPatch (pkgs.fetchpatch { name = "language-haskell-extract-0.2.4.patch"; url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/e48738ee1be774507887a90a0d67ad1319456afc/patches/language-haskell-extract-0.2.4.patch?inline=false"; sha256 = "0rgzrq0513nlc1vw7nw4km4bcwn4ivxcgi33jly4a7n3c1r32v1f"; - }); + }) (doJailbreak super.language-haskell-extract); # hnix 0.9.0 does not provide an executable for ghc < 8.10, so define completions here for now. hnix = generateOptparseApplicativeCompletion "hnix" - (overrideCabal super.hnix (drv: { + (overrideCabal (drv: { # executable is allowed for ghc >= 8.10 and needs repline executableHaskellDepends = drv.executableToolDepends or [] ++ [ self.repline ]; - })); + }) super.hnix); } diff --git a/pkgs/development/haskell-modules/configuration-ghc-8.6.x.nix b/pkgs/development/haskell-modules/configuration-ghc-8.6.x.nix index 99b53b9f14f3c..72df46f393e51 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-8.6.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-8.6.x.nix @@ -90,13 +90,13 @@ self: super: { haddock-library_1_7_0 = dontCheck super.haddock-library_1_7_0; # ghc versions prior to 8.8.x needs additional dependency to compile successfully. - ghc-lib-parser-ex = addBuildDepend super.ghc-lib-parser-ex self.ghc-lib-parser; + ghc-lib-parser-ex = addBuildDepend self.ghc-lib-parser super.ghc-lib-parser-ex; # This became a core library in ghc 8.10., so we don‘t have an "exception" attribute anymore. exceptions = super.exceptions_0_10_4; # Older compilers need the latest ghc-lib to build this package. - hls-hlint-plugin = addBuildDepend super.hls-hlint-plugin self.ghc-lib; + hls-hlint-plugin = addBuildDepend self.ghc-lib super.hls-hlint-plugin; # vector 0.12.2 indroduced doctest checks that don‘t work on older compilers vector = dontCheck super.vector; diff --git a/pkgs/development/haskell-modules/configuration-ghc-8.8.x.nix b/pkgs/development/haskell-modules/configuration-ghc-8.8.x.nix index 25d8e44b4545a..db7ae186b80f8 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-8.8.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-8.8.x.nix @@ -85,10 +85,10 @@ self: super: { vault = dontHaddock super.vault; # https://github.com/snapframework/snap-core/issues/288 - snap-core = overrideCabal super.snap-core (drv: { prePatch = "substituteInPlace src/Snap/Internal/Core.hs --replace 'fail = Fail.fail' ''"; }); + snap-core = overrideCabal (drv: { prePatch = "substituteInPlace src/Snap/Internal/Core.hs --replace 'fail = Fail.fail' ''"; }) super.snap-core; # Upstream ships a broken Setup.hs file. - csv = overrideCabal super.csv (drv: { prePatch = "rm Setup.hs"; }); + csv = overrideCabal (drv: { prePatch = "rm Setup.hs"; }) super.csv; # https://github.com/kowainik/relude/issues/241 relude = dontCheck super.relude; @@ -120,10 +120,10 @@ self: super: { # ghc versions which don‘t match the ghc-lib-parser-ex version need the # additional dependency to compile successfully. - ghc-lib-parser-ex = addBuildDepend super.ghc-lib-parser-ex self.ghc-lib-parser; + ghc-lib-parser-ex = addBuildDepend self.ghc-lib-parser super.ghc-lib-parser-ex; # Older compilers need the latest ghc-lib to build this package. - hls-hlint-plugin = addBuildDepend super.hls-hlint-plugin self.ghc-lib; + hls-hlint-plugin = addBuildDepend self.ghc-lib super.hls-hlint-plugin; # vector 0.12.2 indroduced doctest checks that don‘t work on older compilers vector = dontCheck super.vector; diff --git a/pkgs/development/haskell-modules/configuration-ghc-9.0.x.nix b/pkgs/development/haskell-modules/configuration-ghc-9.0.x.nix index 6f7c794db2135..4b0c0754bb88d 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-9.0.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-9.0.x.nix @@ -55,10 +55,10 @@ self: super: { dec = doJailbreak super.dec; ed25519 = doJailbreak super.ed25519; hackage-security = doJailbreak super.hackage-security; - hashable = overrideCabal (doJailbreak (dontCheck super.hashable)) (drv: { postPatch = "sed -i -e 's,integer-gmp .*<1.1,integer-gmp < 2,' hashable.cabal"; }); + hashable = overrideCabal (drv: { postPatch = "sed -i -e 's,integer-gmp .*<1.1,integer-gmp < 2,' hashable.cabal"; }) (doJailbreak (dontCheck super.hashable)); hashable-time = doJailbreak super.hashable-time; - HTTP = overrideCabal (doJailbreak super.HTTP) (drv: { postPatch = "sed -i -e 's,! Socket,!Socket,' Network/TCP.hs"; }); - integer-logarithms = overrideCabal (doJailbreak super.integer-logarithms) (drv: { postPatch = "sed -i -e 's,integer-gmp <1.1,integer-gmp < 2,' integer-logarithms.cabal"; }); + HTTP = overrideCabal (drv: { postPatch = "sed -i -e 's,! Socket,!Socket,' Network/TCP.hs"; }) (doJailbreak super.HTTP); + integer-logarithms = overrideCabal (drv: { postPatch = "sed -i -e 's,integer-gmp <1.1,integer-gmp < 2,' integer-logarithms.cabal"; }) (doJailbreak super.integer-logarithms); lukko = doJailbreak super.lukko; parallel = doJailbreak super.parallel; primitive = doJailbreak (dontCheck super.primitive); @@ -87,15 +87,15 @@ self: super: { generic-lens_2_2_0_0 = dontCheck super.generic-lens_2_2_0_0; # Apply patches from head.hackage. - alex = appendPatch (dontCheck super.alex) (pkgs.fetchpatch { + alex = appendPatch (pkgs.fetchpatch { url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/fe192e12b88b09499d4aff0e562713e820544bd6/patches/alex-3.2.6.patch"; sha256 = "1rzs764a0nhx002v4fadbys98s6qblw4kx4g46galzjf5f7n2dn4"; - }); + }) (dontCheck super.alex); doctest = dontCheck (doJailbreak super.doctest_0_18_1); - language-haskell-extract = appendPatch (doJailbreak super.language-haskell-extract) (pkgs.fetchpatch { + language-haskell-extract = appendPatch (pkgs.fetchpatch { url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/master/patches/language-haskell-extract-0.2.4.patch"; sha256 = "0rgzrq0513nlc1vw7nw4km4bcwn4ivxcgi33jly4a7n3c1r32v1f"; - }); + }) (doJailbreak super.language-haskell-extract); # The test suite depends on ChasingBottoms, which is broken with ghc-9.0.x. unordered-containers = dontCheck super.unordered-containers; @@ -131,15 +131,15 @@ self: super: { # Will probably be needed for brittany support # https://github.com/lspitzner/czipwith/pull/2 - #czipwith = appendPatch super.czipwith + #czipwith = appendPatch # (pkgs.fetchpatch { # url = "https://github.com/lspitzner/czipwith/commit/b6245884ae83e00dd2b5261762549b37390179f8.patch"; # sha256 = "08rpppdldsdwzb09fmn0j55l23pwyls2dyzziw3yjc1cm0j5vic5"; - # }); + # }) super.czipwith; # 2021-09-18: https://github.com/mokus0/th-extras/pull/8 # Release is missing, but asked for in the above PR. - th-extras = overrideCabal super.th-extras (old: { + th-extras = overrideCabal (old: { version = assert old.version == "0.0.0.4"; "unstable-2021-09-18"; src = pkgs.fetchFromGitHub { owner = "mokus0"; @@ -148,22 +148,22 @@ self: super: { sha256 = "045f36yagrigrggvyb96zqmw8y42qjsllhhx2h20q25sk5h44xsd"; }; libraryHaskellDepends = old.libraryHaskellDepends ++ [self.th-abstraction]; - }); + }) super.th-extras; # 2021-09-18: GHC 9 compat release is missing # Issue: https://github.com/obsidiansystems/dependent-sum/issues/65 - dependent-sum-template = dontCheck (appendPatch super.dependent-sum-template + dependent-sum-template = dontCheck (appendPatch (pkgs.fetchpatch { url = "https://github.com/obsidiansystems/dependent-sum/commit/8cf4c7fbc3bfa2be475a17bb7c94a1e1e9a830b5.patch"; sha256 = "02wyy0ciicq2x8lw4xxz3x5i4a550mxfidhm2ihh60ni6am498ff"; stripLen = 2; extraPrefix = ""; - })); + }) super.dependent-sum-template); # 2021-09-18: cabal2nix does not detect the need for ghc-api-compat. - hiedb = overrideCabal super.hiedb (old: { + hiedb = overrideCabal (old: { libraryHaskellDepends = old.libraryHaskellDepends ++ [self.ghc-api-compat]; - }); + }) super.hiedb; # 2021-09-18: Need path >= 0.9.0 for ghc 9 compat path = self.path_0_9_0; @@ -174,16 +174,7 @@ self: super: { hls-ormolu-plugin = doJailbreak super.hls-ormolu-plugin; # 2021-09-18: The following plugins don‘t work yet on ghc9. - haskell-language-server = appendConfigureFlags (super.haskell-language-server.override { - hls-tactics-plugin = null; # No upstream support, generic-lens-core fail - hls-splice-plugin = null; # No upstream support in hls 1.4.0, should be fixed in 1.5 - hls-refine-imports-plugin = null; # same issue es splice-plugin - hls-class-plugin = null; # No upstream support - - hls-fourmolu-plugin = null; # No upstream support, needs new fourmolu release - hls-stylish-haskell-plugin = null; # No upstream support - hls-brittany-plugin = null; # No upstream support, needs new brittany release - }) [ + haskell-language-server = appendConfigureFlags [ "-f-tactic" "-f-splice" "-f-refineimports" @@ -192,5 +183,14 @@ self: super: { "-f-fourmolu" "-f-brittany" "-f-stylishhaskell" - ]; + ] (super.haskell-language-server.override { + hls-tactics-plugin = null; # No upstream support, generic-lens-core fail + hls-splice-plugin = null; # No upstream support in hls 1.4.0, should be fixed in 1.5 + hls-refine-imports-plugin = null; # same issue es splice-plugin + hls-class-plugin = null; # No upstream support + + hls-fourmolu-plugin = null; # No upstream support, needs new fourmolu release + hls-stylish-haskell-plugin = null; # No upstream support + hls-brittany-plugin = null; # No upstream support, needs new brittany release + }); } diff --git a/pkgs/development/haskell-modules/configuration-ghc-9.2.x.nix b/pkgs/development/haskell-modules/configuration-ghc-9.2.x.nix index 8a09f9997efb2..127dd4d7652e3 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-9.2.x.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-9.2.x.nix @@ -44,50 +44,50 @@ self: super: { xhtml = null; # Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/20594 - tf-random = overrideCabal super.tf-random { + tf-random = overrideCabal { doHaddock = !pkgs.stdenv.isAarch64; - }; + } super.tf-random; - aeson = appendPatch (doJailbreak super.aeson) (pkgs.fetchpatch { + aeson = appendPatch (pkgs.fetchpatch { url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/dfd024c9a336c752288ec35879017a43bd7e85a0/patches/aeson-1.5.6.0.patch"; sha256 = "07rk7f0lhgilxvbg2grpl1p5x25wjf9m7a0wqmi2jr0q61p9a0nl"; # The revision information is newer than that included in the patch excludes = ["*.cabal"]; - }); + }) (doJailbreak super.aeson); # Tests use Data.Semigroup.Option aeson_2_0_1_0 = dontCheck (doJailbreak super.aeson_2_0_1_0); - basement = overrideCabal (appendPatch super.basement (pkgs.fetchpatch { - url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/dfd024c9a336c752288ec35879017a43bd7e85a0/patches/basement-0.0.12.patch"; - sha256 = "0c8n2krz827cv87p3vb1vpl3v0k255aysjx9lq44gz3z1dhxd64z"; - })) (drv: { + basement = overrideCabal (drv: { # This is inside a conditional block so `doJailbreak` doesn't work postPatch = "sed -i -e 's,<4.16,<4.17,' basement.cabal"; - }); + }) (appendPatch (pkgs.fetchpatch { + url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/dfd024c9a336c752288ec35879017a43bd7e85a0/patches/basement-0.0.12.patch"; + sha256 = "0c8n2krz827cv87p3vb1vpl3v0k255aysjx9lq44gz3z1dhxd64z"; + }) super.basement); - cereal = appendPatch (doJailbreak super.cereal) (pkgs.fetchpatch { + cereal = appendPatch (pkgs.fetchpatch { url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/dfd024c9a336c752288ec35879017a43bd7e85a0/patches/cereal-0.5.8.1.patch"; sha256 = "03v4nxwz9y6viaa8anxcmp4zdf2clczv4pf9fqq6lnpplpz5i128"; - }); + }) (doJailbreak super.cereal); # Tests fail because of typechecking changes conduit = dontCheck super.conduit; - cryptonite = appendPatch super.cryptonite (pkgs.fetchpatch { + cryptonite = appendPatch (pkgs.fetchpatch { url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/dfd024c9a336c752288ec35879017a43bd7e85a0/patches/cryptonite-0.29.patch"; sha256 = "1g48lrmqgd88hqvfq3klz7lsrpwrir2v1931myrhh6dy0d9pqj09"; - }); + }) super.cryptonite; # cabal-install needs more recent versions of Cabal cabal-install = (doJailbreak super.cabal-install).overrideScope (self: super: { Cabal = self.Cabal_3_6_2_0; }); - doctest = appendPatch (dontCheck (doJailbreak super.doctest_0_18_1)) (pkgs.fetchpatch { + doctest = appendPatch (pkgs.fetchpatch { url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/dfd024c9a336c752288ec35879017a43bd7e85a0/patches/doctest-0.18.1.patch"; sha256 = "030kdsk0fg08cgdcjpyv6z8ym1vkkrbd34aacs91y5hqzc9g79y1"; - }); + }) (dontCheck (doJailbreak super.doctest_0_18_1)); # Tests fail in GHC 9.2 extra = dontCheck super.extra; @@ -103,7 +103,7 @@ self: super: { binary-orphans = super.binary-orphans_1_0_2; ChasingBottoms = doJailbreak super.ChasingBottoms; constraints = doJailbreak super.constraints; - cpphs = overrideCabal super.cpphs (drv: { postPatch = "sed -i -e 's,time >=1.5 && <1.11,time >=1.5 \\&\\& <1.12,' cpphs.cabal";}); + cpphs = overrideCabal (drv: { postPatch = "sed -i -e 's,time >=1.5 && <1.11,time >=1.5 \\&\\& <1.12,' cpphs.cabal";}) super.cpphs; cryptohash-md5 = doJailbreak super.cryptohash-md5; cryptohash-sha1 = doJailbreak super.cryptohash-sha1; data-fix = doJailbreak super.data-fix; @@ -117,8 +117,8 @@ self: super: { hashable = super.hashable_1_4_0_0; hashable-time = doJailbreak super.hashable-time; hedgehog = doJailbreak super.hedgehog; - HTTP = overrideCabal (doJailbreak super.HTTP) (drv: { postPatch = "sed -i -e 's,! Socket,!Socket,' Network/TCP.hs"; }); - integer-logarithms = overrideCabal (doJailbreak super.integer-logarithms) (drv: { postPatch = "sed -i -e 's, <1.1, <1.3,' integer-logarithms.cabal"; }); + HTTP = overrideCabal (drv: { postPatch = "sed -i -e 's,! Socket,!Socket,' Network/TCP.hs"; }) (doJailbreak super.HTTP); + integer-logarithms = overrideCabal (drv: { postPatch = "sed -i -e 's, <1.1, <1.3,' integer-logarithms.cabal"; }) (doJailbreak super.integer-logarithms); indexed-traversable = doJailbreak super.indexed-traversable; indexed-traversable-instances = doJailbreak super.indexed-traversable-instances; lifted-async = doJailbreak super.lifted-async; @@ -126,7 +126,7 @@ self: super: { network = super.network_3_1_2_5; OneTuple = super.OneTuple_0_3_1; parallel = doJailbreak super.parallel; - polyparse = overrideCabal (doJailbreak super.polyparse) (drv: { postPatch = "sed -i -e 's, <0.11, <0.12,' polyparse.cabal"; }); + polyparse = overrideCabal (drv: { postPatch = "sed -i -e 's, <0.11, <0.12,' polyparse.cabal"; }) (doJailbreak super.polyparse); primitive = doJailbreak super.primitive; quickcheck-instances = super.quickcheck-instances_0_3_26_1; regex-posix = doJailbreak super.regex-posix; @@ -151,45 +151,45 @@ self: super: { witherable = doJailbreak super.witherable; zlib = doJailbreak super.zlib; - hpack = overrideCabal (doJailbreak super.hpack) (drv: { + hpack = overrideCabal (drv: { # Cabal 3.6 seems to preserve comments when reading, which makes this test fail # 2021-10-10: 9.2.1 is not yet supported (also no issue) testFlags = [ "--skip=/Hpack/renderCabalFile/is inverse to readCabalFile/" ] ++ drv.testFlags or []; - }); + }) (doJailbreak super.hpack); # Patch for TH code from head.hackage - vector-th-unbox = appendPatch (doJailbreak super.vector-th-unbox) (pkgs.fetchpatch { + vector-th-unbox = appendPatch (pkgs.fetchpatch { url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/dfd024c9a336c752288ec35879017a43bd7e85a0/patches/vector-th-unbox-0.2.1.9.patch"; sha256 = "02bvvy3hx3cf4y4dr64zl5pjvq8giwk4286j5g1n6k8ikyn2403p"; - }); + }) (doJailbreak super.vector-th-unbox); # Patch for TH code from head.hackage - invariant = appendPatch (doJailbreak super.invariant) (pkgs.fetchpatch { + invariant = appendPatch (pkgs.fetchpatch { url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/dfd024c9a336c752288ec35879017a43bd7e85a0/patches/invariant-0.5.4.patch"; sha256 = "17gg8ck4r6qmlbcbpbnqzksgf5q7i891zs6axfzhas6ajncylxvc"; - }); + }) (doJailbreak super.invariant); # base 4.15 support from head.hackage - lens = appendPatch (doJailbreak super.lens_5_0_1) (pkgs.fetchpatch { + lens = appendPatch (pkgs.fetchpatch { url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/dfd024c9a336c752288ec35879017a43bd7e85a0/patches/lens-5.0.1.patch"; sha256 = "1s8qqg7ymvv94dnfnr1ragx91chh9y7ydc4jx25zn361wbn00pv7"; - }); + }) (doJailbreak super.lens_5_0_1); # Syntax error in tests fixed in https://github.com/simonmar/alex/commit/84b29475e057ef744f32a94bc0d3954b84160760 alex = dontCheck super.alex; # Apply patches from head.hackage. - language-haskell-extract = appendPatch (doJailbreak super.language-haskell-extract) (pkgs.fetchpatch { + language-haskell-extract = appendPatch (pkgs.fetchpatch { url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/dfd024c9a336c752288ec35879017a43bd7e85a0/patches/language-haskell-extract-0.2.4.patch"; sha256 = "0w4y3v69nd3yafpml4gr23l94bdhbmx8xky48a59lckmz5x9fgxv"; - }); + }) (doJailbreak super.language-haskell-extract); - haskell-src-meta = appendPatch (doJailbreak super.haskell-src-meta) (pkgs.fetchpatch { + haskell-src-meta = appendPatch (pkgs.fetchpatch { url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/dfd024c9a336c752288ec35879017a43bd7e85a0/patches/haskell-src-meta-0.8.7.patch"; sha256 = "013k8hpxac226j47cdzgdf9a1j91kmm0cvv7n8zwlajbj3y9bzjp"; - }); + }) (doJailbreak super.haskell-src-meta); # Tests depend on `parseTime` which is no longer available hourglass = dontCheck super.hourglass; @@ -199,10 +199,10 @@ self: super: { random = dontCheck super.random_1_2_1; # 0.16.0 introduced support for GHC 9.0.x, stackage has 0.15.0 - memory = appendPatch super.memory_0_16_0 (pkgs.fetchpatch { + memory = appendPatch (pkgs.fetchpatch { url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/dfd024c9a336c752288ec35879017a43bd7e85a0/patches/memory-0.16.0.patch"; sha256 = "1kjganx729a6xfgfnrb3z7q6mvnidl042zrsd9n5n5a3i76nl5nl"; - }); + }) super.memory_0_16_0; # GHC 9.0.x doesn't like `import Spec (main)` in Main.hs # https://github.com/snoyberg/mono-traversable/issues/192 @@ -213,12 +213,12 @@ self: super: { retry = dontCheck super.retry; # Upper bound on `hashable` is too restrictive - semigroupoids = overrideCabal super.semigroupoids (drv: { postPatch = "sed -i -e 's,hashable >= 1.2.7.0 && < 1.4,hashable >= 1.2.7.0 \\&\\& < 1.5,' semigroupoids.cabal";}); + semigroupoids = overrideCabal (drv: { postPatch = "sed -i -e 's,hashable >= 1.2.7.0 && < 1.4,hashable >= 1.2.7.0 \\&\\& < 1.5,' semigroupoids.cabal";}) super.semigroupoids; - streaming-commons = appendPatch super.streaming-commons (pkgs.fetchpatch { + streaming-commons = appendPatch (pkgs.fetchpatch { url = "https://gitlab.haskell.org/ghc/head.hackage/-/raw/dfd024c9a336c752288ec35879017a43bd7e85a0/patches/streaming-commons-0.2.2.1.patch"; sha256 = "04wi1jskr3j8ayh88kkx4irvhhgz0i7aj6fblzijy0fygikvidpy"; - }); + }) super.streaming-commons; # Tests have a circular dependency on quickcheck-instances text-short = dontCheck super.text-short_0_1_4; diff --git a/pkgs/development/haskell-modules/configuration-ghc-head.nix b/pkgs/development/haskell-modules/configuration-ghc-head.nix index ca455a7c8929e..562a8fb44ba6e 100644 --- a/pkgs/development/haskell-modules/configuration-ghc-head.nix +++ b/pkgs/development/haskell-modules/configuration-ghc-head.nix @@ -75,6 +75,6 @@ self: super: { stack = doJailbreak super.stack; # Fix build with ghc 8.6.x. - git-annex = appendPatch super.git-annex ./patches/git-annex-fix-ghc-8.6.x-build.patch; + git-annex = appendPatch ./patches/git-annex-fix-ghc-8.6.x-build.patch super.git-annex; } diff --git a/pkgs/development/haskell-modules/configuration-ghcjs.nix b/pkgs/development/haskell-modules/configuration-ghcjs.nix index 953695e7b6cc2..87f83182ea006 100644 --- a/pkgs/development/haskell-modules/configuration-ghcjs.nix +++ b/pkgs/development/haskell-modules/configuration-ghcjs.nix @@ -38,17 +38,17 @@ self: super: # doctest doesn't work on ghcjs, but sometimes dontCheck doesn't seem to get rid of the dependency doctest = pkgs.lib.warn "ignoring dependency on doctest" null; - ghcjs-dom = overrideCabal super.ghcjs-dom (drv: { + ghcjs-dom = overrideCabal (drv: { libraryHaskellDepends = with self; [ ghcjs-base ghcjs-dom-jsffi text transformers ]; configureFlags = [ "-fjsffi" "-f-webkit" ]; - }); + }) super.ghcjs-dom; - ghcjs-dom-jsffi = overrideCabal super.ghcjs-dom-jsffi (drv: { + ghcjs-dom-jsffi = overrideCabal (drv: { libraryHaskellDepends = (drv.libraryHaskellDepends or []) ++ [ self.ghcjs-base self.text ]; broken = false; - }); + }) super.ghcjs-dom-jsffi; # https://github.com/Deewiant/glob/issues/39 Glob = dontCheck super.Glob; @@ -59,9 +59,9 @@ self: super: # uses doctest http-types = dontCheck super.http-types; - jsaddle = overrideCabal super.jsaddle (drv: { + jsaddle = overrideCabal (drv: { libraryHaskellDepends = (drv.libraryHaskellDepends or []) ++ [ self.ghcjs-base ]; - }); + }) super.jsaddle; # Tests hang, possibly some issue with tasty and race(async) usage in the nonTerminating tests logict = dontCheck super.logict; @@ -74,13 +74,13 @@ self: super: # Terminal test not supported on ghcjs QuickCheck = dontCheck super.QuickCheck; - reflex = overrideCabal super.reflex (drv: { + reflex = overrideCabal (drv: { libraryHaskellDepends = (drv.libraryHaskellDepends or []) ++ [ self.ghcjs-base ]; - }); + }) super.reflex; - reflex-dom = overrideCabal super.reflex-dom (drv: { + reflex-dom = overrideCabal (drv: { libraryHaskellDepends = removeLibraryHaskellDepends ["jsaddle-webkit2gtk"] (drv.libraryHaskellDepends or []); - }); + }) super.reflex-dom; # https://github.com/dreixel/syb/issues/21 syb = dontCheck super.syb; @@ -101,6 +101,9 @@ self: super: # still present here https://github.com/glguy/th-abstraction/issues/53 th-abstraction = dontCheck super.th-abstraction; + # https://github.com/haskell/vector/issues/410 + vector = appendPatch super.vector (../compilers/ghcjs/patches/vector-ghcjs-storable-set.patch); + # Need hedgehog for tests, which fails to compile due to dep on concurrent-output zenc = dontCheck super.zenc; } diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix index 5fc968ccddeba..2eaf820a3aa8e 100644 --- a/pkgs/development/haskell-modules/configuration-nix.nix +++ b/pkgs/development/haskell-modules/configuration-nix.nix @@ -43,10 +43,10 @@ with haskellLib; self: super: builtins.intersectAttrs super { # Apply NixOS-specific patches. - ghc-paths = appendPatch super.ghc-paths ./patches/ghc-paths-nix.patch; + ghc-paths = appendPatch ./patches/ghc-paths-nix.patch super.ghc-paths; # fix errors caused by hardening flags - epanet-haskell = disableHardening super.epanet-haskell ["format"]; + epanet-haskell = disableHardening ["format"] super.epanet-haskell; # Link the proper version. zeromq4-haskell = super.zeromq4-haskell.override { zeromq = pkgs.zeromq4; }; @@ -56,7 +56,7 @@ self: super: builtins.intersectAttrs super { mysql = dontCheck super.mysql; # CUDA needs help finding the SDK headers and libraries. - cuda = overrideCabal super.cuda (drv: { + cuda = overrideCabal (drv: { extraLibraries = (drv.extraLibraries or []) ++ [pkgs.linuxPackages.nvidia_x11]; configureFlags = (drv.configureFlags or []) ++ [ "--extra-lib-dirs=${pkgs.cudatoolkit.lib}/lib" @@ -65,84 +65,84 @@ self: super: builtins.intersectAttrs super { preConfigure = '' export CUDA_PATH=${pkgs.cudatoolkit} ''; - }); + }) super.cuda; - nvvm = overrideCabal super.nvvm (drv: { + nvvm = overrideCabal (drv: { preConfigure = '' export CUDA_PATH=${pkgs.cudatoolkit} ''; - }); + }) super.nvvm; - cufft = overrideCabal super.cufft (drv: { + cufft = overrideCabal (drv: { preConfigure = '' export CUDA_PATH=${pkgs.cudatoolkit} ''; - }); + }) super.cufft; # jni needs help finding libjvm.so because it's in a weird location. - jni = overrideCabal super.jni (drv: { + jni = overrideCabal (drv: { preConfigure = '' local libdir=( "${pkgs.jdk}/lib/openjdk/jre/lib/"*"/server" ) configureFlags+=" --extra-lib-dir=''${libdir[0]}" ''; - }); + }) super.jni; # The package doesn't know about the AL include hierarchy. # https://github.com/phaazon/al/issues/1 - al = appendConfigureFlag super.al "--extra-include-dirs=${pkgs.openal}/include/AL"; + al = appendConfigureFlag "--extra-include-dirs=${pkgs.openal}/include/AL" super.al; # Won't find it's header files without help. - sfml-audio = appendConfigureFlag super.sfml-audio "--extra-include-dirs=${pkgs.openal}/include/AL"; + sfml-audio = appendConfigureFlag "--extra-include-dirs=${pkgs.openal}/include/AL" super.sfml-audio; # avoid compiling twice by providing executable as a separate output (with small closure size) niv = enableSeparateBinOutput super.niv; ormolu = enableSeparateBinOutput super.ormolu; ghcid = enableSeparateBinOutput super.ghcid; - hzk = overrideCabal super.hzk (drv: { + hzk = overrideCabal (drv: { preConfigure = "sed -i -e /include-dirs/d hzk.cabal"; configureFlags = [ "--extra-include-dirs=${pkgs.zookeeper_mt}/include/zookeeper" ]; - }); + }) super.hzk; - haskakafka = overrideCabal super.haskakafka (drv: { + haskakafka = overrideCabal (drv: { preConfigure = "sed -i -e /extra-lib-dirs/d -e /include-dirs/d haskakafka.cabal"; configureFlags = [ "--extra-include-dirs=${pkgs.rdkafka}/include/librdkafka" ]; - }); + }) super.haskakafka; # library has hard coded directories that need to be removed. Reported upstream here https://github.com/haskell-works/hw-kafka-client/issues/32 - hw-kafka-client = dontCheck (overrideCabal super.hw-kafka-client (drv: { + hw-kafka-client = dontCheck (overrideCabal (drv: { preConfigure = "sed -i -e /extra-lib-dirs/d -e /include-dirs/d -e /librdkafka/d hw-kafka-client.cabal"; configureFlags = [ "--extra-include-dirs=${pkgs.rdkafka}/include/librdkafka" ]; - })); + }) super.hw-kafka-client); # Foreign dependency name clashes with another Haskell package. libarchive-conduit = super.libarchive-conduit.override { archive = pkgs.libarchive; }; # Heist's test suite requires system pandoc - heist = overrideCabal super.heist (drv: { + heist = overrideCabal (drv: { testToolDepends = [pkgs.pandoc]; - }); + }) super.heist; # https://github.com/NixOS/cabal2nix/issues/136 and https://github.com/NixOS/cabal2nix/issues/216 - gio = disableHardening (addPkgconfigDepend (addBuildTool super.gio self.buildHaskellPackages.gtk2hs-buildtools) pkgs.glib) ["fortify"]; - glib = disableHardening (addPkgconfigDepend (addBuildTool super.glib self.buildHaskellPackages.gtk2hs-buildtools) pkgs.glib) ["fortify"]; - gtk3 = disableHardening (super.gtk3.override { inherit (pkgs) gtk3; }) ["fortify"]; - gtk = let gtk1 = addBuildTool super.gtk self.buildHaskellPackages.gtk2hs-buildtools; - gtk2 = addPkgconfigDepend gtk1 pkgs.gtk2; - gtk3 = disableHardening gtk1 ["fortify"]; - gtk4 = if pkgs.stdenv.isDarwin then appendConfigureFlag gtk3 "-fhave-quartz-gtk" else gtk4; + gio = disableHardening ["fortify"] (addPkgconfigDepend pkgs.glib (addBuildTool self.buildHaskellPackages.gtk2hs-buildtools super.gio)); + glib = disableHardening ["fortify"] (addPkgconfigDepend pkgs.glib (addBuildTool self.buildHaskellPackages.gtk2hs-buildtools super.glib)); + gtk3 = disableHardening ["fortify"] (super.gtk3.override { inherit (pkgs) gtk3; }); + gtk = let gtk1 = addBuildTool self.buildHaskellPackages.gtk2hs-buildtools super.gtk; + gtk2 = addPkgconfigDepend pkgs.gtk2 gtk1; + gtk3 = disableHardening ["fortify"] gtk1; + gtk4 = if pkgs.stdenv.isDarwin then appendConfigureFlag "-fhave-quartz-gtk" gtk3 else gtk4; in gtk3; - gtksourceview2 = addPkgconfigDepend super.gtksourceview2 pkgs.gtk2; - gtk-traymanager = addPkgconfigDepend super.gtk-traymanager pkgs.gtk3; + gtksourceview2 = addPkgconfigDepend pkgs.gtk2 super.gtksourceview2; + gtk-traymanager = addPkgconfigDepend pkgs.gtk3 super.gtk-traymanager; # Add necessary reference to gtk3 package - gi-dbusmenugtk3 = addPkgconfigDepend super.gi-dbusmenugtk3 pkgs.gtk3; + gi-dbusmenugtk3 = addPkgconfigDepend pkgs.gtk3 super.gi-dbusmenugtk3; - hs-mesos = overrideCabal super.hs-mesos (drv: { + hs-mesos = overrideCabal (drv: { # Pass _only_ mesos; the correct protobuf is propagated. extraLibraries = [ pkgs.mesos ]; preConfigure = "sed -i -e /extra-lib-dirs/d -e 's|, /usr/include, /usr/local/include/mesos||' hs-mesos.cabal"; - }); + }) super.hs-mesos; # These packages try to access the network. amqp = dontCheck super.amqp; @@ -156,7 +156,7 @@ self: super: builtins.intersectAttrs super { hadoop-rpc = dontCheck super.hadoop-rpc; # http://hydra.cryp.to/build/527461/nixlog/2/raw hasql = dontCheck super.hasql; # http://hydra.cryp.to/build/502489/nixlog/4/raw hasql-transaction = dontCheck super.hasql-transaction; # wants to connect to postgresql - hjsonschema = overrideCabal super.hjsonschema (drv: { testTarget = "local"; }); + hjsonschema = overrideCabal (drv: { testTarget = "local"; }) super.hjsonschema; marmalade-upload = dontCheck super.marmalade-upload; # http://hydra.cryp.to/build/501904/nixlog/1/raw mongoDB = dontCheck super.mongoDB; network-transport-tcp = dontCheck super.network-transport-tcp; @@ -203,10 +203,10 @@ self: super: builtins.intersectAttrs super { mattermost-api = dontCheck super.mattermost-api; # Expect to find sendmail(1) in $PATH. - mime-mail = appendConfigureFlag super.mime-mail "--ghc-option=-DMIME_MAIL_SENDMAIL_PATH=\"sendmail\""; + mime-mail = appendConfigureFlag "--ghc-option=-DMIME_MAIL_SENDMAIL_PATH=\"sendmail\"" super.mime-mail; # Help the test suite find system timezone data. - tz = overrideCabal super.tz (drv: { + tz = overrideCabal (drv: { preConfigure = "export TZDIR=${pkgs.tzdata}/share/zoneinfo"; patches = [ # Fix tests failing with libSystem, musl etc. due to a lack of @@ -218,37 +218,37 @@ self: super: builtins.intersectAttrs super { sha256 = "1f53w8k1vpy39hzalyykpvm946ykkarj2714w988jdp4c2c4l4cf"; }) ] ++ (drv.patches or []); - }); + }) super.tz; # Nix-specific workaround - xmonad = appendPatch (dontCheck super.xmonad) ./patches/xmonad-nix.patch; + xmonad = appendPatch ./patches/xmonad-nix.patch (dontCheck super.xmonad); # wxc supports wxGTX >= 3.0, but our current default version points to 2.8. # http://hydra.cryp.to/build/1331287/log/raw - wxc = (addBuildDepend super.wxc self.split).override { wxGTK = pkgs.wxGTK30; }; + wxc = (addBuildDepend self.split super.wxc).override { wxGTK = pkgs.wxGTK30; }; wxcore = super.wxcore.override { wxGTK = pkgs.wxGTK30; }; # Test suite wants to connect to $DISPLAY. bindings-GLFW = dontCheck super.bindings-GLFW; gi-gtk-declarative = dontCheck super.gi-gtk-declarative; gi-gtk-declarative-app-simple = dontCheck super.gi-gtk-declarative-app-simple; - hsqml = dontCheck (addExtraLibraries (super.hsqml.override { qt5 = pkgs.qt5Full; }) [pkgs.libGLU pkgs.libGL]); + hsqml = dontCheck (addExtraLibraries [pkgs.libGLU pkgs.libGL] (super.hsqml.override { qt5 = pkgs.qt5Full; })); monomer = dontCheck super.monomer; # Wants to check against a real DB, Needs freetds - odbc = dontCheck (addExtraLibraries super.odbc [ pkgs.freetds ]); + odbc = dontCheck (addExtraLibraries [ pkgs.freetds ] super.odbc); # Tests attempt to use NPM to install from the network into # /homeless-shelter. Disabled. purescript = dontCheck super.purescript; # Hardcoded include path - poppler = overrideCabal super.poppler (drv: { + poppler = overrideCabal (drv: { postPatch = '' sed -i -e 's,glib/poppler.h,poppler.h,' poppler.cabal sed -i -e 's,glib/poppler.h,poppler.h,' Graphics/UI/Gtk/Poppler/Structs.hsc ''; - }); + }) super.poppler; # Uses OpenGL in testing caramia = dontCheck super.caramia; @@ -257,10 +257,10 @@ self: super: builtins.intersectAttrs super { llvm-hs = super.llvm-hs.override { llvm-config = pkgs.llvm_9; }; # Needs help finding LLVM. - spaceprobe = addBuildTool super.spaceprobe self.buildHaskellPackages.llvmPackages.llvm; + spaceprobe = addBuildTool self.buildHaskellPackages.llvmPackages.llvm super.spaceprobe; # Tries to run GUI in tests - leksah = dontCheck (overrideCabal super.leksah (drv: { + leksah = dontCheck (overrideCabal (drv: { executableSystemDepends = (drv.executableSystemDepends or []) ++ (with pkgs; [ gnome.adwaita-icon-theme # Fix error: Icon 'window-close' not present in theme ... wrapGAppsHook # Fix error: GLib-GIO-ERROR **: No GSettings schemas are installed on the system @@ -272,12 +272,10 @@ self: super: builtins.intersectAttrs super { substituteInPlace "$f" --replace "\"leksah-server\"" "\"${self.leksah-server}/bin/leksah-server\"" done ''; - })); + }) super.leksah); dyre = appendPatch - # dyre's tests appear to be trying to directly call GHC. - (dontCheck super.dyre) # Dyre needs special support for reading the NIX_GHC env var. This is # available upstream in https://github.com/willdonnelly/dyre/pull/43, but # hasn't been released to Hackage as of dyre-0.9.1. Likely included in @@ -285,46 +283,48 @@ self: super: builtins.intersectAttrs super { (pkgs.fetchpatch { url = "https://github.com/willdonnelly/dyre/commit/c7f29d321aae343d6b314f058812dffcba9d7133.patch"; sha256 = "10m22k35bi6cci798vjpy4c2l08lq5nmmj24iwp0aflvmjdgscdb"; - }); + }) + # dyre's tests appear to be trying to directly call GHC. + (dontCheck super.dyre); # https://github.com/edwinb/EpiVM/issues/13 # https://github.com/edwinb/EpiVM/issues/14 - epic = addExtraLibraries (addBuildTool super.epic self.buildHaskellPackages.happy) [pkgs.boehmgc pkgs.gmp]; + epic = addExtraLibraries [pkgs.boehmgc pkgs.gmp] (addBuildTool self.buildHaskellPackages.happy super.epic); # https://github.com/ekmett/wl-pprint-terminfo/issues/7 - wl-pprint-terminfo = addExtraLibrary super.wl-pprint-terminfo pkgs.ncurses; + wl-pprint-terminfo = addExtraLibrary pkgs.ncurses super.wl-pprint-terminfo; # https://github.com/bos/pcap/issues/5 - pcap = addExtraLibrary super.pcap pkgs.libpcap; + pcap = addExtraLibrary pkgs.libpcap super.pcap; # https://github.com/NixOS/nixpkgs/issues/53336 - greenclip = addExtraLibrary super.greenclip pkgs.xorg.libXdmcp; + greenclip = addExtraLibrary pkgs.xorg.libXdmcp super.greenclip; # The cabal files for these libraries do not list the required system dependencies. - miniball = overrideCabal super.miniball (drv: { + miniball = overrideCabal (drv: { librarySystemDepends = [ pkgs.miniball ]; - }); - SDL-image = overrideCabal super.SDL-image (drv: { + }) super.miniball; + SDL-image = overrideCabal (drv: { librarySystemDepends = [ pkgs.SDL pkgs.SDL_image ] ++ drv.librarySystemDepends or []; - }); - SDL-ttf = overrideCabal super.SDL-ttf (drv: { + }) super.SDL-image; + SDL-ttf = overrideCabal (drv: { librarySystemDepends = [ pkgs.SDL pkgs.SDL_ttf ]; - }); - SDL-mixer = overrideCabal super.SDL-mixer (drv: { + }) super.SDL-ttf; + SDL-mixer = overrideCabal (drv: { librarySystemDepends = [ pkgs.SDL pkgs.SDL_mixer ]; - }); - SDL-gfx = overrideCabal super.SDL-gfx (drv: { + }) super.SDL-mixer; + SDL-gfx = overrideCabal (drv: { librarySystemDepends = [ pkgs.SDL pkgs.SDL_gfx ]; - }); - SDL-mpeg = overrideCabal super.SDL-mpeg (drv: { + }) super.SDL-gfx; + SDL-mpeg = overrideCabal (drv: { configureFlags = (drv.configureFlags or []) ++ [ "--extra-lib-dirs=${pkgs.smpeg}/lib" "--extra-include-dirs=${pkgs.smpeg}/include/smpeg" ]; - }); + }) super.SDL-mpeg; # https://github.com/ivanperez-keera/hcwiid/pull/4 - hcwiid = overrideCabal super.hcwiid (drv: { + hcwiid = overrideCabal (drv: { configureFlags = (drv.configureFlags or []) ++ [ "--extra-lib-dirs=${pkgs.bluez.out}/lib" "--extra-lib-dirs=${pkgs.cwiid}/lib" @@ -332,16 +332,16 @@ self: super: builtins.intersectAttrs super { "--extra-include-dirs=${pkgs.bluez.dev}/include" ]; prePatch = '' sed -i -e "/Extra-Lib-Dirs/d" -e "/Include-Dirs/d" "hcwiid.cabal" ''; - }); + }) super.hcwiid; # cabal2nix doesn't pick up some of the dependencies. ginsu = let - g = addBuildDepend super.ginsu pkgs.perl; - g' = overrideCabal g (drv: { + g = addBuildDepend pkgs.perl super.ginsu; + g' = overrideCabal (drv: { executableSystemDepends = (drv.executableSystemDepends or []) ++ [ pkgs.ncurses ]; - }); + }) g; in g'; # Tests require `docker` command in PATH @@ -349,23 +349,23 @@ self: super: builtins.intersectAttrs super { docker = dontCheck super.docker; # https://github.com/deech/fltkhs/issues/16 - fltkhs = overrideCabal super.fltkhs (drv: { + fltkhs = overrideCabal (drv: { libraryToolDepends = (drv.libraryToolDepends or []) ++ [pkgs.buildPackages.autoconf]; librarySystemDepends = (drv.librarySystemDepends or []) ++ [pkgs.fltk13 pkgs.libGL pkgs.libjpeg]; - }); + }) super.fltkhs; # https://github.com/skogsbaer/hscurses/pull/26 - hscurses = overrideCabal super.hscurses (drv: { + hscurses = overrideCabal (drv: { librarySystemDepends = (drv.librarySystemDepends or []) ++ [ pkgs.ncurses ]; - }); + }) super.hscurses; # Looks like Avahi provides the missing library dnssd = super.dnssd.override { dns_sd = pkgs.avahi.override { withLibdnssdCompat = true; }; }; # tests depend on executable - ghcide = overrideCabal super.ghcide (drv: { + ghcide = overrideCabal (drv: { preCheck = ''export PATH="$PWD/dist/build/ghcide:$PATH"''; - }); + }) super.ghcide; # GLUT uses `dlopen` to link to freeglut, so we need to set the RUNPATH correctly for # it to find `libglut.so` from the nix store. We do this by patching GLUT.cabal to pkg-config @@ -377,22 +377,22 @@ self: super: builtins.intersectAttrs super { # # Additional note: nixpkgs' freeglut and macOS's OpenGL implementation do not cooperate, # so disable this on Darwin only - ${if pkgs.stdenv.isDarwin then null else "GLUT"} = addPkgconfigDepend (appendPatch super.GLUT ./patches/GLUT.patch) pkgs.freeglut; + ${if pkgs.stdenv.isDarwin then null else "GLUT"} = addPkgconfigDepend pkgs.freeglut (appendPatch ./patches/GLUT.patch super.GLUT); - libsystemd-journal = overrideCabal super.libsystemd-journal (old: { + libsystemd-journal = overrideCabal (old: { librarySystemDepends = old.librarySystemDepends or [] ++ [ pkgs.systemd ]; - }); + }) super.libsystemd-journal; # does not specify tests in cabal file, instead has custom runTest cabal hook, # so cabal2nix will not detect test dependencies. - either-unwrap = overrideCabal super.either-unwrap (drv: { + either-unwrap = overrideCabal (drv: { testHaskellDepends = (drv.testHaskellDepends or []) ++ [ self.test-framework self.test-framework-hunit ]; - }); + }) super.either-unwrap; # https://github.com/haskell-fswatch/hfsnotify/issues/62 fsnotify = dontCheck super.fsnotify; - hidapi = addExtraLibrary super.hidapi pkgs.udev; + hidapi = addExtraLibrary pkgs.udev super.hidapi; hs-GeoIP = super.hs-GeoIP.override { GeoIP = pkgs.geoipWithDatabase; }; @@ -402,45 +402,45 @@ self: super: builtins.intersectAttrs super { stackage-curator = dontCheck super.stackage-curator; # hardcodes /usr/bin/tr: https://github.com/snapframework/io-streams/pull/59 - io-streams = enableCabalFlag super.io-streams "NoInteractiveTests"; + io-streams = enableCabalFlag "NoInteractiveTests" super.io-streams; # requires autotools to build - secp256k1 = addBuildTools super.secp256k1 [ pkgs.buildPackages.autoconf pkgs.buildPackages.automake pkgs.buildPackages.libtool ]; + secp256k1 = addBuildTools [ pkgs.buildPackages.autoconf pkgs.buildPackages.automake pkgs.buildPackages.libtool ] super.secp256k1; # requires libsecp256k1 in pkg-config-depends - secp256k1-haskell = addPkgconfigDepend super.secp256k1-haskell pkgs.secp256k1; + secp256k1-haskell = addPkgconfigDepend pkgs.secp256k1 super.secp256k1-haskell; # tests require git and zsh - hapistrano = addBuildTools super.hapistrano [ pkgs.buildPackages.git pkgs.buildPackages.zsh ]; + hapistrano = addBuildTools [ pkgs.buildPackages.git pkgs.buildPackages.zsh ] super.hapistrano; # This propagates this to everything depending on haskell-gi-base - haskell-gi-base = addBuildDepend super.haskell-gi-base pkgs.gobject-introspection; + haskell-gi-base = addBuildDepend pkgs.gobject-introspection super.haskell-gi-base; # requires valid, writeable $HOME - hatex-guide = overrideCabal super.hatex-guide (drv: { + hatex-guide = overrideCabal (drv: { preConfigure = '' ${drv.preConfigure or ""} export HOME=$PWD ''; - }); + }) super.hatex-guide; # https://github.com/plow-technologies/servant-streaming/issues/12 servant-streaming-server = dontCheck super.servant-streaming-server; # https://github.com/haskell-servant/servant/pull/1238 servant-client-core = if (pkgs.lib.getVersion super.servant-client-core) == "0.16" then - appendPatch super.servant-client-core ./patches/servant-client-core-redact-auth-header.patch + appendPatch ./patches/servant-client-core-redact-auth-header.patch super.servant-client-core else super.servant-client-core; # tests run executable, relying on PATH # without this, tests fail with "Couldn't launch intero process" - intero = overrideCabal super.intero (drv: { + intero = overrideCabal (drv: { preCheck = '' export PATH="$PWD/dist/build/intero:$PATH" ''; - }); + }) super.intero; # Break infinite recursion cycle with criterion and network-uri. js-flot = dontCheck super.js-flot; @@ -470,23 +470,23 @@ self: super: builtins.intersectAttrs super { liquidhaskell = dontCheck (disableSharedExecutables super.liquidhaskell); # Without this override, the builds lacks pkg-config. - opencv-extra = addPkgconfigDepend super.opencv-extra pkgs.opencv3; + opencv-extra = addPkgconfigDepend pkgs.opencv3 super.opencv-extra; # Break cyclic reference that results in an infinite recursion. partial-semigroup = dontCheck super.partial-semigroup; colour = dontCheck super.colour; spatial-rotations = dontCheck super.spatial-rotations; - LDAP = dontCheck (overrideCabal super.LDAP (drv: { + LDAP = dontCheck (overrideCabal (drv: { librarySystemDepends = drv.librarySystemDepends or [] ++ [ pkgs.cyrus_sasl.dev ]; - })); + }) super.LDAP); # Expects z3 to be on path so we replace it with a hard # # The tests expect additional solvers on the path, replace the # available ones also with hard coded paths, and remove the missing # ones from the test. - sbv = overrideCabal super.sbv (drv: { + sbv = overrideCabal (drv: { postPatch = '' sed -i -e 's|"abc"|"${pkgs.abc-verifier}/bin/abc"|' Data/SBV/Provers/ABC.hs sed -i -e 's|"boolector"|"${pkgs.boolector}/bin/boolector"|' Data/SBV/Provers/Boolector.hs @@ -496,14 +496,14 @@ self: super: builtins.intersectAttrs super { sed -i -e 's|\[abc, boolector, cvc4, mathSAT, yices, z3, dReal\]|[abc, boolector, cvc4, yices, z3]|' SBVTestSuite/SBVConnectionTest.hs ''; - }); + }) super.sbv; # The test-suite requires a running PostgreSQL server. Frames-beam = dontCheck super.Frames-beam; # Compile manpages (which are in RST and are compiled with Sphinx). futhark = - overrideCabal (addBuildTools super.futhark (with pkgs.buildPackages; [makeWrapper python3Packages.sphinx])) + overrideCabal (_drv: { postBuild = (_drv.postBuild or "") + '' make -C docs man @@ -513,12 +513,13 @@ self: super: builtins.intersectAttrs super { mkdir -p $out/share/man/man1 mv docs/_build/man/*.1 $out/share/man/man1/ ''; - }); + }) + (addBuildTools (with pkgs.buildPackages; [makeWrapper python3Packages.sphinx]) super.futhark); git-annex = with pkgs; if (!stdenv.isLinux) then let path = lib.makeBinPath [ coreutils ]; - in overrideCabal (addBuildTool super.git-annex buildPackages.makeWrapper) (_drv: { + in overrideCabal (_drv: { # This is an instance of https://github.com/NixOS/nix/pull/1085 # Fails with: # gpg: can't connect to the agent: File name too long @@ -532,7 +533,7 @@ self: super: builtins.intersectAttrs super { wrapProgram $out/bin/git-annex \ --prefix PATH : "${path}" ''; - }) + }) (addBuildTool buildPackages.makeWrapper super.git-annex) else super.git-annex; # The test suite has undeclared dependencies on git. @@ -559,8 +560,8 @@ self: super: builtins.intersectAttrs super { # gtk2hs-buildtools is listed in setupHaskellDepends, but we # need it during the build itself, too. - cairo = addBuildTool super.cairo self.buildHaskellPackages.gtk2hs-buildtools; - pango = disableHardening (addBuildTool super.pango self.buildHaskellPackages.gtk2hs-buildtools) ["fortify"]; + cairo = addBuildTool self.buildHaskellPackages.gtk2hs-buildtools super.cairo; + pango = disableHardening ["fortify"] (addBuildTool self.buildHaskellPackages.gtk2hs-buildtools super.pango); spago = let @@ -584,7 +585,7 @@ self: super: builtins.intersectAttrs super { sha256 = "1hjdprm990vyxz86fgq14ajn0lkams7i00h8k2i2g1a0hjdwppq6"; }; - spagoWithPatches = appendPatch super.spago ( + spagoWithPatches = appendPatch ( # Spago needs a small patch to work with versions-5.0.0: # https://github.com/purescript/spago/pull/798 # This can probably be removed with >spago-0.20.3. @@ -592,14 +593,14 @@ self: super: builtins.intersectAttrs super { url = "https://github.com/purescript/spago/commit/dd4bf4413d9675c1c8065d24d0ed7b345c7fa5dd.patch"; sha256 = "1i1r3f4n9mlkckx15bfrdy5m7gjf0zx7ycwyqra6qn34zpcbzpmf"; } - ); + ) super.spago; spagoWithOverrides = spagoWithPatches.override { # spago has not yet been updated for the latest dhall. dhall = self.dhall_1_38_1; }; - spagoDocs = overrideCabal spagoWithOverrides (drv: { + spagoDocs = overrideCabal (drv: { postUnpack = (drv.postUnpack or "") + '' # Spago includes the following two files directly into the binary # with Template Haskell. They are fetched at build-time from the @@ -624,7 +625,7 @@ self: super: builtins.intersectAttrs super { "$sourceRoot/templates/docs-search-app-0.0.11.js" \ "$sourceRoot/templates/purescript-docs-search-0.0.11" ''; - }); + }) spagoWithOverrides; # Tests require network access. spagoWithoutChecks = dontCheck spagoDocs; @@ -638,11 +639,11 @@ self: super: builtins.intersectAttrs super { # mplayer-spot uses mplayer at runtime. mplayer-spot = let path = pkgs.lib.makeBinPath [ pkgs.mplayer ]; - in overrideCabal (addBuildTool super.mplayer-spot pkgs.buildPackages.makeWrapper) (oldAttrs: { + in overrideCabal (oldAttrs: { postInstall = '' wrapProgram $out/bin/mplayer-spot --prefix PATH : "${path}" ''; - }); + }) (addBuildTool pkgs.buildPackages.makeWrapper super.mplayer-spot); # break infinite recursion with base-orphans primitive = dontCheck super.primitive; @@ -650,12 +651,12 @@ self: super: builtins.intersectAttrs super { cut-the-crap = let path = pkgs.lib.makeBinPath [ pkgs.ffmpeg pkgs.youtube-dl ]; - in overrideCabal (addBuildTool super.cut-the-crap pkgs.buildPackages.makeWrapper) (_drv: { + in overrideCabal (_drv: { postInstall = '' wrapProgram $out/bin/cut-the-crap \ --prefix PATH : "${path}" ''; - }); + }) (addBuildTool pkgs.buildPackages.makeWrapper super.cut-the-crap); # Tests access homeless-shelter. hie-bios = dontCheck super.hie-bios; @@ -663,9 +664,9 @@ self: super: builtins.intersectAttrs super { # Compiling the readme throws errors and has no purpose in nixpkgs aeson-gadt-th = - disableCabalFlag (doJailbreak (super.aeson-gadt-th)) "build-readme"; + disableCabalFlag "build-readme" (doJailbreak super.aeson-gadt-th); - neuron = overrideCabal (super.neuron) (drv: { + neuron = overrideCabal (drv: { # neuron expects the neuron-search script to be in PATH at built-time. buildTools = [ pkgs.buildPackages.makeWrapper ]; preConfigure = '' @@ -678,14 +679,14 @@ self: super: builtins.intersectAttrs super { } PATH=$PATH:$out/bin ''; - }); + }) super.neuron; # Fix compilation of Setup.hs by removing the module declaration. # See: https://github.com/tippenein/guid/issues/1 - guid = overrideCabal (super.guid) (drv: { + guid = overrideCabal (drv: { prePatch = "sed -i '1d' Setup.hs"; # 1st line is module declaration, remove it doCheck = false; - }); + }) super.guid; # Tests disabled as recommended at https://github.com/luke-clifton/shh/issues/39 shh = dontCheck super.shh; @@ -696,16 +697,16 @@ self: super: builtins.intersectAttrs super { postgresql-libpq-notify = dontCheck super.postgresql-libpq-notify; postgresql-pure = dontCheck super.postgresql-pure; - retrie = overrideCabal super.retrie (drv: { + retrie = overrideCabal (drv: { testToolDepends = [ pkgs.git pkgs.mercurial ]; - }); + }) super.retrie; - nix-output-monitor = overrideCabal super.nix-output-monitor { + nix-output-monitor = overrideCabal { # Can't ran the golden-tests with nix, because they call nix testTarget = "unit-tests"; - }; + } super.nix-output-monitor; - haskell-language-server = overrideCabal super.haskell-language-server (drv: { + haskell-language-server = overrideCabal (drv: { postInstall = "ln -s $out/bin/haskell-language-server $out/bin/haskell-language-server-${self.ghc.version}"; testToolDepends = [ self.cabal-install pkgs.git ]; testTarget = "func-test"; # wrapper test accesses internet @@ -713,14 +714,14 @@ self: super: builtins.intersectAttrs super { export PATH=$PATH:$PWD/dist/build/haskell-language-server:$PWD/dist/build/haskell-language-server-wrapper export HOME=$TMPDIR ''; - }); + }) super.haskell-language-server; # tests depend on a specific version of solc hevm = dontCheck (doJailbreak super.hevm); # hadolint enables static linking by default in the cabal file, so we have to explicitly disable it. # https://github.com/hadolint/hadolint/commit/e1305042c62d52c2af4d77cdce5d62f6a0a3ce7b - hadolint = disableCabalFlag super.hadolint "static"; + hadolint = disableCabalFlag "static" super.hadolint; # Test suite tries to execute the build product "doctest-driver-gen", but it's not in $PATH. doctest-driver-gen = dontCheck super.doctest-driver-gen; @@ -729,7 +730,7 @@ self: super: builtins.intersectAttrs super { prune-juice = dontCheck super.prune-juice; # based on https://github.com/gibiansky/IHaskell/blob/aafeabef786154d81ab7d9d1882bbcd06fc8c6c4/release.nix - ihaskell = overrideCabal super.ihaskell (drv: { + ihaskell = overrideCabal (drv: { configureFlags = (drv.configureFlags or []) ++ [ # ihaskell's cabal file forces building a shared executable, # but without passing --enable-executable-dynamic, the RPATH @@ -741,152 +742,152 @@ self: super: builtins.intersectAttrs super { export PATH=$PWD/dist/build/ihaskell:$PATH export GHC_PACKAGE_PATH=$PWD/dist/package.conf.inplace/:$GHC_PACKAGE_PATH ''; - }); + }) super.ihaskell; # tests need to execute the built executable - stutter = overrideCabal super.stutter (drv: { + stutter = overrideCabal (drv: { preCheck = '' export PATH=dist/build/stutter:$PATH '' + (drv.preCheck or ""); - }); + }) super.stutter; # Install man page and generate shell completions pinboard-notes-backup = overrideCabal - (generateOptparseApplicativeCompletion "pnbackup" super.pinboard-notes-backup) (drv: { postInstall = '' install -D man/pnbackup.1 $out/share/man/man1/pnbackup.1 '' + (drv.postInstall or ""); - }); + }) + (generateOptparseApplicativeCompletion "pnbackup" super.pinboard-notes-backup); # set more accurate set of platforms instead of maintaining # an ever growing list of platforms to exclude via unsupported-platforms - cpuid = overrideCabal super.cpuid { + cpuid = overrideCabal { platforms = pkgs.lib.platforms.x86; - }; + } super.cpuid; # Pass the correct libarchive into the package. streamly-archive = super.streamly-archive.override { archive = pkgs.libarchive; }; # passes the -msse2 flag which only works on x86 platforms - hsignal = overrideCabal super.hsignal { + hsignal = overrideCabal { platforms = pkgs.lib.platforms.x86; - }; + } super.hsignal; # uses x86 intrinsics - blake3 = overrideCabal super.blake3 { + blake3 = overrideCabal { platforms = pkgs.lib.platforms.x86; - }; + } super.blake3; # uses x86 intrinsics, see also https://github.com/NixOS/nixpkgs/issues/122014 - crc32c = overrideCabal super.crc32c { + crc32c = overrideCabal { platforms = pkgs.lib.platforms.x86; - }; + } super.crc32c; # uses x86 intrinsics - seqalign = overrideCabal super.seqalign { + seqalign = overrideCabal { platforms = pkgs.lib.platforms.x86; - }; + } super.seqalign; # uses x86 intrinsics - geomancy = overrideCabal super.geomancy { + geomancy = overrideCabal { platforms = pkgs.lib.platforms.x86; - }; + } super.geomancy; - hls-brittany-plugin = overrideCabal super.hls-brittany-plugin (drv: { + hls-brittany-plugin = overrideCabal (drv: { testToolDepends = [ pkgs.git ]; preCheck = '' export HOME=$TMPDIR/home ''; - }); - hls-class-plugin = overrideCabal super.hls-class-plugin (drv: { + }) super.hls-brittany-plugin; + hls-class-plugin = overrideCabal (drv: { testToolDepends = [ pkgs.git ]; preCheck = '' export HOME=$TMPDIR/home ''; - }); - hls-ormolu-plugin = overrideCabal super.hls-ormolu-plugin (drv: { + }) super.hls-class-plugin; + hls-ormolu-plugin = overrideCabal (drv: { testToolDepends = [ pkgs.git ]; preCheck = '' export HOME=$TMPDIR/home ''; - }); - hls-fourmolu-plugin = overrideCabal super.hls-fourmolu-plugin (drv: { + }) super.hls-ormolu-plugin; + hls-fourmolu-plugin = overrideCabal (drv: { testToolDepends = [ pkgs.git ]; preCheck = '' export HOME=$TMPDIR/home ''; - }); - hls-module-name-plugin = overrideCabal super.hls-module-name-plugin (drv: { + }) super.hls-fourmolu-plugin; + hls-module-name-plugin = overrideCabal (drv: { testToolDepends = [ pkgs.git ]; preCheck = '' export HOME=$TMPDIR/home ''; - }); - hls-rename-plugin = overrideCabal super.hls-rename-plugin (drv: { + }) super.hls-module-name-plugin; + hls-rename-plugin = overrideCabal (drv: { testToolDepends = [ pkgs.git ]; preCheck = '' export HOME=$TMPDIR/home '' + (drv.preCheck or ""); - }); - hls-splice-plugin = overrideCabal super.hls-splice-plugin (drv: { + }) super.hls-rename-plugin; + hls-splice-plugin = overrideCabal (drv: { testToolDepends = [ pkgs.git ]; preCheck = '' export HOME=$TMPDIR/home ''; - }); - hls-floskell-plugin = overrideCabal super.hls-floskell-plugin (drv: { + }) super.hls-splice-plugin; + hls-floskell-plugin = overrideCabal (drv: { testToolDepends = [ pkgs.git ]; preCheck = '' export HOME=$TMPDIR/home ''; - }); - hls-pragmas-plugin = overrideCabal super.hls-pragmas-plugin (drv: { + }) super.hls-floskell-plugin; + hls-pragmas-plugin = overrideCabal (drv: { testToolDepends = [ pkgs.git ]; preCheck = '' export HOME=$TMPDIR/home ''; - }); - hiedb = overrideCabal super.hiedb (drv: { + }) super.hls-pragmas-plugin; + hiedb = overrideCabal (drv: { preCheck = '' export PATH=$PWD/dist/build/hiedb:$PATH ''; - }); - hls-call-hierarchy-plugin = overrideCabal super.hls-call-hierarchy-plugin (drv: { + }) super.hiedb; + hls-call-hierarchy-plugin = overrideCabal (drv: { preCheck = '' export HOME=$TMPDIR/home ''; - }); + }) super.hls-call-hierarchy-plugin; # Tests have file permissions expections that don‘t work with the nix store. hls-stylish-haskell-plugin = dontCheck super.hls-stylish-haskell-plugin; - hls-haddock-comments-plugin = overrideCabal super.hls-haddock-comments-plugin (drv: { + hls-haddock-comments-plugin = overrideCabal (drv: { testToolDepends = [ pkgs.git ]; preCheck = '' export HOME=$TMPDIR/home ''; - }); - hls-eval-plugin = overrideCabal super.hls-eval-plugin (drv: { + }) super.hls-haddock-comments-plugin; + hls-eval-plugin = overrideCabal (drv: { testToolDepends = [ pkgs.git ]; preCheck = '' export HOME=$TMPDIR/home ''; - }); + }) super.hls-eval-plugin; - taglib = overrideCabal super.taglib (drv: { + taglib = overrideCabal (drv: { librarySystemDepends = [ pkgs.zlib ] ++ (drv.librarySystemDepends or []); - }); + }) super.taglib; # uses x86 assembler - inline-asm = overrideCabal super.inline-asm { + inline-asm = overrideCabal { platforms = pkgs.lib.platforms.x86; - }; + } super.inline-asm; # uses x86 assembler in C bits - hw-prim-bits = overrideCabal super.hw-prim-bits { + hw-prim-bits = overrideCabal { platforms = pkgs.lib.platforms.x86; - }; + } super.hw-prim-bits; # random 1.2.0 has tests that indirectly depend on # itself causing an infinite recursion at evaluation @@ -897,7 +898,6 @@ self: super: builtins.intersectAttrs super { # not used to link against by anyone, we can make it’s closure smaller and # add its runtime dependencies in `haskellPackages` (as opposed to cabal2nix). cabal2nix-unstable = overrideCabal - (justStaticExecutables super.cabal2nix-unstable) (drv: { buildTools = (drv.buildTools or []) ++ [ pkgs.buildPackages.makeWrapper @@ -908,21 +908,22 @@ self: super: builtins.intersectAttrs super { pkgs.lib.makeBinPath [ pkgs.nix pkgs.nix-prefetch-scripts ] }" ''; - }); + }) + (justStaticExecutables super.cabal2nix-unstable); # test suite needs local redis daemon nri-redis = dontCheck super.nri-redis; # Make tophat find itself for _compiling_ its test suite - tophat = overrideCabal super.tophat (drv: { + tophat = overrideCabal (drv: { postPatch = '' sed -i 's|"tophat"|"./dist/build/tophat/tophat"|' app-test-bin/*.hs '' + (drv.postPatch or ""); - }); + }) super.tophat; # Runtime dependencies and CLI completion nvfetcher = generateOptparseApplicativeCompletion "nvfetcher" (overrideCabal - super.nvfetcher (drv: { + (drv: { # test needs network doCheck = false; buildTools = drv.buildTools or [ ] ++ [ pkgs.buildPackages.makeWrapper ]; @@ -931,16 +932,16 @@ self: super: builtins.intersectAttrs super { pkgs.lib.makeBinPath [ pkgs.nvchecker pkgs.nix-prefetch-git ] }" ''; - })); + }) super.nvfetcher); - rel8 = addTestToolDepend super.rel8 pkgs.postgresql; + rel8 = addTestToolDepend pkgs.postgresql super.rel8; cachix = generateOptparseApplicativeCompletion "cachix" super.cachix; # Enable extra optimisations which increase build time, but also # later compiler performance, so we should do this for user's benefit. # Flag added in Agda 2.6.2 - Agda = appendConfigureFlag super.Agda "-foptimise-heavily"; + Agda = appendConfigureFlag "-foptimise-heavily" super.Agda; # ats-format uses cli-setup in Setup.hs which is quite happy to write # to arbitrary files in $HOME. This doesn't either not achieve anything @@ -948,7 +949,7 @@ self: super: builtins.intersectAttrs super { # See also: https://hackage.haskell.org/package/cli-setup-0.2.1.4/docs/src/Distribution.CommandLine.html#setManpathGeneric ats-format = generateOptparseApplicativeCompletion "atsfmt" ( justStaticExecutables ( - overrideCabal super.ats-format (drv: { + overrideCabal (drv: { # use vanilla Setup.hs preCompileBuildDriver = '' cat > Setup.hs << EOF @@ -964,7 +965,7 @@ self: super: builtins.intersectAttrs super { postInstall = '' installManPage man/atsfmt.1 '' + (drv.postInstall or ""); - }) + }) super.ats-format ) ); @@ -974,10 +975,10 @@ 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 super.hashes { + hashes = overrideCabal { doCheck = with pkgs.stdenv; hostPlatform == buildPlatform && buildPlatform.isx86; - }; + } super.hashes; # procex relies on close_range which has been introduced in Linux 5.9, # the test suite seems to force the use of this feature (or the fallback @@ -985,7 +986,7 @@ self: super: builtins.intersectAttrs super { # Kernel < 5.9. To check for this, we use uname -r to obtain the Kernel # version and sort -V to compare against our minimum version. If the # Kernel turns out to be older, we disable the test suite. - procex = overrideCabal super.procex (drv: { + procex = overrideCabal (drv: { postConfigure = '' minimumKernel=5.9 higherVersion=`printf "%s\n%s\n" "$minimumKernel" "$(uname -r)" | sort -rV | head -n1` @@ -994,5 +995,5 @@ self: super: builtins.intersectAttrs super { unset doCheck fi '' + (drv.postConfigure or ""); - }); + }) super.procex; } diff --git a/pkgs/development/haskell-modules/configuration-tensorflow.nix b/pkgs/development/haskell-modules/configuration-tensorflow.nix index 4848cb6111f03..31c679f9b8421 100644 --- a/pkgs/development/haskell-modules/configuration-tensorflow.nix +++ b/pkgs/development/haskell-modules/configuration-tensorflow.nix @@ -17,7 +17,7 @@ let }; setTensorflowSourceRoot = dir: drv: - (overrideCabal drv (drv: { src = tensorflow-haskell; })) + (overrideCabal (drv: { src = tensorflow-haskell; }) drv) .overrideAttrs (_oldAttrs: {sourceRoot = "source/${dir}";}); in { diff --git a/pkgs/development/haskell-modules/lib.nix b/pkgs/development/haskell-modules/lib.nix index b0d036e0e3e81..5aa2d68652794 100644 --- a/pkgs/development/haskell-modules/lib.nix +++ b/pkgs/development/haskell-modules/lib.nix @@ -3,10 +3,18 @@ { pkgs, lib }: rec { + /* The same functionality as this haskell.lib, except that the derivation + being overridden is always the last parameter. This permits more natural + composition of several overrides, i.e. without having to nestle one call + between the function name and argument of another. haskell.lib.compose is + preferred for any new code. + */ + compose = import ./lib/compose.nix { inherit pkgs lib; }; + /* This function takes a file like `hackage-packages.nix` and constructs a full package set out of that. */ - makePackageSet = import ./make-package-set.nix; + makePackageSet = compose.makePackageSet; /* The function overrideCabal lets you alter the arguments to the mkDerivation function. @@ -34,47 +42,37 @@ rec { "https://github.com/bos/aeson#readme" */ - overrideCabal = drv: f: (drv.override (args: args // { - mkDerivation = drv: (args.mkDerivation drv).override f; - })) // { - overrideScope = scope: overrideCabal (drv.overrideScope scope) f; - }; + overrideCabal = drv: f: compose.overrideCabal f drv; # : Map Name (Either Path VersionNumber) -> HaskellPackageOverrideSet # Given a set whose values are either paths or version strings, produces # a package override set (i.e. (self: super: { etc. })) that sets # the packages named in the input set to the corresponding versions - packageSourceOverrides = - overrides: self: super: pkgs.lib.mapAttrs (name: src: - let isPath = x: builtins.substring 0 1 (toString x) == "/"; - generateExprs = if isPath src - then self.callCabal2nix - else self.callHackage; - in generateExprs name src {}) overrides; + packageSourceOverrides = compose.packageSourceOverrides; /* doCoverage modifies a haskell package to enable the generation and installation of a coverage report. See https://wiki.haskell.org/Haskell_program_coverage */ - doCoverage = drv: overrideCabal drv (drv: { doCoverage = true; }); + doCoverage = compose.doCoverage; /* dontCoverage modifies a haskell package to disable the generation and installation of a coverage report. */ - dontCoverage = drv: overrideCabal drv (drv: { doCoverage = false; }); + dontCoverage = compose.dontCoverage; /* doHaddock modifies a haskell package to enable the generation and installation of API documentation from code comments using the haddock tool. */ - doHaddock = drv: overrideCabal drv (drv: { doHaddock = true; }); + doHaddock = compose.doHaddock; /* dontHaddock modifies a haskell package to disable the generation and installation of API documentation from code comments using the haddock tool. */ - dontHaddock = drv: overrideCabal drv (drv: { doHaddock = false; }); + dontHaddock = compose.dontHaddock; /* doJailbreak enables the removal of version bounds from the cabal file. You may want to avoid this function. @@ -92,39 +90,39 @@ rec { https://github.com/peti/jailbreak-cabal/issues/7 has further details. */ - doJailbreak = drv: overrideCabal drv (drv: { jailbreak = true; }); + doJailbreak = compose.doJailbreak; /* dontJailbreak restores the use of the version bounds the check the use of dependencies in the package description. */ - dontJailbreak = drv: overrideCabal drv (drv: { jailbreak = false; }); + dontJailbreak = compose.dontJailbreak; /* doCheck enables dependency checking, compilation and execution of test suites listed in the package description file. */ - doCheck = drv: overrideCabal drv (drv: { doCheck = true; }); + doCheck = compose.doCheck; /* dontCheck disables dependency checking, compilation and execution of test suites listed in the package description file. */ - dontCheck = drv: overrideCabal drv (drv: { doCheck = false; }); + dontCheck = compose.dontCheck; /* doBenchmark enables dependency checking, compilation and execution for benchmarks listed in the package description file. */ - doBenchmark = drv: overrideCabal drv (drv: { doBenchmark = true; }); + doBenchmark = compose.doBenchmark; /* dontBenchmark disables dependency checking, compilation and execution for benchmarks listed in the package description file. */ - dontBenchmark = drv: overrideCabal drv (drv: { doBenchmark = false; }); + dontBenchmark = compose.dontBenchmark; /* doDistribute enables the distribution of binaries for the package via hydra. */ - doDistribute = drv: overrideCabal drv (drv: { hydraPlatforms = drv.platforms or ["i686-linux" "x86_64-linux" "x86_64-darwin"]; }); + doDistribute = compose.doDistribute; /* dontDistribute disables the distribution of binaries for the package via hydra. */ - dontDistribute = drv: overrideCabal drv (drv: { hydraPlatforms = []; }); + dontDistribute = compose.dontDistribute; /* appendConfigureFlag adds a single argument that will be passed to the cabal configure command, after the arguments that have been defined @@ -134,67 +132,67 @@ rec { > haskell.lib.appendConfigureFlag haskellPackages.servant "--profiling-detail=all-functions" */ - appendConfigureFlag = drv: x: appendConfigureFlags drv [x]; - appendConfigureFlags = drv: xs: overrideCabal drv (drv: { configureFlags = (drv.configureFlags or []) ++ xs; }); + appendConfigureFlag = drv: x: compose.appendConfigureFlag x drv; + appendConfigureFlags = drv: xs: compose.appendConfigureFlags xs drv; - appendBuildFlag = drv: x: overrideCabal drv (drv: { buildFlags = (drv.buildFlags or []) ++ [x]; }); - appendBuildFlags = drv: xs: overrideCabal drv (drv: { buildFlags = (drv.buildFlags or []) ++ xs; }); + appendBuildFlag = drv: x: compose.appendBuildFlag x drv; + appendBuildFlags = drv: xs: compose.appendBuildFlags xs drv; /* removeConfigureFlag drv x is a Haskell package like drv, but with all cabal configure arguments that are equal to x removed. > haskell.lib.removeConfigureFlag haskellPackages.servant "--verbose" */ - removeConfigureFlag = drv: x: overrideCabal drv (drv: { configureFlags = lib.remove x (drv.configureFlags or []); }); + removeConfigureFlag = drv: x: compose.removeConfigureFlag x drv; - addBuildTool = drv: x: addBuildTools drv [x]; - addBuildTools = drv: xs: overrideCabal drv (drv: { buildTools = (drv.buildTools or []) ++ xs; }); + addBuildTool = drv: x: compose.addBuildTool x drv; + addBuildTools = drv: xs: compose.addBuildTools xs drv; - addExtraLibrary = drv: x: addExtraLibraries drv [x]; - addExtraLibraries = drv: xs: overrideCabal drv (drv: { extraLibraries = (drv.extraLibraries or []) ++ xs; }); + addExtraLibrary = drv: x: compose.addExtraLibrary x drv; + addExtraLibraries = drv: xs: compose.addExtraLibraries xs drv; - addBuildDepend = drv: x: addBuildDepends drv [x]; - addBuildDepends = drv: xs: overrideCabal drv (drv: { buildDepends = (drv.buildDepends or []) ++ xs; }); + addBuildDepend = drv: x: compose.addBuildDepend x drv; + addBuildDepends = drv: xs: compose.addBuildDepends xs drv; - addTestToolDepend = drv: x: addTestToolDepends drv [x]; - addTestToolDepends = drv: xs: overrideCabal drv (drv: { testToolDepends = (drv.testToolDepends or []) ++ xs; }); + addTestToolDepend = drv: x: compose.addTestToolDepend x drv; + addTestToolDepends = drv: xs: compose.addTestToolDepends xs drv; - addPkgconfigDepend = drv: x: addPkgconfigDepends drv [x]; - addPkgconfigDepends = drv: xs: overrideCabal drv (drv: { pkg-configDepends = (drv.pkg-configDepends or []) ++ xs; }); + addPkgconfigDepend = drv: x: compose.addPkgconfigDepend x drv; + addPkgconfigDepends = drv: xs: compose.addPkgconfigDepends xs drv; - addSetupDepend = drv: x: addSetupDepends drv [x]; - addSetupDepends = drv: xs: overrideCabal drv (drv: { setupHaskellDepends = (drv.setupHaskellDepends or []) ++ xs; }); + addSetupDepend = drv: x: compose.addSetupDepend x drv; + addSetupDepends = drv: xs: compose.addSetupDepends xs drv; - enableCabalFlag = drv: x: appendConfigureFlag (removeConfigureFlag drv "-f-${x}") "-f${x}"; - disableCabalFlag = drv: x: appendConfigureFlag (removeConfigureFlag drv "-f${x}") "-f-${x}"; + enableCabalFlag = drv: x: compose.enableCabalFlag x drv; + disableCabalFlag = drv: x: compose.disableCabalFlag x drv; - markBroken = drv: overrideCabal drv (drv: { broken = true; hydraPlatforms = []; }); - unmarkBroken = drv: overrideCabal drv (drv: { broken = false; }); - markBrokenVersion = version: drv: assert drv.version == version; markBroken drv; - markUnbroken = drv: overrideCabal drv (drv: { broken = false; }); + markBroken = compose.markBroken; + unmarkBroken = compose.unmarkBroken; + markBrokenVersion = compose.markBrokenVersion; + markUnbroken = compose.markUnbroken; - enableLibraryProfiling = drv: overrideCabal drv (drv: { enableLibraryProfiling = true; }); - disableLibraryProfiling = drv: overrideCabal drv (drv: { enableLibraryProfiling = false; }); + enableLibraryProfiling = compose.enableLibraryProfiling; + disableLibraryProfiling = compose.disableLibraryProfiling; - enableExecutableProfiling = drv: overrideCabal drv (drv: { enableExecutableProfiling = true; }); - disableExecutableProfiling = drv: overrideCabal drv (drv: { enableExecutableProfiling = false; }); + enableExecutableProfiling = compose.enableExecutableProfiling; + disableExecutableProfiling = compose.disableExecutableProfiling; - enableSharedExecutables = drv: overrideCabal drv (drv: { enableSharedExecutables = true; }); - disableSharedExecutables = drv: overrideCabal drv (drv: { enableSharedExecutables = false; }); + enableSharedExecutables = compose.enableSharedExecutables; + disableSharedExecutables = compose.disableSharedExecutables; - enableSharedLibraries = drv: overrideCabal drv (drv: { enableSharedLibraries = true; }); - disableSharedLibraries = drv: overrideCabal drv (drv: { enableSharedLibraries = false; }); + enableSharedLibraries = compose.enableSharedLibraries; + disableSharedLibraries = compose.disableSharedLibraries; - enableDeadCodeElimination = drv: overrideCabal drv (drv: { enableDeadCodeElimination = true; }); - disableDeadCodeElimination = drv: overrideCabal drv (drv: { enableDeadCodeElimination = false; }); + enableDeadCodeElimination = compose.enableDeadCodeElimination; + disableDeadCodeElimination = compose.disableDeadCodeElimination; - enableStaticLibraries = drv: overrideCabal drv (drv: { enableStaticLibraries = true; }); - disableStaticLibraries = drv: overrideCabal drv (drv: { enableStaticLibraries = false; }); + enableStaticLibraries = compose.enableStaticLibraries; + disableStaticLibraries = compose.disableStaticLibraries; - enableSeparateBinOutput = drv: overrideCabal drv (drv: { enableSeparateBinOutput = true; }); + enableSeparateBinOutput = compose.enableSeparateBinOutput; - appendPatch = drv: x: appendPatches drv [x]; - appendPatches = drv: xs: overrideCabal drv (drv: { patches = (drv.patches or []) ++ xs; }); + appendPatch = drv: x: compose.appendPatch x drv; + appendPatches = drv: xs: compose.appendPatches xs drv; /* Set a specific build target instead of compiling all targets in the package. * For example, imagine we have a .cabal file with a library, and 2 executables "dev" and "server". @@ -203,115 +201,67 @@ rec { * setBuildTarget (callCabal2nix "thePackageName" thePackageSrc {}) "server" * */ - setBuildTargets = drv: xs: overrideCabal drv (drv: { buildTarget = lib.concatStringsSep " " xs; }); - setBuildTarget = drv: x: setBuildTargets drv [x]; + setBuildTargets = drv: xs: compose.setBuildTargets xs drv; + setBuildTarget = drv: x: compose.setBuildTarget x drv; - doHyperlinkSource = drv: overrideCabal drv (drv: { hyperlinkSource = true; }); - dontHyperlinkSource = drv: overrideCabal drv (drv: { hyperlinkSource = false; }); + doHyperlinkSource = compose.doHyperlinkSource; + dontHyperlinkSource = compose.dontHyperlinkSource; - disableHardening = drv: flags: overrideCabal drv (drv: { hardeningDisable = flags; }); + disableHardening = drv: flags: compose.disableHardening flags drv; /* Let Nix strip the binary files. * This removes debugging symbols. */ - doStrip = drv: overrideCabal drv (drv: { dontStrip = false; }); + doStrip = compose.doStrip; /* Stop Nix from stripping the binary files. * This keeps debugging symbols. */ - dontStrip = drv: overrideCabal drv (drv: { dontStrip = true; }); + dontStrip = compose.dontStrip; /* Useful for debugging segfaults with gdb. * This includes dontStrip. */ - enableDWARFDebugging = drv: - # -g: enables debugging symbols - # --disable-*-stripping: tell GHC not to strip resulting binaries - # dontStrip: see above - appendConfigureFlag (dontStrip drv) "--ghc-options=-g --disable-executable-stripping --disable-library-stripping"; + enableDWARFDebugging = compose.enableDWARFDebugging; /* Create a source distribution tarball like those found on hackage, instead of building the package. */ - sdistTarball = pkg: lib.overrideDerivation pkg (drv: { - name = "${drv.pname}-source-${drv.version}"; - # Since we disable the haddock phase, we also need to override the - # outputs since the separate doc output will not be produced. - outputs = ["out"]; - buildPhase = "./Setup sdist"; - haddockPhase = ":"; - checkPhase = ":"; - installPhase = "install -D dist/${drv.pname}-*.tar.gz $out/${drv.pname}-${drv.version}.tar.gz"; - fixupPhase = ":"; - }); + sdistTarball = compose.sdistTarball; /* Create a documentation tarball suitable for uploading to Hackage instead of building the package. */ - documentationTarball = pkg: - pkgs.lib.overrideDerivation pkg (drv: { - name = "${drv.name}-docs"; - # Like sdistTarball, disable the "doc" output here. - outputs = [ "out" ]; - buildPhase = '' - runHook preHaddock - ./Setup haddock --for-hackage - runHook postHaddock - ''; - haddockPhase = ":"; - checkPhase = ":"; - installPhase = '' - runHook preInstall - mkdir -p "$out" - tar --format=ustar \ - -czf "$out/${drv.name}-docs.tar.gz" \ - -C dist/doc/html "${drv.name}-docs" - runHook postInstall - ''; - }); + documentationTarball = compose.documentationTarball; /* Use the gold linker. It is a linker for ELF that is designed "to run as fast as possible on modern systems" */ - linkWithGold = drv : appendConfigureFlag drv - "--ghc-option=-optl-fuse-ld=gold --ld-option=-fuse-ld=gold --with-ld=ld.gold"; + linkWithGold = compose.linkWithGold; /* link executables statically against haskell libs to reduce closure size */ - justStaticExecutables = drv: overrideCabal drv (drv: { - enableSharedExecutables = false; - enableLibraryProfiling = false; - isLibrary = false; - doHaddock = false; - postFixup = "rm -rf $out/lib $out/nix-support $out/share/doc"; - }); + justStaticExecutables = compose.justStaticExecutables; /* Build a source distribution tarball instead of using the source files directly. The effect is that the package is built as if it were published on hackage. This can be used as a test for the source distribution, assuming the build fails when packaging mistakes are in the cabal file. */ - buildFromSdist = pkg: overrideCabal pkg (drv: { - src = "${sdistTarball pkg}/${pkg.pname}-${pkg.version}.tar.gz"; - - # Revising and jailbreaking the cabal file has been handled in sdistTarball - revision = null; - editedCabalFile = null; - jailbreak = false; - }); + buildFromSdist = compose.buildFromSdist; /* Build the package in a strict way to uncover potential problems. This includes buildFromSdist and failOnAllWarnings. */ - buildStrictly = pkg: buildFromSdist (failOnAllWarnings pkg); + buildStrictly = compose.buildStrictly; /* Disable core optimizations, significantly speeds up build time */ - disableOptimization = pkg: appendConfigureFlag pkg "--disable-optimization"; + disableOptimization = compose.disableOptimization; /* Turn on most of the compiler warnings and fail the build if any of them occur. */ - failOnAllWarnings = drv: appendConfigureFlag drv "--ghc-option=-Wall --ghc-option=-Werror"; + failOnAllWarnings = compose.failOnAllWarnings; /* Add a post-build check to verify that dependencies declared in the cabal file are actually used. @@ -320,54 +270,33 @@ rec { of this check and a list of ignored package names that would otherwise cause false alarms. */ - checkUnusedPackages = - { ignoreEmptyImports ? false - , ignoreMainModule ? false - , ignorePackages ? [] - } : drv : - overrideCabal (appendConfigureFlag drv "--ghc-option=-ddump-minimal-imports") (_drv: { - postBuild = with lib; - let args = concatStringsSep " " ( - optional ignoreEmptyImports "--ignore-empty-imports" ++ - optional ignoreMainModule "--ignore-main-module" ++ - map (pkg: "--ignore-package ${pkg}") ignorePackages - ); - in "${pkgs.haskellPackages.packunused}/bin/packunused" + - optionalString (args != "") " ${args}"; - }); - - buildStackProject = pkgs.callPackage ./generic-stack-builder.nix { }; + checkUnusedPackages = compose.checkUnusedPackages; + + buildStackProject = compose.buildStackProject; /* Add a dummy command to trigger a build despite an equivalent earlier build that is present in the store or cache. */ - triggerRebuild = drv: i: overrideCabal drv (drv: { postUnpack = ": trigger rebuild ${toString i}"; }); + triggerRebuild = drv: i: compose.triggerRebuild i drv; /* Override the sources for the package and optionaly the version. This also takes of removing editedCabalFile. */ - overrideSrc = drv: { src, version ? drv.version }: - overrideCabal drv (_: { inherit src version; editedCabalFile = null; }); + overrideSrc = drv: src: compose.overrideSrc src drv; # Get all of the build inputs of a haskell package, divided by category. - getBuildInputs = p: p.getBuildInputs; + getBuildInputs = compose.getBuildInputs; # Extract the haskell build inputs of a haskell package. # This is useful to build environments for developing on that # package. - getHaskellBuildInputs = p: (getBuildInputs p).haskellBuildInputs; + getHaskellBuildInputs = compose.getHaskellBuildInputs; # Under normal evaluation, simply return the original package. Under # nix-shell evaluation, return a nix-shell optimized environment. - shellAware = p: if lib.inNixShell then p.env else p; + shellAware = compose.shellAware; - ghcInfo = ghc: - rec { isCross = (ghc.cross or null) != null; - isGhcjs = ghc.isGhcjs or false; - nativeGhc = if isCross || isGhcjs - then ghc.bootPkgs.ghc - else ghc; - }; + ghcInfo = compose.ghcInfo; ### mkDerivation helpers # These allow external users of a haskell package to extract @@ -379,35 +308,15 @@ rec { # an example of this. # Some information about which phases should be run. - controlPhases = ghc: let inherit (ghcInfo ghc) isCross; in - { doCheck ? !isCross && (lib.versionOlder "7.4" ghc.version) - , doBenchmark ? false - , ... - }: { inherit doCheck doBenchmark; }; + controlPhases = compose.controlPhases; # Utility to convert a directory full of `cabal2nix`-generated files into a # package override set # # packagesFromDirectory : { directory : Directory, ... } -> HaskellPackageOverrideSet - packagesFromDirectory = - { directory, ... }: - - self: super: - let - haskellPaths = builtins.attrNames (builtins.readDir directory); - - toKeyVal = file: { - name = builtins.replaceStrings [ ".nix" ] [ "" ] file; - - value = self.callPackage (directory + "/${file}") { }; - }; - - in - builtins.listToAttrs (map toKeyVal haskellPaths); + packagesFromDirectory = compose.packagesFromDirectory; - addOptparseApplicativeCompletionScripts = exeName: pkg: - builtins.trace "addOptparseApplicativeCompletionScripts is deprecated in favor of generateOptparseApplicativeCompletion. Please change ${pkg.name} to use the latter or its plural form." - (generateOptparseApplicativeCompletion exeName pkg); + addOptparseApplicativeCompletionScripts = compose.addOptparseApplicativeCompletionScripts; /* Modify a Haskell package to add shell completion scripts for the @@ -422,23 +331,7 @@ rec { command: name of an executable pkg: Haskell package that builds the executables */ - generateOptparseApplicativeCompletion = exeName: pkg: overrideCabal pkg (drv: { - postInstall = (drv.postInstall or "") + '' - bashCompDir="''${!outputBin}/share/bash-completion/completions" - zshCompDir="''${!outputBin}/share/zsh/vendor-completions" - fishCompDir="''${!outputBin}/share/fish/vendor_completions.d" - mkdir -p "$bashCompDir" "$zshCompDir" "$fishCompDir" - "''${!outputBin}/bin/${exeName}" --bash-completion-script "''${!outputBin}/bin/${exeName}" >"$bashCompDir/${exeName}" - "''${!outputBin}/bin/${exeName}" --zsh-completion-script "''${!outputBin}/bin/${exeName}" >"$zshCompDir/_${exeName}" - "''${!outputBin}/bin/${exeName}" --fish-completion-script "''${!outputBin}/bin/${exeName}" >"$fishCompDir/${exeName}.fish" - - # Sanity check - grep -F ${exeName} <$bashCompDir/${exeName} >/dev/null || { - echo 'Could not find ${exeName} in completion script.' - exit 1 - } - ''; - }); + generateOptparseApplicativeCompletion = compose.generateOptparseApplicativeCompletion; /* Modify a Haskell package to add shell completion scripts for the @@ -453,13 +346,10 @@ rec { commands: name of an executable pkg: Haskell package that builds the executables */ - generateOptparseApplicativeCompletions = commands: pkg: - pkgs.lib.foldr generateOptparseApplicativeCompletion pkg commands; + generateOptparseApplicativeCompletions = compose.generateOptparseApplicativeCompletions; # Don't fail at configure time if there are multiple versions of the # same package in the (recursive) dependencies of the package being # built. Will delay failures, if any, to compile time. - allowInconsistentDependencies = drv: overrideCabal drv (drv: { - allowInconsistentDependencies = true; - }); + allowInconsistentDependencies = compose.allowInconsistentDependencies; } diff --git a/pkgs/development/haskell-modules/lib/compose.nix b/pkgs/development/haskell-modules/lib/compose.nix new file mode 100644 index 0000000000000..d84c804272dbe --- /dev/null +++ b/pkgs/development/haskell-modules/lib/compose.nix @@ -0,0 +1,466 @@ +# TODO(@Ericson2314): Remove `pkgs` param, which is only used for +# `buildStackProject`, `justStaticExecutables` and `checkUnusedPackages` +{ pkgs, lib }: + +rec { + + /* This function takes a file like `hackage-packages.nix` and constructs + a full package set out of that. + */ + makePackageSet = import ../make-package-set.nix; + + /* The function overrideCabal lets you alter the arguments to the + mkDerivation function. + + Example: + + First, note how the aeson package is constructed in hackage-packages.nix: + + "aeson" = callPackage ({ mkDerivation, attoparsec, + }: + mkDerivation { + pname = "aeson"; + + homepage = "https://github.com/bos/aeson"; + }) + + The mkDerivation function of haskellPackages will take care of putting + the homepage in the right place, in meta. + + > haskellPackages.aeson.meta.homepage + "https://github.com/bos/aeson" + + > x = haskell.lib.compose.overrideCabal (old: { homepage = old.homepage + "#readme"; }) haskellPackages.aeson + > x.meta.homepage + "https://github.com/bos/aeson#readme" + + */ + overrideCabal = f: drv: (drv.override (args: args // { + mkDerivation = drv: (args.mkDerivation drv).override f; + })) // { + overrideScope = scope: overrideCabal f (drv.overrideScope scope); + }; + + # : Map Name (Either Path VersionNumber) -> HaskellPackageOverrideSet + # Given a set whose values are either paths or version strings, produces + # a package override set (i.e. (self: super: { etc. })) that sets + # the packages named in the input set to the corresponding versions + packageSourceOverrides = + overrides: self: super: pkgs.lib.mapAttrs (name: src: + let isPath = x: builtins.substring 0 1 (toString x) == "/"; + generateExprs = if isPath src + then self.callCabal2nix + else self.callHackage; + in generateExprs name src {}) overrides; + + /* doCoverage modifies a haskell package to enable the generation + and installation of a coverage report. + + See https://wiki.haskell.org/Haskell_program_coverage + */ + doCoverage = overrideCabal (drv: { doCoverage = true; }); + + /* dontCoverage modifies a haskell package to disable the generation + and installation of a coverage report. + */ + dontCoverage = overrideCabal (drv: { doCoverage = false; }); + + /* doHaddock modifies a haskell package to enable the generation and + installation of API documentation from code comments using the + haddock tool. + */ + doHaddock = overrideCabal (drv: { doHaddock = true; }); + + /* dontHaddock modifies a haskell package to disable the generation and + installation of API documentation from code comments using the + haddock tool. + */ + dontHaddock = overrideCabal (drv: { doHaddock = false; }); + + /* doJailbreak enables the removal of version bounds from the cabal + file. You may want to avoid this function. + + This is useful when a package reports that it can not be built + due to version mismatches. In some cases, removing the version + bounds entirely is an easy way to make a package build, but at + the risk of breaking software in non-obvious ways now or in the + future. + + Instead of jailbreaking, you can patch the cabal file. + + Note that jailbreaking at this time, doesn't lift bounds on + conditional branches. + https://github.com/peti/jailbreak-cabal/issues/7 has further details. + + */ + doJailbreak = overrideCabal (drv: { jailbreak = true; }); + + /* dontJailbreak restores the use of the version bounds the check + the use of dependencies in the package description. + */ + dontJailbreak = overrideCabal (drv: { jailbreak = false; }); + + /* doCheck enables dependency checking, compilation and execution + of test suites listed in the package description file. + */ + doCheck = overrideCabal (drv: { doCheck = true; }); + /* dontCheck disables dependency checking, compilation and execution + of test suites listed in the package description file. + */ + dontCheck = overrideCabal (drv: { doCheck = false; }); + + /* doBenchmark enables dependency checking, compilation and execution + for benchmarks listed in the package description file. + */ + doBenchmark = overrideCabal (drv: { doBenchmark = true; }); + /* dontBenchmark disables dependency checking, compilation and execution + for benchmarks listed in the package description file. + */ + dontBenchmark = overrideCabal (drv: { doBenchmark = false; }); + + /* doDistribute enables the distribution of binaries for the package + via hydra. + */ + doDistribute = overrideCabal (drv: { hydraPlatforms = drv.platforms or ["i686-linux" "x86_64-linux" "x86_64-darwin"]; }); + /* dontDistribute disables the distribution of binaries for the package + via hydra. + */ + dontDistribute = overrideCabal (drv: { hydraPlatforms = []; }); + + /* appendConfigureFlag adds a single argument that will be passed to the + cabal configure command, after the arguments that have been defined + in the initial declaration or previous overrides. + + Example: + + > haskell.lib.compose.appendConfigureFlag "--profiling-detail=all-functions" haskellPackages.servant + */ + appendConfigureFlag = x: appendConfigureFlags [x]; + appendConfigureFlags = xs: overrideCabal (drv: { configureFlags = (drv.configureFlags or []) ++ xs; }); + + appendBuildFlag = x: overrideCabal (drv: { buildFlags = (drv.buildFlags or []) ++ [x]; }); + appendBuildFlags = xs: overrideCabal (drv: { buildFlags = (drv.buildFlags or []) ++ xs; }); + + /* removeConfigureFlag drv x is a Haskell package like drv, but with + all cabal configure arguments that are equal to x removed. + + > haskell.lib.compose.removeConfigureFlag "--verbose" haskellPackages.servant + */ + removeConfigureFlag = x: overrideCabal (drv: { configureFlags = lib.remove x (drv.configureFlags or []); }); + + addBuildTool = x: addBuildTools [x]; + addBuildTools = xs: overrideCabal (drv: { buildTools = (drv.buildTools or []) ++ xs; }); + + addExtraLibrary = x: addExtraLibraries [x]; + addExtraLibraries = xs: overrideCabal (drv: { extraLibraries = (drv.extraLibraries or []) ++ xs; }); + + addBuildDepend = x: addBuildDepends [x]; + addBuildDepends = xs: overrideCabal (drv: { buildDepends = (drv.buildDepends or []) ++ xs; }); + + addTestToolDepend = x: addTestToolDepends [x]; + addTestToolDepends = xs: overrideCabal (drv: { testToolDepends = (drv.testToolDepends or []) ++ xs; }); + + addPkgconfigDepend = x: addPkgconfigDepends [x]; + addPkgconfigDepends = xs: overrideCabal (drv: { pkg-configDepends = (drv.pkg-configDepends or []) ++ xs; }); + + addSetupDepend = x: addSetupDepends [x]; + addSetupDepends = xs: overrideCabal (drv: { setupHaskellDepends = (drv.setupHaskellDepends or []) ++ xs; }); + + enableCabalFlag = x: drv: appendConfigureFlag "-f${x}" (removeConfigureFlag "-f-${x}" drv); + disableCabalFlag = x: drv: appendConfigureFlag "-f-${x}" (removeConfigureFlag "-f${x}" drv); + + markBroken = overrideCabal (drv: { broken = true; hydraPlatforms = []; }); + unmarkBroken = overrideCabal (drv: { broken = false; }); + markBrokenVersion = version: drv: assert drv.version == version; markBroken drv; + markUnbroken = overrideCabal (drv: { broken = false; }); + + enableLibraryProfiling = overrideCabal (drv: { enableLibraryProfiling = true; }); + disableLibraryProfiling = overrideCabal (drv: { enableLibraryProfiling = false; }); + + enableExecutableProfiling = overrideCabal (drv: { enableExecutableProfiling = true; }); + disableExecutableProfiling = overrideCabal (drv: { enableExecutableProfiling = false; }); + + enableSharedExecutables = overrideCabal (drv: { enableSharedExecutables = true; }); + disableSharedExecutables = overrideCabal (drv: { enableSharedExecutables = false; }); + + enableSharedLibraries = overrideCabal (drv: { enableSharedLibraries = true; }); + disableSharedLibraries = overrideCabal (drv: { enableSharedLibraries = false; }); + + enableDeadCodeElimination = overrideCabal (drv: { enableDeadCodeElimination = true; }); + disableDeadCodeElimination = overrideCabal (drv: { enableDeadCodeElimination = false; }); + + enableStaticLibraries = overrideCabal (drv: { enableStaticLibraries = true; }); + disableStaticLibraries = overrideCabal (drv: { enableStaticLibraries = false; }); + + enableSeparateBinOutput = overrideCabal (drv: { enableSeparateBinOutput = true; }); + + appendPatch = x: appendPatches [x]; + appendPatches = xs: overrideCabal (drv: { patches = (drv.patches or []) ++ xs; }); + + /* Set a specific build target instead of compiling all targets in the package. + * For example, imagine we have a .cabal file with a library, and 2 executables "dev" and "server". + * We can build only "server" and not wait on the compilation of "dev" by using setBuildTarget as follows: + * + * > setBuildTarget "server" (callCabal2nix "thePackageName" thePackageSrc {}) + * + */ + setBuildTargets = xs: overrideCabal (drv: { buildTarget = lib.concatStringsSep " " xs; }); + setBuildTarget = x: setBuildTargets [x]; + + doHyperlinkSource = overrideCabal (drv: { hyperlinkSource = true; }); + dontHyperlinkSource = overrideCabal (drv: { hyperlinkSource = false; }); + + disableHardening = flags: overrideCabal (drv: { hardeningDisable = flags; }); + + /* Let Nix strip the binary files. + * This removes debugging symbols. + */ + doStrip = overrideCabal (drv: { dontStrip = false; }); + + /* Stop Nix from stripping the binary files. + * This keeps debugging symbols. + */ + dontStrip = overrideCabal (drv: { dontStrip = true; }); + + /* Useful for debugging segfaults with gdb. + * This includes dontStrip. + */ + enableDWARFDebugging = drv: + # -g: enables debugging symbols + # --disable-*-stripping: tell GHC not to strip resulting binaries + # dontStrip: see above + appendConfigureFlag "--ghc-options=-g --disable-executable-stripping --disable-library-stripping" (dontStrip drv); + + /* Create a source distribution tarball like those found on hackage, + instead of building the package. + */ + sdistTarball = pkg: lib.overrideDerivation pkg (drv: { + name = "${drv.pname}-source-${drv.version}"; + # Since we disable the haddock phase, we also need to override the + # outputs since the separate doc output will not be produced. + outputs = ["out"]; + buildPhase = "./Setup sdist"; + haddockPhase = ":"; + checkPhase = ":"; + installPhase = "install -D dist/${drv.pname}-*.tar.gz $out/${drv.pname}-${drv.version}.tar.gz"; + fixupPhase = ":"; + }); + + /* Create a documentation tarball suitable for uploading to Hackage instead + of building the package. + */ + documentationTarball = pkg: + pkgs.lib.overrideDerivation pkg (drv: { + name = "${drv.name}-docs"; + # Like sdistTarball, disable the "doc" output here. + outputs = [ "out" ]; + buildPhase = '' + runHook preHaddock + ./Setup haddock --for-hackage + runHook postHaddock + ''; + haddockPhase = ":"; + checkPhase = ":"; + installPhase = '' + runHook preInstall + mkdir -p "$out" + tar --format=ustar \ + -czf "$out/${drv.name}-docs.tar.gz" \ + -C dist/doc/html "${drv.name}-docs" + runHook postInstall + ''; + }); + + /* Use the gold linker. It is a linker for ELF that is designed + "to run as fast as possible on modern systems" + */ + linkWithGold = appendConfigureFlag + "--ghc-option=-optl-fuse-ld=gold --ld-option=-fuse-ld=gold --with-ld=ld.gold"; + + /* link executables statically against haskell libs to reduce + closure size + */ + justStaticExecutables = overrideCabal (drv: { + enableSharedExecutables = false; + enableLibraryProfiling = false; + isLibrary = false; + doHaddock = false; + postFixup = "rm -rf $out/lib $out/nix-support $out/share/doc"; + }); + + /* Build a source distribution tarball instead of using the source files + directly. The effect is that the package is built as if it were published + on hackage. This can be used as a test for the source distribution, + assuming the build fails when packaging mistakes are in the cabal file. + */ + buildFromSdist = pkg: overrideCabal (drv: { + src = "${sdistTarball pkg}/${pkg.pname}-${pkg.version}.tar.gz"; + + # Revising and jailbreaking the cabal file has been handled in sdistTarball + revision = null; + editedCabalFile = null; + jailbreak = false; + }) pkg; + + /* Build the package in a strict way to uncover potential problems. + This includes buildFromSdist and failOnAllWarnings. + */ + buildStrictly = pkg: buildFromSdist (failOnAllWarnings pkg); + + /* Disable core optimizations, significantly speeds up build time */ + disableOptimization = appendConfigureFlag "--disable-optimization"; + + /* Turn on most of the compiler warnings and fail the build if any + of them occur. */ + failOnAllWarnings = appendConfigureFlag "--ghc-option=-Wall --ghc-option=-Werror"; + + /* Add a post-build check to verify that dependencies declared in + the cabal file are actually used. + + The first attrset argument can be used to configure the strictness + of this check and a list of ignored package names that would otherwise + cause false alarms. + */ + checkUnusedPackages = + { ignoreEmptyImports ? false + , ignoreMainModule ? false + , ignorePackages ? [] + } : drv : + overrideCabal (_drv: { + postBuild = with lib; + let args = concatStringsSep " " ( + optional ignoreEmptyImports "--ignore-empty-imports" ++ + optional ignoreMainModule "--ignore-main-module" ++ + map (pkg: "--ignore-package ${pkg}") ignorePackages + ); + in "${pkgs.haskellPackages.packunused}/bin/packunused" + + optionalString (args != "") " ${args}"; + }) (appendConfigureFlag "--ghc-option=-ddump-minimal-imports" drv); + + buildStackProject = pkgs.callPackage ../generic-stack-builder.nix { }; + + /* Add a dummy command to trigger a build despite an equivalent + earlier build that is present in the store or cache. + */ + triggerRebuild = i: overrideCabal (drv: { postUnpack = ": trigger rebuild ${toString i}"; }); + + /* Override the sources for the package and optionaly the version. + This also takes of removing editedCabalFile. + */ + overrideSrc = { src, version ? null }: drv: + overrideCabal (_: { inherit src; version = if version == null then drv.version else version; editedCabalFile = null; }) drv; + + # Get all of the build inputs of a haskell package, divided by category. + getBuildInputs = p: p.getBuildInputs; + + # Extract the haskell build inputs of a haskell package. + # This is useful to build environments for developing on that + # package. + getHaskellBuildInputs = p: (getBuildInputs p).haskellBuildInputs; + + # Under normal evaluation, simply return the original package. Under + # nix-shell evaluation, return a nix-shell optimized environment. + shellAware = p: if lib.inNixShell then p.env else p; + + ghcInfo = ghc: + rec { isCross = (ghc.cross or null) != null; + isGhcjs = ghc.isGhcjs or false; + nativeGhc = if isCross || isGhcjs + then ghc.bootPkgs.ghc + else ghc; + }; + + ### mkDerivation helpers + # These allow external users of a haskell package to extract + # information about how it is built in the same way that the + # generic haskell builder does, by reusing the same functions. + # Each function here has the same interface as mkDerivation and thus + # can be called for a given package simply by overriding the + # mkDerivation argument it used. See getHaskellBuildInputs above for + # an example of this. + + # Some information about which phases should be run. + controlPhases = ghc: let inherit (ghcInfo ghc) isCross; in + { doCheck ? !isCross && (lib.versionOlder "7.4" ghc.version) + , doBenchmark ? false + , ... + }: { inherit doCheck doBenchmark; }; + + # Utility to convert a directory full of `cabal2nix`-generated files into a + # package override set + # + # packagesFromDirectory : { directory : Directory, ... } -> HaskellPackageOverrideSet + packagesFromDirectory = + { directory, ... }: + + self: super: + let + haskellPaths = builtins.attrNames (builtins.readDir directory); + + toKeyVal = file: { + name = builtins.replaceStrings [ ".nix" ] [ "" ] file; + + value = self.callPackage (directory + "/${file}") { }; + }; + + in + builtins.listToAttrs (map toKeyVal haskellPaths); + + addOptparseApplicativeCompletionScripts = exeName: pkg: + builtins.trace "addOptparseApplicativeCompletionScripts is deprecated in favor of generateOptparseApplicativeCompletion. Please change ${pkg.name} to use the latter or its plural form." + (generateOptparseApplicativeCompletion exeName pkg); + + /* + Modify a Haskell package to add shell completion scripts for the + given executable produced by it. These completion scripts will be + picked up automatically if the resulting derivation is installed, + e.g. by `nix-env -i`. + + Invocation: + generateOptparseApplicativeCompletion command pkg + + + command: name of an executable + pkg: Haskell package that builds the executables + */ + generateOptparseApplicativeCompletion = exeName: overrideCabal (drv: { + postInstall = (drv.postInstall or "") + '' + bashCompDir="''${!outputBin}/share/bash-completion/completions" + zshCompDir="''${!outputBin}/share/zsh/vendor-completions" + fishCompDir="''${!outputBin}/share/fish/vendor_completions.d" + mkdir -p "$bashCompDir" "$zshCompDir" "$fishCompDir" + "''${!outputBin}/bin/${exeName}" --bash-completion-script "''${!outputBin}/bin/${exeName}" >"$bashCompDir/${exeName}" + "''${!outputBin}/bin/${exeName}" --zsh-completion-script "''${!outputBin}/bin/${exeName}" >"$zshCompDir/_${exeName}" + "''${!outputBin}/bin/${exeName}" --fish-completion-script "''${!outputBin}/bin/${exeName}" >"$fishCompDir/${exeName}.fish" + + # Sanity check + grep -F ${exeName} <$bashCompDir/${exeName} >/dev/null || { + echo 'Could not find ${exeName} in completion script.' + exit 1 + } + ''; + }); + + /* + Modify a Haskell package to add shell completion scripts for the + given executables produced by it. These completion scripts will be + picked up automatically if the resulting derivation is installed, + e.g. by `nix-env -i`. + + Invocation: + generateOptparseApplicativeCompletions commands pkg + + + commands: name of an executable + pkg: Haskell package that builds the executables + */ + generateOptparseApplicativeCompletions = commands: pkg: + pkgs.lib.foldr generateOptparseApplicativeCompletion pkg commands; + + # Don't fail at configure time if there are multiple versions of the + # same package in the (recursive) dependencies of the package being + # built. Will delay failures, if any, to compile time. + allowInconsistentDependencies = overrideCabal (drv: { + allowInconsistentDependencies = true; + }); +} diff --git a/pkgs/development/haskell-modules/make-package-set.nix b/pkgs/development/haskell-modules/make-package-set.nix index d272f7375a828..5d86a685e1bf8 100644 --- a/pkgs/development/haskell-modules/make-package-set.nix +++ b/pkgs/development/haskell-modules/make-package-set.nix @@ -49,23 +49,23 @@ let nodejs = buildPackages.nodejs-slim; inherit (self) buildHaskellPackages ghc ghcWithHoogle ghcWithPackages; inherit (self.buildHaskellPackages) jailbreak-cabal; - hscolour = overrideCabal self.buildHaskellPackages.hscolour (drv: { + hscolour = overrideCabal (drv: { isLibrary = false; doHaddock = false; hyperlinkSource = false; # Avoid depending on hscolour for this build. postFixup = "rm -rf $out/lib $out/share $out/nix-support"; - }); - cpphs = overrideCabal (self.cpphs.overrideScope (self: super: { + }) self.buildHaskellPackages.hscolour; + cpphs = overrideCabal (drv: { + isLibrary = false; + postFixup = "rm -rf $out/lib $out/share $out/nix-support"; + }) (self.cpphs.overrideScope (self: super: { mkDerivation = drv: super.mkDerivation (drv // { enableSharedExecutables = false; enableSharedLibraries = false; doHaddock = false; useCpphs = false; }); - })) (drv: { - isLibrary = false; - postFixup = "rm -rf $out/lib $out/share $out/nix-support"; - }); + })); }; mkDerivation = makeOverridable mkDerivationImpl; @@ -294,7 +294,7 @@ in package-set { inherit pkgs lib callPackage; } self // { # # # default.nix # with import {}; - # haskellPackages.extend (haskell.lib.packageSourceOverrides { + # haskellPackages.extend (haskell.lib.compose.packageSourceOverrides { # frontend = ./frontend; # backend = ./backend; # common = ./common; diff --git a/pkgs/development/interpreters/dhall/build-dhall-package.nix b/pkgs/development/interpreters/dhall/build-dhall-package.nix index 86797e9f136f6..f58546a9d3c61 100644 --- a/pkgs/development/interpreters/dhall/build-dhall-package.nix +++ b/pkgs/development/interpreters/dhall/build-dhall-package.nix @@ -48,7 +48,7 @@ let # HTTP support is disabled in order to force that HTTP dependencies are built # using Nix instead of using Dhall's support for HTTP imports. - dhallNoHTTP = haskell.lib.appendConfigureFlag dhall "-f-with-http"; + dhallNoHTTP = haskell.lib.compose.appendConfigureFlag "-f-with-http" dhall; file = writeText "${name}.dhall" code; diff --git a/pkgs/development/tools/continuous-integration/hci/default.nix b/pkgs/development/tools/continuous-integration/hci/default.nix index dfca0c4d388e5..5c0c59845ce68 100644 --- a/pkgs/development/tools/continuous-integration/hci/default.nix +++ b/pkgs/development/tools/continuous-integration/hci/default.nix @@ -1,13 +1,12 @@ { haskell, haskellPackages, lib, makeWrapper, runc, stdenv }: let - inherit (haskell.lib) overrideCabal addBuildDepends; + inherit (haskell.lib.compose) overrideCabal addBuildDepends justStaticExecutables; inherit (lib) makeBinPath; bundledBins = lib.optional stdenv.isLinux runc; pkg = # justStaticExecutables is needed due to https://github.com/NixOS/nix/issues/2990 overrideCabal - (addBuildDepends (haskell.lib.justStaticExecutables haskellPackages.hercules-ci-cli) [ makeWrapper ]) (o: { postInstall = '' ${o.postInstall or ""} @@ -15,7 +14,8 @@ let mv $out/bin/hci $out/libexec makeWrapper $out/libexec/hci $out/bin/hci --prefix PATH : ${makeBinPath bundledBins} ''; - }); + }) + (addBuildDepends [ makeWrapper ] (justStaticExecutables haskellPackages.hercules-ci-cli)); in pkg // { meta = pkg.meta // { position = toString ./default.nix + ":1"; diff --git a/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix b/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix index bc464c2024e48..00ae501e53488 100644 --- a/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix +++ b/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix @@ -1,13 +1,12 @@ { gnutar, gzip, git, haskell, haskellPackages, lib, makeWrapper, nixos, runc, stdenv }: let - inherit (haskell.lib) overrideCabal addBuildDepends; + inherit (haskell.lib.compose) overrideCabal addBuildDepends justStaticExecutables; inherit (lib) makeBinPath; bundledBins = [ gnutar gzip git ] ++ lib.optional stdenv.isLinux runc; pkg = # justStaticExecutables is needed due to https://github.com/NixOS/nix/issues/2990 overrideCabal - (addBuildDepends (haskell.lib.justStaticExecutables haskellPackages.hercules-ci-agent) [ makeWrapper ]) (o: { postInstall = '' ${o.postInstall or ""} @@ -15,7 +14,8 @@ let mv $out/bin/hercules-ci-agent $out/libexec makeWrapper $out/libexec/hercules-ci-agent $out/bin/hercules-ci-agent --prefix PATH : ${makeBinPath bundledBins} ''; - }); + }) + (addBuildDepends [ makeWrapper ] (justStaticExecutables haskellPackages.hercules-ci-agent)); in pkg.overrideAttrs (o: { meta = o.meta // { position = toString ./default.nix + ":1"; diff --git a/pkgs/development/tools/haskell/dconf2nix/default.nix b/pkgs/development/tools/haskell/dconf2nix/default.nix index cfd391866ee30..4cc137b54f75b 100644 --- a/pkgs/development/tools/haskell/dconf2nix/default.nix +++ b/pkgs/development/tools/haskell/dconf2nix/default.nix @@ -2,12 +2,12 @@ let dconf2nix = - haskell.lib.justStaticExecutables - (haskell.lib.overrideCabal haskellPackages.dconf2nix (oldAttrs: { + haskell.lib.compose.justStaticExecutables + (haskell.lib.compose.overrideCabal (oldAttrs: { maintainers = (oldAttrs.maintainers or []) ++ [ lib.maintainers.gvolpe ]; - })); + }) haskellPackages.dconf2nix); in dconf2nix.overrideAttrs (oldAttrs: { diff --git a/pkgs/development/tools/haskell/haskell-language-server/withWrapper.nix b/pkgs/development/tools/haskell/haskell-language-server/withWrapper.nix index 7e8839b2e7261..9f67317d71f0e 100644 --- a/pkgs/development/tools/haskell/haskell-language-server/withWrapper.nix +++ b/pkgs/development/tools/haskell/haskell-language-server/withWrapper.nix @@ -11,8 +11,8 @@ let inherit (lib) concatStringsSep concatMapStringsSep take splitString; getPackages = version: haskell.packages."ghc${version}"; tunedHls = hsPkgs: - haskell.lib.justStaticExecutables - (haskell.lib.overrideCabal hsPkgs.haskell-language-server (old: { + haskell.lib.compose.justStaticExecutables + (haskell.lib.compose.overrideCabal (old: { postInstall = '' remove-references-to -t ${hsPkgs.ghc} $out/bin/haskell-language-server remove-references-to -t ${hsPkgs.shake.data} $out/bin/haskell-language-server @@ -20,7 +20,7 @@ let remove-references-to -t ${hsPkgs.js-dgtable.data} $out/bin/haskell-language-server remove-references-to -t ${hsPkgs.js-flot.data} $out/bin/haskell-language-server ''; - })); + }) hsPkgs.haskell-language-server); targets = version: let packages = getPackages version; in [ diff --git a/pkgs/development/tools/haskell/lambdabot/default.nix b/pkgs/development/tools/haskell/lambdabot/default.nix index 5e372b4f3874d..0b0a9778c361e 100644 --- a/pkgs/development/tools/haskell/lambdabot/default.nix +++ b/pkgs/development/tools/haskell/lambdabot/default.nix @@ -23,7 +23,7 @@ let allPkgs = pkgs: mueval.defaultPkgs pkgs ++ [ pkgs.lambdabot-trusted ] ++ pac modulesStr = lib.replaceChars ["\n"] [" "] modules; configStr = lib.replaceChars ["\n"] [" "] configuration; -in haskellLib.overrideCabal haskellPackages.lambdabot (self: { +in haskellLib.overrideCabal (self: { patches = (self.patches or []) ++ [ ./custom-config.patch ]; postPatch = (self.postPatch or "") + '' substituteInPlace src/Main.hs \ @@ -38,4 +38,4 @@ in haskellLib.overrideCabal haskellPackages.lambdabot (self: { wrapProgram $out/bin/lambdabot \ --prefix PATH ":" '${bins}' ''; -}) +}) haskellPackages.lambdabot diff --git a/pkgs/development/tools/pandoc/default.nix b/pkgs/development/tools/pandoc/default.nix index 7c286218d8e2d..475fa6a93e4e0 100644 --- a/pkgs/development/tools/pandoc/default.nix +++ b/pkgs/development/tools/pandoc/default.nix @@ -1,10 +1,10 @@ { haskellPackages, fetchpatch, haskell, removeReferencesTo }: let - static = haskell.lib.justStaticExecutables haskellPackages.pandoc; + static = haskell.lib.compose.justStaticExecutables haskellPackages.pandoc; in - (haskell.lib.overrideCabal static (drv: { + (haskell.lib.compose.overrideCabal (drv: { configureFlags = drv.configureFlags or [] ++ ["-fembed_data_files"]; buildDepends = drv.buildDepends or [] ++ [haskellPackages.file-embed]; buildTools = (drv.buildTools or []) ++ [ removeReferencesTo ]; @@ -16,7 +16,7 @@ in sha256 = "gOtrWVylzwgu0YLD4SztqlXxtaXXGOf8nTqLwUBS7qs="; }) ]; - })).overrideAttrs (drv: { + }) static).overrideAttrs (drv: { # These libraries are still referenced, because they generate # a `Paths_*` module for figuring out their version. diff --git a/pkgs/development/tools/pretty-simple/default.nix b/pkgs/development/tools/pretty-simple/default.nix index c55e176176d95..0a33b6e6b2eaf 100644 --- a/pkgs/development/tools/pretty-simple/default.nix +++ b/pkgs/development/tools/pretty-simple/default.nix @@ -1,6 +1,6 @@ { haskell, haskellPackages, lib }: -haskell.lib.justStaticExecutables (haskell.lib.overrideCabal haskellPackages.pretty-simple (oldAttrs: { +haskell.lib.compose.justStaticExecutables (haskell.lib.compose.overrideCabal (oldAttrs: { maintainers = (oldAttrs.maintainers or []) ++ [ lib.maintainers.cdepillabout ]; @@ -8,5 +8,5 @@ haskell.lib.justStaticExecutables (haskell.lib.overrideCabal haskellPackages.pre configureFlags = (oldAttrs.configureFlags or []) ++ ["-fbuildexe"]; buildDepends = (oldAttrs.buildDepends or []) ++ [haskellPackages.optparse-applicative]; -})) +}) haskellPackages.pretty-simple) diff --git a/pkgs/development/tools/purescript/spago/default.nix b/pkgs/development/tools/purescript/spago/default.nix index 980bca0fa2db6..51516ed5b2564 100644 --- a/pkgs/development/tools/purescript/spago/default.nix +++ b/pkgs/development/tools/purescript/spago/default.nix @@ -12,14 +12,14 @@ let spago = - haskell.lib.justStaticExecutables - (haskell.lib.overrideCabal haskellPackages.spago (oldAttrs: { + haskell.lib.compose.justStaticExecutables + (haskell.lib.compose.overrideCabal (oldAttrs: { maintainers = (oldAttrs.maintainers or []) ++ [ lib.maintainers.cdepillabout ]; changelog = "https://github.com/purescript/spago/releases/tag/${oldAttrs.version}"; - })); + }) haskellPackages.spago); in spago.overrideAttrs (oldAttrs: { diff --git a/pkgs/development/tools/shellcheck/default.nix b/pkgs/development/tools/shellcheck/default.nix index 284ce6d817a91..cf767515082e4 100644 --- a/pkgs/development/tools/shellcheck/default.nix +++ b/pkgs/development/tools/shellcheck/default.nix @@ -15,7 +15,7 @@ let }; in drv' // { meta = meta' // overrideFn meta'; }; - bin = haskell.lib.justStaticExecutables haskellPackages.ShellCheck; + bin = haskell.lib.compose.justStaticExecutables haskellPackages.ShellCheck; shellcheck = stdenv.mkDerivation { pname = "shellcheck"; diff --git a/pkgs/test/haskell/documentationTarball/default.nix b/pkgs/test/haskell/documentationTarball/default.nix index e3214fb49fede..3375102810128 100644 --- a/pkgs/test/haskell/documentationTarball/default.nix +++ b/pkgs/test/haskell/documentationTarball/default.nix @@ -2,9 +2,9 @@ let drv = haskellPackages.vector; - docs = pkgs.haskell.lib.documentationTarball drv; + docs = pkgs.haskell.lib.compose.documentationTarball drv; -in pkgs.runCommand "test haskell.lib.documentationTarball" { +in pkgs.runCommand "test haskell.lib.compose.documentationTarball" { meta = { inherit (docs.meta) platforms; }; diff --git a/pkgs/test/haskell/setBuildTarget/default.nix b/pkgs/test/haskell/setBuildTarget/default.nix index 5a8391d088614..f0c78c5104499 100644 --- a/pkgs/test/haskell/setBuildTarget/default.nix +++ b/pkgs/test/haskell/setBuildTarget/default.nix @@ -17,7 +17,7 @@ let drv = haskellPackages.callPackage pkgDef {}; test = target: excluded: - let only = pkgs.haskell.lib.setBuildTarget drv target; + let only = pkgs.haskell.lib.compose.setBuildTarget target drv; in '' if [[ ! -f "${only}/bin/${target}" ]]; then echo "${target} was not built" @@ -31,7 +31,7 @@ let ''; in -pkgs.runCommand "test haskell.lib.setBuildTarget" { +pkgs.runCommand "test haskell.lib.compose.setBuildTarget" { meta = { inherit (drv.meta) platforms; }; diff --git a/pkgs/tools/graphics/ldgallery/default.nix b/pkgs/tools/graphics/ldgallery/default.nix index 84d179374ae82..1b620656ce5a4 100644 --- a/pkgs/tools/graphics/ldgallery/default.nix +++ b/pkgs/tools/graphics/ldgallery/default.nix @@ -1,7 +1,7 @@ { lib, pkgs, makeWrapper, haskellPackages, haskell, pandoc, imagemagick, CoreServices }: with lib; -with haskell.lib; +with haskell.lib.compose; let ldgallery-viewer = pkgs.callPackage ./viewer { inherit CoreServices; }; @@ -12,7 +12,7 @@ in # making sure that the versions of the compiler and viewer parts are in sync assert ldgallery-compiler.version == versions.majorMinor ldgallery-viewer.version; -justStaticExecutables (overrideCabal ldgallery-compiler (oldAttrs: { +justStaticExecutables (overrideCabal (oldAttrs: { pname = "ldgallery"; # bundled viewer + compiler buildTools = (oldAttrs.buildTools or []) ++ [ makeWrapper pandoc ]; @@ -50,4 +50,4 @@ justStaticExecutables (overrideCabal ldgallery-compiler (oldAttrs: { # other package metadata (maintainer, description, license, ...) # are inherited from the compiler package -})) +}) ldgallery-compiler) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0ed423b6e5738..e6ad689c2d916 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1631,7 +1631,7 @@ with pkgs; ecdsautils = callPackage ../tools/security/ecdsautils { }; - echidna = haskell.lib.justStaticExecutables (haskellPackages.callPackage (../tools/security/echidna) { }); + echidna = haskell.lib.compose.justStaticExecutables (haskellPackages.callPackage (../tools/security/echidna) { }); sedutil = callPackage ../tools/security/sedutil { }; @@ -1781,7 +1781,7 @@ with pkgs; hime = callPackage ../tools/inputmethods/hime {}; - hinit = haskell.lib.justStaticExecutables haskellPackages.hinit; + hinit = haskell.lib.compose.justStaticExecutables haskellPackages.hinit; hostctl = callPackage ../tools/system/hostctl { }; @@ -2308,7 +2308,7 @@ with pkgs; cue2pops = callPackage ../tools/cd-dvd/cue2pops { }; - cabal2nix-unwrapped = haskell.lib.justStaticExecutables (haskell.lib.generateOptparseApplicativeCompletion "cabal2nix" haskellPackages.cabal2nix); + cabal2nix-unwrapped = haskell.lib.compose.justStaticExecutables (haskell.lib.compose.generateOptparseApplicativeCompletion "cabal2nix" haskellPackages.cabal2nix); cabal2nix = symlinkJoin { inherit (cabal2nix-unwrapped) name meta; @@ -2926,7 +2926,7 @@ with pkgs; fsmark = callPackage ../tools/misc/fsmark { }; - futhark = haskell.lib.justStaticExecutables haskellPackages.futhark; + futhark = haskell.lib.compose.justStaticExecutables haskellPackages.futhark; inherit (nodePackages) fx; @@ -3336,7 +3336,7 @@ with pkgs; nix-direnv = callPackage ../tools/misc/nix-direnv { }; nix-direnv-flakes = callPackage ../tools/misc/nix-direnv { enableFlakes = true; }; - nix-output-monitor = haskell.lib.justStaticExecutables (haskellPackages.nix-output-monitor); + nix-output-monitor = haskell.lib.compose.justStaticExecutables (haskellPackages.nix-output-monitor); nix-template = callPackage ../tools/package-management/nix-template { inherit (darwin.apple_sdk.frameworks) Security; @@ -4785,7 +4785,7 @@ with pkgs; uudeview = callPackage ../tools/misc/uudeview { }; - uusi = haskell.lib.justStaticExecutables haskellPackages.uusi; + uusi = haskell.lib.compose.justStaticExecutables haskellPackages.uusi; uutils-coreutils = callPackage ../tools/misc/uutils-coreutils { inherit (python3Packages) sphinx; @@ -6315,7 +6315,7 @@ with pkgs; icemon = libsForQt5.callPackage ../applications/networking/icemon { }; - icepeak = haskell.lib.justStaticExecutables haskellPackages.icepeak; + icepeak = haskell.lib.compose.justStaticExecutables haskellPackages.icepeak; iceshelf = callPackage ../tools/backup/iceshelf { }; @@ -7368,7 +7368,7 @@ with pkgs; inherit (darwin.apple_sdk.frameworks) Foundation; }; - madlang = haskell.lib.justStaticExecutables haskellPackages.madlang; + madlang = haskell.lib.compose.justStaticExecutables haskellPackages.madlang; maeparser = callPackage ../development/libraries/maeparser { }; @@ -7819,7 +7819,7 @@ with pkgs; ngrep = callPackage ../tools/networking/ngrep { }; - neuron-notes = haskell.lib.justStaticExecutables (haskell.lib.generateOptparseApplicativeCompletion "neuron" haskellPackages.neuron); + neuron-notes = haskell.lib.compose.justStaticExecutables (haskell.lib.compose.generateOptparseApplicativeCompletion "neuron" haskellPackages.neuron); ngrok = ngrok-2; @@ -7865,7 +7865,7 @@ with pkgs; nvchecker = with python3Packages; toPythonApplication nvchecker; - nvfetcher = haskell.lib.justStaticExecutables haskellPackages.nvfetcher; + nvfetcher = haskell.lib.compose.justStaticExecutables haskellPackages.nvfetcher; miller = callPackage ../tools/text/miller { }; @@ -8213,7 +8213,7 @@ with pkgs; update-dotdee = with python3Packages; toPythonApplication update-dotdee; - update-nix-fetchgit = haskell.lib.justStaticExecutables haskellPackages.update-nix-fetchgit; + update-nix-fetchgit = haskell.lib.compose.justStaticExecutables haskellPackages.update-nix-fetchgit; update-resolv-conf = callPackage ../tools/networking/openvpn/update-resolv-conf.nix { }; @@ -9573,7 +9573,7 @@ with pkgs; speech-denoiser = callPackage ../applications/audio/speech-denoiser {}; - splot = haskell.lib.justStaticExecutables haskellPackages.splot; + splot = haskell.lib.compose.justStaticExecutables haskellPackages.splot; spotdl = callPackage ../tools/audio/spotdl { }; @@ -9687,13 +9687,13 @@ with pkgs; stuntman = callPackage ../tools/networking/stuntman { }; - stutter = haskell.lib.justStaticExecutables haskellPackages.stutter; + stutter = haskell.lib.compose.justStaticExecutables haskellPackages.stutter; strongswan = callPackage ../tools/networking/strongswan { }; strongswanTNC = strongswan.override { enableTNC = true; }; strongswanNM = strongswan.override { enableNetworkManager = true; }; - stylish-haskell = haskell.lib.justStaticExecutables haskellPackages.stylish-haskell; + stylish-haskell = haskell.lib.compose.justStaticExecutables haskellPackages.stylish-haskell; su = shadow.su; @@ -10474,7 +10474,7 @@ with pkgs; wsmancli = callPackage ../tools/system/wsmancli {}; - wstunnel = haskell.lib.justStaticExecutables haskellPackages.wstunnel; + wstunnel = haskell.lib.compose.justStaticExecutables haskellPackages.wstunnel; wolfebin = callPackage ../tools/networking/wolfebin { python = python2; @@ -10523,7 +10523,7 @@ with pkgs; time = callPackage ../tools/misc/time { }; - tweet-hs = haskell.lib.justStaticExecutables haskellPackages.tweet-hs; + tweet-hs = haskell.lib.compose.justStaticExecutables haskellPackages.tweet-hs; tweeny = callPackage ../development/libraries/tweeny { }; @@ -11457,7 +11457,7 @@ with pkgs; eql = callPackage ../development/compilers/eql {}; - elm2nix = haskell.lib.justStaticExecutables haskellPackages.elm2nix; + elm2nix = haskell.lib.compose.justStaticExecutables haskellPackages.elm2nix; elmPackages = recurseIntoAttrs (callPackage ../development/compilers/elm { inherit (darwin.apple_sdk.frameworks) Security; @@ -11964,14 +11964,14 @@ with pkgs; inherit (haskellPackages) ghc; - cabal-install = haskell.lib.justStaticExecutables haskellPackages.cabal-install; + cabal-install = haskell.lib.compose.justStaticExecutables haskellPackages.cabal-install; - stack = haskell.lib.justStaticExecutables haskellPackages.stack; - hlint = haskell.lib.justStaticExecutables haskellPackages.hlint; + stack = haskell.lib.compose.justStaticExecutables haskellPackages.stack; + hlint = haskell.lib.compose.justStaticExecutables haskellPackages.hlint; - krank = haskell.lib.justStaticExecutables haskellPackages.krank; + krank = haskell.lib.compose.justStaticExecutables haskellPackages.krank; - stylish-cabal = haskell.lib.justStaticExecutables haskellPackages.stylish-cabal; + stylish-cabal = haskell.lib.compose.justStaticExecutables haskellPackages.stylish-cabal; all-cabal-hashes = callPackage ../data/misc/hackage { }; @@ -12326,7 +12326,7 @@ with pkgs; knightos-z80e = callPackage ../development/tools/knightos/z80e { }; - koka = haskell.lib.justStaticExecutables (haskellPackages.callPackage ../development/compilers/koka { }); + koka = haskell.lib.compose.justStaticExecutables (haskellPackages.callPackage ../development/compilers/koka { }); kotlin = callPackage ../development/compilers/kotlin { }; kotlin-native = callPackage ../development/compilers/kotlin/native.nix { }; @@ -13169,19 +13169,19 @@ with pkgs; clooj = callPackage ../development/interpreters/clojure/clooj.nix { }; - dhall = haskell.lib.justStaticExecutables haskellPackages.dhall; + dhall = haskell.lib.compose.justStaticExecutables haskellPackages.dhall; - dhall-bash = haskell.lib.justStaticExecutables haskellPackages.dhall-bash; + dhall-bash = haskell.lib.compose.justStaticExecutables haskellPackages.dhall-bash; - dhall-docs = haskell.lib.justStaticExecutables haskellPackages.dhall-docs; + dhall-docs = haskell.lib.compose.justStaticExecutables haskellPackages.dhall-docs; - dhall-lsp-server = haskell.lib.justStaticExecutables haskellPackages.dhall-lsp-server; + dhall-lsp-server = haskell.lib.compose.justStaticExecutables haskellPackages.dhall-lsp-server; - dhall-json = haskell.lib.justStaticExecutables haskellPackages.dhall-json; + dhall-json = haskell.lib.compose.justStaticExecutables haskellPackages.dhall-json; - dhall-nix = haskell.lib.justStaticExecutables haskellPackages.dhall-nix; + dhall-nix = haskell.lib.compose.justStaticExecutables haskellPackages.dhall-nix; - dhall-text = haskell.lib.justStaticExecutables haskellPackages.dhall-text; + dhall-text = haskell.lib.compose.justStaticExecutables haskellPackages.dhall-text; dhallPackages = recurseIntoAttrs (callPackage ./dhall-packages.nix { }); @@ -14428,7 +14428,7 @@ with pkgs; flootty = callPackage ../development/tools/flootty { }; - fffuu = haskell.lib.justStaticExecutables (haskellPackages.callPackage ../tools/misc/fffuu { }); + fffuu = haskell.lib.compose.justStaticExecutables (haskellPackages.callPackage ../tools/misc/fffuu { }); ffuf = callPackage ../tools/security/ffuf { }; @@ -14596,7 +14596,7 @@ with pkgs; guile = guile_2_0; }; - hadolint = haskell.lib.justStaticExecutables haskellPackages.hadolint; + hadolint = haskell.lib.compose.justStaticExecutables haskellPackages.hadolint; halfempty = callPackage ../development/tools/halfempty {}; @@ -14825,8 +14825,8 @@ with pkgs; msitools = callPackage ../development/tools/misc/msitools { }; - haskell-ci = haskell.lib.justStaticExecutables haskellPackages.haskell-ci; - haskell-ci-unstable = lowPrio (haskell.lib.justStaticExecutables haskellPackages.haskell-ci-unstable); + haskell-ci = haskell.lib.compose.justStaticExecutables haskellPackages.haskell-ci; + haskell-ci-unstable = lowPrio (haskell.lib.compose.justStaticExecutables haskellPackages.haskell-ci-unstable); neoload = callPackage ../development/tools/neoload { licenseAccepted = (config.neoload.accept_license or false); @@ -15116,7 +15116,7 @@ with pkgs; inherit (darwin.apple_sdk.frameworks) Security; }; - shake = haskell.lib.justStaticExecutables haskellPackages.shake; + shake = haskell.lib.compose.justStaticExecutables haskellPackages.shake; shallot = callPackage ../tools/misc/shallot { }; @@ -15692,7 +15692,7 @@ with pkgs; c-blosc = callPackage ../development/libraries/c-blosc { }; # justStaticExecutables is needed due to https://github.com/NixOS/nix/issues/2990 - cachix = haskell.lib.justStaticExecutables haskellPackages.cachix; + cachix = haskell.lib.compose.justStaticExecutables haskellPackages.cachix; hercules-ci-agent = callPackage ../development/tools/continuous-integration/hercules-ci-agent { }; @@ -15700,7 +15700,7 @@ with pkgs; isa-l = callPackage ../development/libraries/isa-l { }; - niv = lib.getBin (haskell.lib.justStaticExecutables haskellPackages.niv); + niv = lib.getBin (haskell.lib.compose.justStaticExecutables haskellPackages.niv); ormolu = haskellPackages.ormolu.bin; @@ -16593,7 +16593,7 @@ with pkgs; glib-testing = callPackage ../development/libraries/glib-testing { }; - glirc = haskell.lib.justStaticExecutables haskellPackages.glirc; + glirc = haskell.lib.compose.justStaticExecutables haskellPackages.glirc; gom = callPackage ../development/libraries/gom { }; @@ -16984,7 +16984,7 @@ with pkgs; json2hcl = callPackage ../development/tools/json2hcl { }; - json2yaml = haskell.lib.justStaticExecutables haskellPackages.json2yaml; + json2yaml = haskell.lib.compose.justStaticExecutables haskellPackages.json2yaml; json-glib = callPackage ../development/libraries/json-glib { }; @@ -18442,7 +18442,7 @@ with pkgs; matio = callPackage ../development/libraries/matio { }; - matterhorn = haskell.lib.justStaticExecutables haskellPackages.matterhorn; + matterhorn = haskell.lib.compose.justStaticExecutables haskellPackages.matterhorn; maxflow = callPackage ../development/libraries/maxflow { }; @@ -18929,7 +18929,7 @@ with pkgs; pkgdiff = callPackage ../tools/misc/pkgdiff { }; - place-cursor-at = haskell.lib.justStaticExecutables haskellPackages.place-cursor-at; + place-cursor-at = haskell.lib.compose.justStaticExecutables haskellPackages.place-cursor-at; plib = callPackage ../development/libraries/plib { }; @@ -19205,7 +19205,7 @@ with pkgs; kissfft = callPackage ../development/libraries/kissfft { }; lambdabot = callPackage ../development/tools/haskell/lambdabot { - haskellLib = haskell.lib; + haskellLib = haskell.lib.compose; }; lambda-mod-zsh-theme = callPackage ../shells/zsh/lambda-mod-zsh-theme { }; @@ -20628,7 +20628,7 @@ with pkgs; hashi-ui = callPackage ../servers/hashi-ui {}; - hasura-graphql-engine = haskell.lib.justStaticExecutables haskellPackages.graphql-engine; + hasura-graphql-engine = haskell.lib.compose.justStaticExecutables haskellPackages.graphql-engine; hasura-cli = callPackage ../servers/hasura/cli.nix { }; @@ -21384,7 +21384,7 @@ with pkgs; sogo = callPackage ../servers/web-apps/sogo { }; spacecookie = - haskell.lib.justStaticExecutables haskellPackages.spacecookie; + haskell.lib.compose.justStaticExecutables haskellPackages.spacecookie; spawn_fcgi = callPackage ../servers/http/spawn-fcgi { }; @@ -24290,9 +24290,9 @@ with pkgs; dablin = callPackage ../applications/radio/dablin { }; - darcs = haskell.lib.overrideCabal (haskell.lib.justStaticExecutables haskellPackages.darcs) (drv: { + darcs = haskell.lib.compose.overrideCabal (drv: { configureFlags = (lib.remove "-flibrary" drv.configureFlags or []) ++ ["-f-library"]; - }); + }) (haskell.lib.compose.justStaticExecutables haskellPackages.darcs); darcs-to-git = callPackage ../applications/version-management/git-and-tools/darcs-to-git { }; @@ -25500,12 +25500,12 @@ with pkgs; hivelytracker = callPackage ../applications/audio/hivelytracker { }; - hledger = haskell.lib.justStaticExecutables haskellPackages.hledger; + hledger = haskell.lib.compose.justStaticExecutables haskellPackages.hledger; hledger-check-fancyassertions = callPackage ../applications/office/hledger-check-fancyassertions { }; - hledger-iadd = haskell.lib.justStaticExecutables haskellPackages.hledger-iadd; - hledger-interest = haskell.lib.justStaticExecutables haskellPackages.hledger-interest; - hledger-ui = haskell.lib.justStaticExecutables haskellPackages.hledger-ui; - hledger-web = haskell.lib.justStaticExecutables haskellPackages.hledger-web; + hledger-iadd = haskell.lib.compose.justStaticExecutables haskellPackages.hledger-iadd; + hledger-interest = haskell.lib.compose.justStaticExecutables haskellPackages.hledger-interest; + hledger-ui = haskell.lib.compose.justStaticExecutables haskellPackages.hledger-ui; + hledger-web = haskell.lib.compose.justStaticExecutables haskellPackages.hledger-web; homebank = callPackage ../applications/office/homebank { gtk = gtk3; @@ -25523,7 +25523,7 @@ with pkgs; hdl-dump = callPackage ../tools/misc/hdl-dump { }; - hpack = haskell.lib.justStaticExecutables haskellPackages.hpack; + hpack = haskell.lib.compose.justStaticExecutables haskellPackages.hpack; hpcg = callPackage ../tools/misc/hpcg/default.nix { }; @@ -25594,7 +25594,7 @@ with pkgs; pinboard = with python3Packages; toPythonApplication pinboard; - pinboard-notes-backup = haskell.lib.justStaticExecutables haskellPackages.pinboard-notes-backup; + pinboard-notes-backup = haskell.lib.compose.justStaticExecutables haskellPackages.pinboard-notes-backup; pixelnuke = callPackage ../applications/graphics/pixelnuke { }; @@ -28204,7 +28204,7 @@ with pkgs; teamspeak_client = libsForQt5.callPackage ../applications/networking/instant-messengers/teamspeak/client.nix { }; teamspeak_server = callPackage ../applications/networking/instant-messengers/teamspeak/server.nix { }; - taskell = haskell.lib.justStaticExecutables haskellPackages.taskell; + taskell = haskell.lib.compose.justStaticExecutables haskellPackages.taskell; tap-plugins = callPackage ../applications/audio/tap-plugins { }; @@ -28507,7 +28507,7 @@ with pkgs; uroboros = callPackage ../tools/system/uroboros { }; - uuagc = haskell.lib.justStaticExecutables haskellPackages.uuagc; + uuagc = haskell.lib.compose.justStaticExecutables haskellPackages.uuagc; uucp = callPackage ../tools/misc/uucp { }; @@ -29702,7 +29702,7 @@ with pkgs; bean-add = callPackage ../applications/office/beancount/bean-add.nix { }; - bench = haskell.lib.justStaticExecutables haskellPackages.bench; + bench = haskell.lib.compose.justStaticExecutables haskellPackages.bench; beret = callPackage ../games/beret { }; @@ -32413,9 +32413,9 @@ with pkgs; nix-bundle = callPackage ../tools/package-management/nix-bundle { }; - nix-delegate = haskell.lib.justStaticExecutables haskellPackages.nix-delegate; - nix-deploy = haskell.lib.justStaticExecutables haskellPackages.nix-deploy; - nix-diff = haskell.lib.justStaticExecutables haskellPackages.nix-diff; + nix-delegate = haskell.lib.compose.justStaticExecutables haskellPackages.nix-delegate; + nix-deploy = haskell.lib.compose.justStaticExecutables haskellPackages.nix-deploy; + nix-diff = haskell.lib.compose.justStaticExecutables haskellPackages.nix-diff; nix-du = callPackage ../tools/package-management/nix-du { inherit (darwin.apple_sdk.frameworks) Security; @@ -32429,7 +32429,7 @@ with pkgs; }; nix-index = callPackage ../tools/package-management/nix-index/wrapper.nix { }; - nix-linter = haskell.lib.justStaticExecutables (haskellPackages.nix-linter); + nix-linter = haskell.lib.compose.justStaticExecutables (haskellPackages.nix-linter); nixos-option = callPackage ../tools/nix/nixos-option { }; @@ -32460,7 +32460,7 @@ with pkgs; nix-top = callPackage ../tools/package-management/nix-top { }; - nix-tree = haskell.lib.justStaticExecutables (haskellPackages.nix-tree); + nix-tree = haskell.lib.compose.justStaticExecutables (haskellPackages.nix-tree); nix-universal-prefetch = callPackage ../tools/package-management/nix-universal-prefetch { }; @@ -32476,7 +32476,7 @@ with pkgs; nix-simple-deploy = callPackage ../tools/package-management/nix-simple-deploy { }; - nixfmt = haskell.lib.justStaticExecutables haskellPackages.nixfmt; + nixfmt = haskell.lib.compose.justStaticExecutables haskellPackages.nixfmt; nixpkgs-fmt = callPackage ../tools/nix/nixpkgs-fmt { }; diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 3b89aabf1fd1f..4f6567ca230a5 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -19,13 +19,13 @@ let "ghcHEAD" ]; - haskellLib = import ../development/haskell-modules/lib.nix { + haskellLibUncomposable = import ../development/haskell-modules/lib.nix { inherit (pkgs) lib; inherit pkgs; }; callPackage = newScope { - inherit haskellLib; + haskellLib = haskellLibUncomposable.compose; overrides = pkgs.haskell.packageOverrides; }; @@ -44,7 +44,7 @@ let inherit (pkgs.haskell) compiler packages; in { - lib = haskellLib; + lib = haskellLibUncomposable; package-list = callPackage ../development/haskell-modules/package-list.nix {};