From 7be69ea092d253620315b3dd8b4693b2efa2e300 Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Tue, 25 Apr 2023 15:22:18 -0400
Subject: [PATCH] Get zlib onto PKG_CONFIG_PATH for the cabal-test flake app

---
 flake.nix | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/flake.nix b/flake.nix
index 8943f3c..95bd2f5 100644
--- a/flake.nix
+++ b/flake.nix
@@ -49,11 +49,21 @@
         program = "${
           pkgs.writeShellApplication {
             name = "cabal-build-and-test";
-            runtimeInputs = with pkgs; [pkg-config haskell.compiler.${ghcVersion} cabal-install zlib];
+            # Only put packages with things that need to be on PATH here
+            # because that's all t hat runtimeInputs buys us.  Packages with
+            # different requirements need to be handled differently.
+            runtimeInputs = with pkgs; [
+              pkg-config
+              haskell.compiler.${ghcVersion}
+              cabal-install
+            ];
 
             text = ''
+              # Here we make zlib discoverable by pkg-config so cabal can find
+              # headers and stuff.
+              export PKG_CONFIG_PATH=${pkgs.lib.makeSearchPath "lib/pkgconfig" [pkgs.zlib.dev]}
+
               cabal update hackage.haskell.org
-              cabal build --enable-tests
               cabal run gbs-downloader-test
             '';
           }
-- 
GitLab