forked from input-output-hk/devx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdynamic.nix
54 lines (51 loc) · 1.67 KB
/
dynamic.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# define a development shell for dynamically linked applications (default)
{ pkgs, compiler, compiler-nix-name, withHLS ? true, withHlint ? true }:
let tool-version-map = import ./tool-map.nix;
tool = tool-name: pkgs.haskell-nix.tool compiler-nix-name tool-name (tool-version-map compiler-nix-name tool-name);
cabal-install = tool "cabal"; in
pkgs.mkShell {
# The `cabal` overrride in this shell-hook doesn't do much yet. But
# we may need to massage cabal a bit, so we'll leave it in here for
# consistency with the one in static.nix.
shellHook = with pkgs; ''
export PS1="\[\033[01;33m\][\w]$\[\033[00m\] "
${figlet}/bin/figlet -f rectangles 'IOG Haskell Shell'
function cabal() {
case "$1" in
build)
${cabal-install}/bin/cabal "$@"
;;
clean)
${cabal-install}/bin/cabal "$@"
;;
*)
${cabal-install}/bin/cabal "$@"
;;
esac
}
'';
buildInputs = [
compiler
cabal-install
pkgs.pkgconfig
# for libstdc++; ghc not being able to find this properly is bad,
# it _should_ probably call out to a g++ or clang++ but doesn't.
pkgs.stdenv.cc.cc.lib
pkgs.cddl
pkgs.cbor-diag
] ++ map pkgs.lib.getDev (
with pkgs;
[
libsodium-vrf
secp256k1
R_4_1_3
zlib
openssl
pcre
]
++ pkgs.lib.optional pkgs.stdenv.hostPlatform.isLinux systemd
)
++ pkgs.lib.optional withHLS (tool "haskell-language-server")
++ pkgs.lib.optional withHlint (tool "hlint")
;
}