diff --git a/cabal.project b/cabal.project
index 8ba70adfabacd333875604fab5c369a8e059a30e..7923c75d6090c64ae3926ebd5663b64fd6336df1 100644
--- a/cabal.project
+++ b/cabal.project
@@ -1,3 +1,10 @@
 packages: .
           https://whetstone.private.storage/privatestorage/tahoe-chk/-/archive/0.1.0.0/tahoe-chk-0.1.0.0.tar.gz
           https://whetstone.private.storage/privatestorage/tahoe-great-black-swamp/-/archive/0.1.0.1/tahoe-great-black-swamp-0.1.0.1.tar.gz
+
+package zlib
+        -- Turn on discovery of the underlying zlib using pkg-config.  This
+        -- fixes build failures when the underlying zlib is not in the
+        -- traditional location but is discoverable with pkg-config.  It might
+        -- break non-pkg-config platforms.
+        flags: +pkg-config
diff --git a/flake.nix b/flake.nix
index c0573fbe80a4adbbdbbaebd6259021e350a25be4..fd06ef7df7cf6a96e865dbf1c7b95f1947bdbe50 100644
--- a/flake.nix
+++ b/flake.nix
@@ -28,7 +28,6 @@
         compilerVersion = ghcVersion;
         packageName = "gbs-downloader";
         hsPkgsOverrides = import ./nix/haskell-packages.nix {
-          inherit pkgs;
           haskellLib = pkgs.haskell.lib;
         };
       };
diff --git a/gbs-downloader.cabal b/gbs-downloader.cabal
index d247f4e8ce613b685b1c4b6a74450669ce2e4e6d..8d377001b6a0f7437ef008f13a615b2108909641 100644
--- a/gbs-downloader.cabal
+++ b/gbs-downloader.cabal
@@ -75,7 +75,7 @@ library
     , language
 
   -- Modules exported by the library.
-  exposed-modules:   Tahoe.Download
+  exposed-modules:  Tahoe.Download
 
   -- Modules included in this library but not exported.
   -- other-modules:
@@ -94,16 +94,10 @@ library
     , text
 
   -- Directories containing source files.
-  hs-source-dirs:    src
+  hs-source-dirs:   src
 
   -- Base language which the package is written in.
-  default-language:  Haskell2010
-
-  -- We don't directly depend on zlib but we transitively depend on it through
-  -- some Haskell library that (I think) doesn't bother to declare a pkgconfig
-  -- dependency - so the build fails if zlib isn't in just the right place
-  -- unless we add this.
-  pkgconfig-depends: zlib
+  default-language: Haskell2010
 
 executable gbs-download
   -- Import common warning flags.
diff --git a/nix/haskell-packages.nix b/nix/haskell-packages.nix
index 834ddd811b37b4157b87d57579679ba46ef3b9f5..0411c50574ae51acb05dd80f11bd70435fdebcfe 100644
--- a/nix/haskell-packages.nix
+++ b/nix/haskell-packages.nix
@@ -1,23 +1,8 @@
-{
-  pkgs,
-  haskellLib,
-}: hfinal: hprev: {
+{haskellLib}: hfinal: hprev: {
   tahoe-chk = hfinal.callPackage ./tahoe-chk.nix {};
   tahoe-great-black-swamp = hfinal.callPackage ./tahoe-great-black-swamp.nix {};
 
   # A broken dependency of a tahoe-great-black-swamp executable that we don't
   # use.  Flip the broken bit so we can get a build.
   language-ecmascript = haskellLib.unmarkBroken hprev.language-ecmascript;
-
-  # hs-flake-utils does a callCabal2nix for us but we can't use it because we
-  # need to overide an argument.  This overlay runs before the hs-flake-utils
-  # overlay (a mistake?) so we can't even use hprev.gbs-downloader.override -
-  # we just have to re-do it all ourselves.
-  gbs-downloader = hfinal.callCabal2nix "gbs-downloader" ../. {
-    # cabal2nix gives the generated nix expression a `zlib` parameter which is
-    # then satisfied *from the Haskell package set* because there is a zlib
-    # package there and it gets precedence over the zlib in the top-level
-    # package set.  Then the build fails because that's not the zlib we want.
-    inherit (pkgs) zlib;
-  };
 }