forked from cardano-scaling/hydra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.nix
157 lines (134 loc) · 4.5 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# A shell setup providing build tools and utilities for a development
# environment. The main shell environment is based on haskell.nix and uses the
# same nixpkgs as the default nix builds (see default.nix).
{
# Used in CI to have a smaller closure
withoutDevTools ? false
}:
let
project = import ./default.nix { };
inherit (project) pkgs hsPkgs compiler;
# Add cardano-node & cardano-cli for our shell environment.
# This is stable as it doesn't mix dependencies with this code-base; the
# fetched binaries are the "standard" builds that people test. This should be
# fast as it mostly fetches Hydra (CI) caches without building much.
cardano-node = import
(pkgs.fetchgit {
url = "https://github.com/input-output-hk/cardano-node";
rev = "1.35.3-testnetonly";
sha256 = "0vg5775z683wf421asxjm7g2b6yxmgprpylhs9ryb035id83slp2";
})
{ };
libs = [
pkgs.glibcLocales
pkgs.libsodium-vrf # from iohk-nix overlay
pkgs.lzma
pkgs.secp256k1
pkgs.zlib
]
++
pkgs.lib.optionals (pkgs.stdenv.isLinux) [ pkgs.systemd ];
buildInputs = [
pkgs.git
pkgs.pkgconfig
pkgs.haskellPackages.hspec-discover
pkgs.haskellPackages.cabal-plan
# For validating JSON instances against a pre-defined schema
pkgs.python3Packages.jsonschema
# For plotting results of hydra-cluster benchmarks
pkgs.gnuplot
# For integration tests
cardano-node.cardano-node
];
devInputs = if withoutDevTools then [ ] else [
# The interactive Glasgow Haskell Compiler as a Daemon
pkgs.haskellPackages.ghcid
# Generate a graph of the module dependencies in the "dot" format
pkgs.haskellPackages.graphmod
# Automagically format .cabal files
pkgs.haskellPackages.cabal-fmt
# Handy to interact with the hydra-node via websockets
pkgs.ws
# Like 'jq' to manipulate JSON, but work for YAML
pkgs.yq
# For docs/ (i.e. Docusaurus, Node.js & React)
pkgs.yarn
# To interact with cardano-node and testing out things
cardano-node.cardano-cli
];
# Haskell.nix managed tools (via hackage)
buildTools = {
cabal = "3.4.0.0";
};
devTools = if withoutDevTools then { } else {
fourmolu = "0.4.0.0"; # 0.5.0.0 requires Cabal 3.6
haskell-language-server = "latest";
};
haskellNixShell = project.hsPkgs.shellFor {
# NOTE: Explicit list of local packages as hoogle would not work otherwise.
# Make sure these are consistent with the packages in cabal.project.
packages = ps: with ps; [
hydra-cluster
hydra-node
hydra-plutus
hydra-prelude
hydra-test-utils
hydra-tui
hydra-cardano-api
plutus-cbor
plutus-merkle-tree
];
tools = buildTools // devTools;
buildInputs = libs ++ buildInputs ++ devInputs;
withHoogle = !withoutDevTools;
# Always create missing golden files
CREATE_MISSING_GOLDEN = 1;
# Force a UTF-8 locale because many Haskell programs and tests
# assume this.
LANG = "en_US.UTF-8";
GIT_SSL_CAINFO = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
};
# A "cabal-only" shell which does not use haskell.nix
cabalShell = pkgs.mkShell {
name = "hydra-node-cabal-shell";
buildInputs = libs ++ [
pkgs.haskell.compiler.${compiler}
pkgs.cabal-install
pkgs.pkgconfig
] ++ buildInputs ++ devInputs;
# Ensure that libz.so and other libraries are available to TH splices.
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath libs;
# Force a UTF-8 locale because many Haskell programs and tests
# assume this.
LANG = "en_US.UTF-8";
# Make the shell suitable for the stack nix integration
# <nixpkgs/pkgs/development/haskell-modules/generic-stack-builder.nix>
GIT_SSL_CAINFO = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
STACK_IN_NIX_SHELL = "true";
};
# A shell which provides env for the demo application
demoShell = pkgs.mkShell {
name = "hydra-demo-shell";
buildInputs = [
cardano-node.cardano-node
cardano-node.cardano-cli
hsPkgs.hydra-node.components.exes.hydra-node
hsPkgs.hydra-tui.components.exes.hydra-tui
];
};
# A shell which does provide hydra-node and hydra-cluster executables.
exeShell = pkgs.mkShell {
name = "hydra-node-exe-shell";
buildInputs = [
cardano-node.cardano-node
cardano-node.cardano-cli
hsPkgs.hydra-node.components.exes.hydra-node
hsPkgs.hydra-cluster.components.exes.hydra-cluster
];
};
in
haskellNixShell // {
cabalOnly = cabalShell;
demo = demoShell;
exes = exeShell;
}