forked from superfluid-org/protocol-monorepo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
158 lines (144 loc) · 3.92 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
{
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";
};
};
outputs = { self, nixpkgs, flake-utils, foundry, solc } :
flake-utils.lib.eachDefaultSystem (system:
let
minDevSolcVer = "solc_0_8_11"; # minimum solidity version used for external development
solcVer = "solc_0_8_23";
ghcVer92 = "ghc928";
ghcVer94 = "ghc948";
pkgs = import nixpkgs {
inherit system;
overlays = [
foundry.overlay
solc.overlay
];
};
# ghc ecosystem
ghc = pkgs.haskell.compiler.${ghcVer94};
ghcPkgs = pkgs.haskell.packages.${ghcVer94};
# common dev inputs
commonDevInputs = with pkgs; [
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;
# CI inputs
ciInputs = with pkgs; [
# codecov requries gnupg binary
gnupg
];
# minimem development shell
minimumDevInputs = commonDevInputs ++ ethDevInputs ++ node18DevInputs;
# 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};
} // o);
# ci-spec-with-ghc
ci-spec-with-ghc = 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.ci-node18 = mkShell {
buildInputs = ciInputs ++ commonDevInputs ++ ethDevInputs ++ node18DevInputs;
};
devShells.ci-node20 = mkShell {
buildInputs = ciInputs ++ commonDevInputs ++ ethDevInputs ++ node20DevInputs;
};
devShells.ci-spec-ghc92 = ci-spec-with-ghc ghcVer92;
devShells.ci-spec-ghc94 = ci-spec-with-ghc ghcVer94;
devShells.ci-hot-fuzz = mkShell {
buildInputs = with pkgs; ciInputs ++ commonDevInputs ++ ethDevInputs ++ [
slither-analyzer
echidna
];
};
});
}