From 3d2cc3dad4729d54c44254c3980e7e97c998cf41 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Wed, 7 Jun 2023 14:42:31 -0400 Subject: [PATCH] make it work on CI which doesn't enter the dev shell, too --- flake.nix | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/flake.nix b/flake.nix index d372c3a..83a55da 100644 --- a/flake.nix +++ b/flake.nix @@ -40,16 +40,7 @@ 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. - tests: true - 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-chk - ${tahoe-chk} - EOF + nix run .#generate-cabal-project ''; extraBuildInputs = pkgs: with pkgs; [ @@ -59,6 +50,27 @@ 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 + 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-chk + ${tahoe-chk} + EOF + ''; + } + }/bin/generate-cabal-project"; + }; + # Using the working directory of `nix run`, do a build with cabal and # then run the test suite. apps.cabal-test = { @@ -69,6 +81,7 @@ runtimeInputs = with pkgs; [pkg-config haskell.compiler.${ghcVersion} cabal-install]; text = '' + nix run .#generate-cabal-project cabal update hackage.haskell.org cabal build all cabal run tests -- GitLab