about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/haskell-modules/configuration-nix.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/haskell-modules/configuration-nix.nix')
-rw-r--r--nixpkgs/pkgs/development/haskell-modules/configuration-nix.nix469
1 files changed, 261 insertions, 208 deletions
diff --git a/nixpkgs/pkgs/development/haskell-modules/configuration-nix.nix b/nixpkgs/pkgs/development/haskell-modules/configuration-nix.nix
index 5fc968ccddeb..86a60fd9097a 100644
--- a/nixpkgs/pkgs/development/haskell-modules/configuration-nix.nix
+++ b/nixpkgs/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;
@@ -155,8 +155,9 @@ self: super: builtins.intersectAttrs super {
   github-types = dontCheck super.github-types;          # http://hydra.cryp.to/build/1114046/nixlog/1/raw
   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-interpolate = dontCheck super.hasql-interpolate; # wants to connect to postgresql
   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 +204,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 +219,48 @@ 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);
+  xmonad_0_17_0 = doDistribute (appendPatch ./patches/xmonad_0_17_0-nix.patch (super.xmonad_0_17_0));
+
+  # Need matching xmonad version
+  xmonad-contrib_0_17_0 = doDistribute (super.xmonad-contrib_0_17_0.override {
+    xmonad = self.xmonad_0_17_0;
+  });
+
+  xmonad-extras_0_17_0 = doDistribute (super.xmonad-extras_0_17_0.override {
+    xmonad = self.xmonad_0_17_0;
+    xmonad-contrib = self.xmonad-contrib_0_17_0;
+  });
 
   # 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 +269,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 +284,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 +295,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 +344,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 +361,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 +389,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 +414,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,40 +482,43 @@ 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
-      sed -i -e 's|"cvc4"|"${pkgs.cvc4}/bin/cvc4"|' Data/SBV/Provers/CVC4.hs
       sed -i -e 's|"yices-smt2"|"${pkgs.yices}/bin/yices-smt2"|' Data/SBV/Provers/Yices.hs
       sed -i -e 's|"z3"|"${pkgs.z3}/bin/z3"|' Data/SBV/Provers/Z3.hs
-
+    '' + (if pkgs.stdenv.isAarch64 then ''
+      sed -i -e 's|\[abc, boolector, cvc4, mathSAT, yices, z3, dReal\]|[abc, boolector, yices, z3]|' SBVTestSuite/SBVConnectionTest.hs
+    ''
+    else ''
+      sed -i -e 's|"cvc4"|"${pkgs.cvc4}/bin/cvc4"|' Data/SBV/Provers/CVC4.hs
       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,27 +528,33 @@ self: super: builtins.intersectAttrs super {
         mkdir -p $out/share/man/man1
         mv docs/_build/man/*.1 $out/share/man/man1/
         '';
-      });
-
-  git-annex = with pkgs;
-    if (!stdenv.isLinux) then
-      let path = lib.makeBinPath [ coreutils ];
-      in overrideCabal (addBuildTool super.git-annex buildPackages.makeWrapper) (_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
-        postPatch = lib.optionalString stdenv.isDarwin ''
-          substituteInPlace Test.hs \
-            --replace ', testCase "crypto" test_crypto' ""
-        '';
-        # On Darwin, git-annex mis-detects options to `cp`, so we wrap the
-        # binary to ensure it uses Nixpkgs' coreutils.
-        postFixup = ''
-          wrapProgram $out/bin/git-annex \
-            --prefix PATH : "${path}"
-        '';
       })
-    else super.git-annex;
+      (addBuildTools (with pkgs.buildPackages; [makeWrapper python3Packages.sphinx]) super.futhark);
+
+  git-annex = let
+    pathForDarwin = pkgs.lib.makeBinPath [ pkgs.coreutils ];
+  in overrideCabal (drv: pkgs.lib.optionalAttrs (!pkgs.stdenv.isLinux) {
+    # 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
+    postPatch = pkgs.lib.optionalString pkgs.stdenv.isDarwin ''
+      substituteInPlace Test.hs \
+        --replace ', testCase "crypto" test_crypto' ""
+    '' + (drv.postPatch or "");
+    # On Darwin, git-annex mis-detects options to `cp`, so we wrap the
+    # binary to ensure it uses Nixpkgs' coreutils.
+    postFixup = ''
+      wrapProgram $out/bin/git-annex \
+        --prefix PATH : "${pathForDarwin}"
+    '' + (drv.postFixup or "");
+    buildTools = [
+      pkgs.buildPackages.makeWrapper
+    ] ++ (drv.buildTools or []);
+  }) (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;
+  });
 
   # The test suite has undeclared dependencies on git.
   githash = dontCheck super.githash;
@@ -559,8 +580,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 +605,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 +613,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 +645,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 +659,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 +671,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 +684,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 +699,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 +717,20 @@ self: super: builtins.intersectAttrs super {
   postgresql-libpq-notify = dontCheck super.postgresql-libpq-notify;
   postgresql-pure = dontCheck super.postgresql-pure;
 
-  retrie = overrideCabal super.retrie (drv: {
-    testToolDepends = [ pkgs.git pkgs.mercurial ];
-  });
+  retrie = overrideCabal (drv: {
+    testToolDepends = [ pkgs.git pkgs.mercurial ] ++ drv.testToolDepends or [];
+  }) super.retrie;
 
-  nix-output-monitor = overrideCabal super.nix-output-monitor {
+  retrie_1_2_0_0 = overrideCabal (drv: {
+    testToolDepends = [ pkgs.git pkgs.mercurial ] ++ drv.testToolDepends or [];
+  }) super.retrie_1_2_0_0;
+
+  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 +738,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 +754,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 +766,158 @@ 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;
+  hls-hlint-plugin = overrideCabal (drv: {
+    testToolDepends = [ pkgs.git ];
+    preCheck = ''
+      export HOME=$TMPDIR/home
+    '';
+  }) super.hls-hlint-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 +928,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 +938,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 +962,20 @@ self: super: builtins.intersectAttrs super {
           pkgs.lib.makeBinPath [ pkgs.nvchecker pkgs.nix-prefetch-git ]
         }"
       '';
-    }));
+    }) super.nvfetcher);
+
+  rel8 = addTestToolDepend pkgs.postgresql super.rel8;
 
-  rel8 = addTestToolDepend super.rel8 pkgs.postgresql;
+  cachix = generateOptparseApplicativeCompletion "cachix" (super.cachix.override { nix = pkgs.nix_2_4; });
 
-  cachix = generateOptparseApplicativeCompletion "cachix" super.cachix;
+  hercules-ci-agent = appendConfigureFlag "-fnix-2_4" (super.hercules-ci-agent.override { nix = pkgs.nix_2_4; });
+  hercules-ci-cnix-expr = appendConfigureFlag "-fnix-2_4" (super.hercules-ci-cnix-expr.override { nix = pkgs.nix_2_4; });
+  hercules-ci-cnix-store = appendConfigureFlag "-fnix-2_4" (super.hercules-ci-cnix-store.override { nix = pkgs.nix_2_4; });
 
   # 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 +983,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 +999,7 @@ self: super: builtins.intersectAttrs super {
         postInstall = ''
           installManPage man/atsfmt.1
         '' + (drv.postInstall or "");
-      })
+      }) super.ats-format
     )
   );
 
@@ -974,10 +1009,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 +1020,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 +1029,23 @@ self: super: builtins.intersectAttrs super {
         unset doCheck
       fi
     '' + (drv.postConfigure or "");
-  });
+  }) super.procex;
+
+  # Apply a patch which hardcodes the store path of graphviz instead of using
+  # whatever graphviz is in PATH.
+  graphviz = overrideCabal (drv: {
+    patches = [
+      (pkgs.substituteAll {
+        src = ./patches/graphviz-hardcode-graphviz-store-path.patch;
+        inherit (pkgs) graphviz;
+      })
+    ] ++ (drv.patches or []);
+  }) super.graphviz;
+
+  # Test case tries to contact the network
+  http-api-data-qq = overrideCabal (drv: {
+    testFlags = [
+      "-p" "!/Can be used with http-client/"
+    ] ++ drv.testFlags or [];
+  }) super.http-api-data-qq;
 }