forked from MELD-labs/cardano-defi-public
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.nix
75 lines (74 loc) · 2.58 KB
/
shell.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{
iohkNix ?
import (
builtins.fetchTarball "https://github.com/input-output-hk/iohk-nix/archive/e936cc0972fceb544dd7847e39fbcace1c9c00de.tar.gz"
) {},
haskellNix ?
import ( # Tracking 0.0.19
builtins.fetchTarball "https://github.com/input-output-hk/haskell.nix/archive/d6ce79f4b5350e4dd5b4b834b0a0e764cf16dff3.tar.gz"
) {},
appHaskellCompilerVersion ? "8.10.7",
contractHaskellCompilerVersion ? "9.2.4",
}:
let
getCompilerName = version: pkgs.lib.strings.concatStrings ["ghc" (pkgs.lib.concatStringsSep "" (pkgs.lib.strings.splitString "." version))];
contractHaskellCompiler = getCompilerName contractHaskellCompilerVersion;
appHaskellCompiler = getCompilerName appHaskellCompilerVersion;
pkgs = import haskellNix.sources.nixpkgs-unstable (
haskellNix.nixpkgsArgs // {
overlays = haskellNix.overlays ++ iohkNix.overlays.crypto;
}
);
in with pkgs; let
devTools = [
docker-compose
git
gnupg
pre-commit
];
getHls = compilerVersion:
"ln -fs ${
haskell-nix.tool (getCompilerName compilerVersion) "haskell-language-server" "1.8.0.0"
}/bin/haskell-language-server $out/bin/haskell-language-server-${compilerVersion}";
hlsWrapper = stdenv.mkDerivation {
pname = "haskell-language-server-wrapper";
version = pkgs.haskellPackages.haskell-language-server.version;
buildCommand = ''
mkdir -p $out/bin
ln -fs ${pkgs.haskellPackages.haskell-language-server}/bin/haskell-language-server-wrapper $out/bin/haskell-language-server-wrapper
${getHls contractHaskellCompilerVersion}
${getHls appHaskellCompilerVersion}
'';
};
haskellEnv = [
hlsWrapper
(haskell-nix.tool "${contractHaskellCompiler}" "hlint" "3.5")
(haskell-nix.tool "${contractHaskellCompiler}" "fourmolu" "0.8.2.0")
];
compilers = [
haskell-nix.cabal-install.${contractHaskellCompiler}
haskell-nix.compiler.${contractHaskellCompiler}
haskell-nix.compiler.${appHaskellCompiler}
];
libraries = [
pkg-config
libsodium-vrf
secp256k1
zlib # dependency: digest
R # for newer version of plutus-core
lzma # lending-api
postgresql # lending-index
] ++ lib.optional (!stdenv.isDarwin) systemd;
certFile = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
in
mkShell {
name = "lending";
buildInputs = devTools ++ haskellEnv ++ compilers ++ libraries;
GIT_SSL_CAINFO = certFile;
NIX_SSL_CERT_FILE = certFile;
COMPOSE_FILE="compose/docker-compose.local.yml";
NETWORK="local";
shellHook = ''
pre-commit install --install-hooks -t pre-commit -t commit-msg
'';
}