Skip to content

Commit

Permalink
build: Add fourmolu, hlint checks
Browse files Browse the repository at this point in the history
  • Loading branch information
sgillespie committed Jul 23, 2023
1 parent 56b3d25 commit 640940f
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ dist-newstyle

### Idea
.idea
*.iml
*.iml

### Nix
result
47 changes: 42 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,70 @@
(final: prev: {
elocryptProject = final.haskell-nix.cabalProject' {
src = ./.;
compiler-nix-name = "ghc962";
compiler-nix-name = "ghc945";
name = "elocrypt";

shell = {
tools = {
cabal = "latest";
hlint = "latest";
haskell-language-server = "latest";
fourmolu = "0.13.1.0";
};

nativeBuildInputs = [pkgs.haskellPackages.weeder];
nativeBuildInputs = with final; [fourmolu hlint];

withHoogle = true;
};
};
})

(final: prev: {
fourmolu =
final.haskell-nix.tool
final.elocryptProject.args.compiler-nix-name
"fourmolu"
"0.13.1.0";

hlint =
final.haskell-nix.tool
final.elocryptProject.args.compiler-nix-name
"hlint"
"latest";

fourmoluCheck =
prev.runCommand
"fourmolu-check"
{ buildInputs = [final.fourmolu]; }
''
cd "${final.elocryptProject.args.src}"
fourmolu --mode check src test
[[ "$?" -eq "0" ]] && touch $out
'';

hlintCheck =
prev.runCommand
"hlint-check"
{ buildInputs = [final.hlint]; }
''
cd "${final.elocryptProject.args.src}"
hlint src test
[[ "$?" -eq "0" ]] && touch $out
'';
})
];

pkgs = import nixpkgs {
inherit system overlays;
inherit (haskellNix) config;
};

flake = pkgs.elocryptProject.flake {
};
in
pkgs.lib.recursiveUpdate flake {
checks = {
inherit (pkgs) hlintCheck fourmoluCheck;
};

packages.default = flake.packages."elocrypt:exe:elocrypt";
});

Expand All @@ -56,7 +93,7 @@
"sgillespie.cachix.org-1:Zgif/WHW2IzHqbMb1z56cMmV5tLAA+zW9d5iB5w/VU4="
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
];

substituters = [
"https://cache.nixos.org/"
"https://cache.iog.io"
Expand Down

0 comments on commit 640940f

Please sign in to comment.