-
Notifications
You must be signed in to change notification settings - Fork 238
/
flake.nix
179 lines (161 loc) · 4.69 KB
/
flake.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
{
description = "Overlay for working with Superfluid protocol monorepo";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
foundry = {
url = "github:shazow/foundry.nix/monthly";
inputs.flake-utils.follows = "flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
solc = {
url = "github:hellwolf/solc.nix";
inputs.flake-utils.follows = "flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
mk-cache-key = {
url = "github:hellwolf/mk-cache-key.nix/master";
inputs.flake-utils.follows = "flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, foundry, solc, mk-cache-key } :
flake-utils.lib.eachDefaultSystem (system:
let
minDevSolcVer = "solc_0_8_11"; # minimum solidity version used for external development
solcVer = "solc_0_8_26";
ghcVer92 = "ghc928";
ghcVer94 = "ghc948";
pkgs = import nixpkgs {
inherit system;
overlays = [
foundry.overlay
solc.overlay
];
};
mk-cache-key-pkg = mk-cache-key.packages.${system}.default;
# ghc ecosystem
ghc = pkgs.haskell.compiler.${ghcVer94};
ghcPkgs = pkgs.haskell.packages.${ghcVer94};
# common dev inputs
commonDevInputs = with pkgs; [
mk-cache-key-pkg
gnumake
# for shell script linting
shellcheck
# used by some scripts
jq
yq
# test utilities
lcov
actionlint
];
# solidity dev inputs
ethDevInputs = with pkgs; [
foundry-bin
pkgs.${minDevSolcVer}
pkgs.${solcVer}
(solc.mkDefault pkgs pkgs.${solcVer})
];
# nodejs ecosystem
nodeDevInputsWith = nodejs: [
nodejs
nodejs.pkgs.yarn
nodejs.pkgs.nodemon
];
node18DevInputs = nodeDevInputsWith pkgs.nodejs_18;
node20DevInputs = nodeDevInputsWith pkgs.nodejs_20;
node22DevInputs = nodeDevInputsWith pkgs.nodejs_22;
defaultNodeDevInputs = node22DevInputs;
# CI inputs
ciInputs = with pkgs; [
# codecov requries gnupg binary
gnupg
];
# minimem development shell
minimumDevInputs = commonDevInputs ++ ethDevInputs ++ defaultNodeDevInputs;
# additional tooling for whitehat hackers
whitehatInputs = with pkgs; [
slither-analyzer
echidna
];
# spec developing specification
specInputs = with pkgs; [
# for nodejs ecosystem
yarn
gnumake
# for haskell spec
cabal-install
ghc
hlint
stylish-haskell
# sage math
sage
# testing tooling
gnuplot
# yellowpaper pipeline tooling
ghcPkgs.lhs2tex
python39Packages.pygments
(texlive.combine {
inherit (texlive)
scheme-basic metafont
collection-latex collection-latexextra
collection-bibtexextra collection-mathscience
collection-fontsrecommended collection-fontsextra;
})
];
# mkShell wrapper, to expose additional environment variables
mkShell = o : pkgs.mkShell ({
SOLC = pkgs.lib.getExe pkgs.${solcVer};
FOUNDRY_OFFLINE = "true";
FOUNDRY_SOLC_VERSION = pkgs.lib.getExe pkgs.${solcVer};
} // o);
mkShellForNodeCI = nodeDevInputs : mkShell {
buildInputs = ciInputs ++ commonDevInputs ++ ethDevInputs ++ nodeDevInputs;
};
mkShellForSpecCI = ghcVer : mkShell {
buildInputs = with pkgs; [
cabal-install
haskell.compiler.${ghcVer}
hlint
];
};
in {
# local development shells
devShells.default = mkShell {
buildInputs = minimumDevInputs;
};
devShells.whitehat = mkShell {
buildInputs = minimumDevInputs
++ whitehatInputs;
};
devShells.spec = mkShell {
buildInputs = minimumDevInputs
++ specInputs;
};
devShells.full = mkShell {
buildInputs = minimumDevInputs
++ whitehatInputs
++ specInputs;
};
# CI shells
devShells.mk-cache-key = mkShell {
buildInputs = [ mk-cache-key-pkg ];
};
devShells.ci-minimum = mkShell {
buildInputs = with pkgs; ciInputs ++ [ actionlint shellcheck ];
};
devShells.ci-default = mkShellForNodeCI defaultNodeDevInputs;
devShells.ci-node18 = mkShellForNodeCI node18DevInputs;
devShells.ci-node20 = mkShellForNodeCI node20DevInputs;
devShells.ci-node22 = mkShellForNodeCI node22DevInputs;
devShells.ci-spec-ghc92 = mkShellForSpecCI ghcVer92;
devShells.ci-spec-ghc94 = mkShellForSpecCI ghcVer94;
devShells.ci-hot-fuzz = mkShell {
buildInputs = with pkgs; ciInputs ++ commonDevInputs ++ ethDevInputs ++ [
slither-analyzer
echidna
];
};
});
}