From a906ab7da4bac2b6e6a0601d5904f33dea7899f7 Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Tue, 10 Oct 2023 10:53:56 -0400
Subject: [PATCH] Use hs-flake-utils to write the cabal.project.local file

---
 flake.nix | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/flake.nix b/flake.nix
index f1e6ea9..36cdd0f 100644
--- a/flake.nix
+++ b/flake.nix
@@ -54,7 +54,7 @@
       checks = hslib.checks {};
       devShells = hslib.devShells {
         shellHook = ''
-          nix run .#generate-cabal-project
+          nix run .#write-cabal-project
         '';
         extraBuildInputs = pkgs:
           with pkgs; [
@@ -64,27 +64,18 @@
       packages = hslib.packages {};
       apps.hlint = hslib.apps.hlint {};
 
-      apps.generate-cabal-project = {
-        type = "app";
-        program = "${
-          pkgs.writeShellApplication {
-            name = "generate-cabal-project";
-            text = ''
-              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.
-              tests: true
-              EOF
-            '';
-          }
-        }/bin/generate-cabal-project";
+      apps.write-cabal-project = hslib.apps.write-cabal-project {
+        localPackages = {
+          "tahoe-chk" = tahoe-chk.sourceInfo.outPath;
+          "tahoe-ssk" = tahoe-ssk.sourceInfo.outPath;
+        };
       };
 
       # Using the working directory of `nix run`, do a build with cabal and
       # then run the test suite.
       apps.cabal-test = hslib.apps.cabal-test {
         preBuild = ''
-          nix run .#generate-cabal-project
+          nix run .#write-cabal-project
         '';
       };
 
-- 
GitLab