From 08cd40d1bc6f9158d9cce379b6e8c7f0edbe102a Mon Sep 17 00:00:00 2001 From: Jens Nolte <git@queezle.net> Date: Fri, 25 Feb 2022 00:37:09 +0100 Subject: [PATCH] Automatically load dependencies for ghcid scripts --- flake.nix | 1 + ghcid | 2 +- ghcid-warnings | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100755 ghcid-warnings diff --git a/flake.nix b/flake.nix index 684b76a..84bbd52 100644 --- a/flake.nix +++ b/flake.nix @@ -31,6 +31,7 @@ packages = [ pkgs.cabal-install pkgs.ghcid + pkgs.entr pkgs.haskell-language-server ]; } diff --git a/ghcid b/ghcid index c597228..c240465 100755 --- a/ghcid +++ b/ghcid @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/usr/bin/env -S nix shell . -c zsh print -P %F{yellow}Cleaning repository%f nix develop -c cabal clean diff --git a/ghcid-warnings b/ghcid-warnings new file mode 100755 index 0000000..c730cf0 --- /dev/null +++ b/ghcid-warnings @@ -0,0 +1,15 @@ +#!/usr/bin/env -S nix shell . -c zsh + +print -P %F{yellow}Cleaning repository%f +nix develop -c cabal clean + +(git ls-files test; git ls-files '*.cabal'; git ls-files 'flake.*') | \ + entr -r \ + nix develop -c \ + ghcid \ + "--command=cabal repl lib:quasar" \ + "--test=:! \ + cabal test --disable-optimisation --enable-debug-info=2 --test-show-details=direct --ghc-option -fdiagnostics-color=always && \ + cabal build --disable-optimisation --enable-debug-info=2 --ghc-option -fdiagnostics-color=always && \ + zsh -c 'print -P %F{green}Build and tests passed%f' \ + " -- GitLab