summary refs log tree commit diff
path: root/pkgs/development/haskell-modules/configuration-common.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/haskell-modules/configuration-common.nix')
-rw-r--r--pkgs/development/haskell-modules/configuration-common.nix368
1 files changed, 185 insertions, 183 deletions
diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix
index 7bf11fa2a45..6ce3c9cdb59 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 <http://www.phash.org/>.
   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 <<EOT
 "YEAR","REGION","STATEFIP","DENSITY","METRO","PUMA","PERWT","SEX","AGE","RACE","RACED","HISPAN","HISPAND","CITIZEN","LANGUAGE","LANGUAGED","SPEAKENG","EDUC","EDUCD","GRADEATT","GRADEATTD","EMPSTAT","EMPSTATD","INCTOT","INCSS","POVERTY"
 2006,32,1,409.6,3,2300,87.0,1,47,1,100,0,0,0,1,100,3,6,65,0,0,1,12,36000,0,347
 EOT
-    ''; });
+    ''; }) (super.Frames-streamly.override { relude = super.relude_1_0_0_1; });
 
   # 2021-05-09: compilation requires patches from master,
   # remove at next release (current is 0.1.0.4).
-  large-hashable = overrideCabal super.large-hashable (drv: {
+  large-hashable = overrideCabal (drv: {
     # fix line endings which are an issue all of a sudden for an unknown reason
     prePatch = ''
       find . -type f -print0 | xargs -0 ${pkgs.buildPackages.dos2unix}/bin/dos2unix
@@ -1862,13 +1864,13 @@ EOT
         sha256 = "1sf9h3k8jbbgfshzrclaawlwx7k2frb09z2a64f93jhvk6ci6vgx";
       })
     ];
-  });
+  }) super.large-hashable;
 
   # BSON defaults to requiring network instead of network-bsd which is
   # required nowadays: https://github.com/mongodb-haskell/bson/issues/26
-  bson = appendConfigureFlag (super.bson.override {
+  bson = appendConfigureFlag "-f-_old_network" (super.bson.override {
     network = self.network-bsd;
-  }) "-f-_old_network";
+  });
 
   # 2021-05-14: Testsuite is failing.
   # https://github.com/kcsongor/generic-lens/issues/133
@@ -1876,7 +1878,7 @@ EOT
 
   # 2021-05-19: Allow random 1.2.0
   # Remove at (presumably next release) which is > 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