nix: Add a tool for checking Haskell imports and exports (#1768)

This commit is contained in:
Remo Rechkemmer
2021-04-06 11:46:12 +02:00
committed by GitHub
parent 9f074cecce
commit 65e7f9e846
11 changed files with 517 additions and 33 deletions
+30
View File
@@ -0,0 +1,30 @@
{ ghcWithPackages
, runCommand
}:
let
name = "hsie";
src = ./Main.hs;
modules = ps: [
ps.aeson
ps.aeson-pretty
ps.cassava
ps.dir-traverse
ps.dot
ps.ghc-exactprint
ps.optparse-applicative
];
ghc = ghcWithPackages modules;
hsie =
runCommand "haskellimports" { inherit name src; }
"${ghc}/bin/ghc -O -Werror -Wall -package ghc $src -o $out";
bin =
runCommand name { inherit hsie name; }
''
mkdir -p $out/bin
ln -s $hsie $out/bin/$name
'';
bashCompletion =
runCommand "${name}-bash-completion" { inherit bin name; }
"$bin/bin/$name --bash-completion-script $bin/bin/$name > $out";
in
hsie // { inherit bashCompletion bin; }