diff --git a/Makefile b/Makefile index feb2a3d..e155973 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ -SHELL := /usr/bin/env bash +# This really ought to be `/usr/bin/env bash`, but nix flakes don't like that. +SHELL := /bin/sh .PHONY: hoogle format haddock usage @@ -10,7 +11,7 @@ usage: @echo " format -- Format the project" @echo " haddock -- Generate Haddock docs for project" -hoogle: +hoogle: hoogle generate --local=haddock --database=hoo/local.hoo hoogle server --local -p 8081 >> /dev/null & hoogle server --local --database=hoo/local.hoo -p 8082 >> /dev/null & @@ -21,5 +22,8 @@ format: git ls-tree -r HEAD --full-tree --name-only | grep -E '.*\.nix' | xargs nixfmt git ls-tree -r HEAD --full-tree --name-only | grep -E '.*\.cabal' | xargs cabal-fmt -i +format_check: + find -name '*.hs' -not -path './dist-*/*' | xargs fourmolu $(FORMAT_EXTENSIONS) -m check + haddock: cabal haddock --haddock-html --haddock-hoogle --builddir=haddock diff --git a/agora.cabal b/agora.cabal index 23748b3..11dc271 100644 --- a/agora.cabal +++ b/agora.cabal @@ -148,11 +148,9 @@ test-suite agora-test main-is: Spec.hs hs-source-dirs: agora-test other-modules: - Spec.Stake - Spec.Sample.Stake - Spec.Model.MultiSig - + Spec.Sample.Stake + Spec.Stake Spec.Util build-depends: agora diff --git a/flake.nix b/flake.nix index fdf0dd8..87fabb1 100644 --- a/flake.nix +++ b/flake.nix @@ -93,9 +93,9 @@ pkgs = nixpkgsFor system; pkgs' = nixpkgsFor' system; inherit (pkgs.haskell-nix.tools ghcVersion { - inherit (plutarch.tools) fourmolu hlint; + inherit (plutarch.tools) fourmolu; }) - fourmolu hlint; + fourmolu; in pkgs.runCommand "format-check" { nativeBuildInputs = [ pkgs'.git @@ -103,14 +103,13 @@ pkgs'.haskellPackages.cabal-fmt pkgs'.nixpkgs-fmt fourmolu - hlint ]; } '' export LC_CTYPE=C.UTF-8 export LC_ALL=C.UTF-8 export LANG=C.UTF-8 cd ${self} - make format_check + make format_check || (echo " Please run 'make format'" ; exit 1) mkdir $out ''; in { @@ -118,9 +117,13 @@ flake = perSystem (system: (projectFor system).flake { }); packages = perSystem (system: self.flake.${system}.packages); + + # Define what we want to test checks = perSystem (system: self.flake.${system}.checks // { formatCheck = formatCheckFor system; + agora = self.flake.${system}.packages."agora:lib:agora"; + agora-test = self.flake.${system}.packages."agora:test:agora-test"; }); check = perSystem (system: (nixpkgsFor system).runCommand "combined-test" { @@ -130,7 +133,5 @@ touch $out ''); devShell = perSystem (system: self.flake.${system}.devShell); - defaultPackage = - perSystem (system: self.flake.${system}.packages."agora:lib:agora"); }; }