From 2afdd41b09612443cd764af08aed0b8b4dc44004 Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Wed, 7 Jun 2023 11:04:00 -0400
Subject: [PATCH] Use the new hs-flake-utils to auto-generate cabal dependency
 config

If you are not using nix then you'll have to figure it out yourself, sorrrrryy.
---
 cabal.project | 15 ---------------
 flake.lock    |  8 ++++----
 flake.nix     | 15 ++++++++++++++-
 3 files changed, 18 insertions(+), 20 deletions(-)
 delete mode 100644 cabal.project

diff --git a/cabal.project b/cabal.project
deleted file mode 100644
index 760e76b..0000000
--- a/cabal.project
+++ /dev/null
@@ -1,15 +0,0 @@
-packages: .
-          -- These aren't released on hackage yet so we have to grab them
-          -- straight from the vcs host.  Probably should do some releases
-          -- soon.
-          https://whetstone.private.storage/privatestorage/tahoe-ssk/-/archive/0.2.0.0/tahoe-ssk-0.2.0.0.tar.gz
-          https://whetstone.private.storage/privatestorage/tahoe-chk/-/archive/0.1.0.1/tahoe-chk-0.1.0.1.tar.gz
-          https://whetstone.private.storage/privatestorage/tahoe-great-black-swamp/-/archive/0.3.0.0/tahoe-great-black-swamp-0.3.0.0.tar.gz
-          ../tahoe-directory
-
-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.lock b/flake.lock
index 605b213..fbc6412 100644
--- a/flake.lock
+++ b/flake.lock
@@ -285,11 +285,11 @@
         "pre-commit-hooks": "pre-commit-hooks"
       },
       "locked": {
-        "lastModified": 1681762240,
-        "narHash": "sha256-+PLx9xHBvV70dA7Gy/+YTH1w3PcSOrGV0z0rGxts8jU=",
+        "lastModified": 1686149618,
+        "narHash": "sha256-/IHWacNutk3tklouWOgClp7FnOH+Yk6If13kKJMSEi8=",
         "ref": "main",
-        "rev": "a51e591b7fdf8881ac0237452691df7b1aceecd3",
-        "revCount": 10,
+        "rev": "49696f704eb965f57d729871c6d450ac0aff2b68",
+        "revCount": 12,
         "type": "git",
         "url": "https://whetstone.private.storage/jcalderone/hs-flake-utils.git"
       },
diff --git a/flake.nix b/flake.nix
index 28d1100..5f26dca 100644
--- a/flake.nix
+++ b/flake.nix
@@ -57,6 +57,19 @@
     in {
       checks = hslib.checks {};
       devShells = hslib.devShells {
+        shellHook = ''
+          cat >cabal.project.local <<EOF
+          # This file is auto-generated by the flake devShell's shellHook.  Do
+          # not edit this file.  Make changes in flake.nix.
+          packages:
+            .
+            -- These aren't released on hackage yet so we have to get them
+            -- another way.  Here, we get them from the Nix store.
+            ${tahoe-ssk} -- tahoe-ssk
+            ${tahoe-chk} -- tahoe-chk
+            ${tahoe-great-black-swamp} -- tahoe-great-black-swamp
+          EOF
+        '';
         extraBuildInputs = pkgs:
           with pkgs; [
             # We configure cabal to use zlib:pkg-config so we better supply
@@ -82,7 +95,7 @@
             ];
 
             text = ''
-            find . -iname '*.hs' -or -iname '*.cabal' | entr bash -c "cabal run tests; if [ \$? != 0 ]; then printf '\e[31m%s\e[0m\n' \"FAILED: \$?\"; else printf '\e[32m%s\e[0m\n' 'SUCCESS'; fi"
+              find . -iname '*.hs' -or -iname '*.cabal' | entr bash -c "cabal run tests; if [ \$? != 0 ]; then printf '\e[31m%s\e[0m\n' \"FAILED: \$?\"; else printf '\e[32m%s\e[0m\n' 'SUCCESS'; fi"
             '';
           }
         }/bin/entr-test";
-- 
GitLab