-
Notifications
You must be signed in to change notification settings - Fork 2
/
make.nix
30 lines (28 loc) · 905 Bytes
/
make.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{}:
let
pkgs = (import ./project.nix {}).pkgs;
snippets = {
repl = "cd purplechain && cabal new-repl --repl-options='-ignore-dot-ghci' --repl-options='-ghci-script .ghci' ";
hoogle = "hoogle server -p 8080 --local";
build = "nix-build";
shell = "nix-shell";
watch = ''ghcid -c "${snippets.repl}" --restart="purplechain/purplechain.cabal" --lint '';
};
mkScript = name: text: pkgs.writeScript ("purplechain-${name}") ''
#!/usr/bin/env bash
set -euo pipefail
${text}
'';
in {
build = mkScript "build.sh" snippets.build;
dev = mkScript "dev.sh" ''
${snippets.hoogle} > /dev/null &
HOOGLE_PID=$!
${snippets.watch} --run="testThreads"
kill "$HOOGLE_PID"
'';
hoogle = mkScript "hoogle.sh" snippets.hoogle;
repl = mkScript "repl.sh" snippets.repl;
shell = mkScript "shell.sh" snippets.shell;
watch = mkScript "watch.sh" snippets.watch;
}