From fca7f4812535fd571520fc646943dec152830c50 Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Wed, 16 Aug 2023 15:26:07 -0400
Subject: [PATCH] take release and cabal-test apps from hs-flake-utils

---
 flake.lock |  8 ++++----
 flake.nix  | 42 +++++++++++-------------------------------
 2 files changed, 15 insertions(+), 35 deletions(-)

diff --git a/flake.lock b/flake.lock
index fd61df1..6574b59 100644
--- a/flake.lock
+++ b/flake.lock
@@ -500,11 +500,11 @@
         "pre-commit-hooks": "pre-commit-hooks"
       },
       "locked": {
-        "lastModified": 1686149618,
-        "narHash": "sha256-/IHWacNutk3tklouWOgClp7FnOH+Yk6If13kKJMSEi8=",
+        "lastModified": 1692187439,
+        "narHash": "sha256-m7c4EPFWmB1OmV3dSYQk2qtXR53xOjZdLCjMtzHSK34=",
         "ref": "main",
-        "rev": "49696f704eb965f57d729871c6d450ac0aff2b68",
-        "revCount": 12,
+        "rev": "408f3deab2e2f6ae60349776dde02c44f71fb386",
+        "revCount": 16,
         "type": "git",
         "url": "https://whetstone.private.storage/jcalderone/hs-flake-utils.git"
       },
diff --git a/flake.nix b/flake.nix
index 794d0ed..bece45b 100644
--- a/flake.nix
+++ b/flake.nix
@@ -124,40 +124,20 @@
         }/bin/entr-test";
       };
 
+      apps.release = hslib.apps.release {};
+
       # Using the working directory of `nix run`, do a build with cabal and
       # then run the test suite.
-      apps.cabal-test = {
-        type = "app";
-        program = "${
-          pkgs.writeShellApplication {
-            name = "cabal-build-and-test";
-            # Only put packages with things that need to be on PATH here
-            # because that's all that runtimeInputs buys us.  Packages with
-            # different requirements need to be handled differently.
-            runtimeInputs = with pkgs; [
-              pkg-config
-              haskell.compiler.${ghcVersion}
-              cabal-install
-            ];
-
-            text = ''
-              nix run .#generate-cabal-project
-
-              # 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]}
-
-              # Get (or update if we have one) a package database so cabal can
-              # solve our dependencies.
-              cabal update hackage.haskell.org
+      apps.cabal-test = hslib.apps.cabal-test {
+        preBuild = ''
+          # Refresh the cabal.project.local file to point to the correct
+          # dependencies, if necessary.
+          nix run .#generate-cabal-project
 
-              # Run the default test suite.  The local cabal project file
-              # written above should have enabled tests so the build plan will
-              # support them.
-              cabal run tests
-            '';
-          }
-        }/bin/cabal-build-and-test";
+          # 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]}
+        '';
       };
     });
 }
-- 
GitLab