-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathflake.nix
278 lines (228 loc) · 9.19 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
{
description = "A Coq Library for Matching Logic";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-24.11";
flake-utils.url = "github:numtide/flake-utils";
pyk.url = "github:runtimeverification/pyk/v0.1.491";
};
outputs = { self, nixpkgs, flake-utils, pyk }: (
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
coqPackages = pkgs.coqPackages_8_20;
pyk-py = pyk.packages.${system}.pyk-python311;
python = pyk-py.python;
# stdpp = coqPackages.stdpp.overrideAttrs (o : { src = fetchTarball { url = "https://gitlab.mpi-sws.org/iris/stdpp/-/archive/master/stdpp-master.tar.bz2"; sha256="sha256:1f8v61mcixcai8ki1l350hlnypc7v3rrxjcx4m0xclb01rlf9afa";}; });
# The 'matching logic in Coq' library
coq-matching-logic = { coqPackages }: (
coqPackages.callPackage
( { coq, stdenv }:
stdenv.mkDerivation {
name = "coq-matching-logic";
src = ./matching-logic;
propagatedBuildInputs = [
coq
coqPackages.equations
# stdpp
coqPackages.stdpp
coqPackages.LibHyps
];
enableParallelBuilding = true;
installFlags = [ "COQLIB=$(out)/lib/coq/${coq.coq-version}/" ];
passthru = { inherit coqPackages; };
} ) { }
);
in {
# Newer version of Alectryon
packages.alectryon
= pkgs.python310Packages.buildPythonPackage rec {
pname = "alectryon";
version = "1.4.0";
src = pkgs.fetchFromGitHub {
owner = "cpitclaudel";
repo = "alectryon";
rev = "739b46da22d272e748f60f3efcd2989d696fba71";
sha256 = "n+B+f1PPODLGgL36Aj8srDngRp5ZmhKYxikEF+c+5YI=";
};
propagatedBuildInputs = [
pkgs.python310Packages.pygments
pkgs.python310Packages.dominate
pkgs.python310Packages.beautifulsoup4
pkgs.python310Packages.docutils
pkgs.python310Packages.sphinx
];
doCheck = false;
};
# The 'matching logic in Coq' library
packages.coq-matching-logic = coq-matching-logic { coqPackages = coqPackages; };
# The 'matching logic in Coq' library
# packages.coq-matching-logic-v8_17 = coq-matching-logic { coqPackages = pkgs.coqPackages_8_17; };
# Documentation of the 'matching logic in Coq' library
packages.coq-matching-logic-doc
= coqPackages.callPackage
( { coq, stdenv }:
stdenv.mkDerivation {
name = "coq-matching-logic-doc";
src = ./matching-logic-doc;
buildInputs = [
self.outputs.packages.${system}.alectryon
self.outputs.packages.${system}.coq-matching-logic
# we use a newer version which is compatible with new pigments
#pkgs.python310Packages.alectryon
pkgs.python310Packages.pygments
pkgs.python310Packages.pip
pkgs.coqPackages.serapi
coq
pkgs.parallel
];
postPatch = ''
patchShebangs run_alectryon.sh
'';
buildFlags = [ "PATH_TO_COMPILED_LIBRARY=${self.outputs.packages.${system}.coq-matching-logic}/lib/coq/${coq.coq-version}/user-contrib/MatchingLogic/" ];
installTargets = "install-coqdoc";
#installTargets = "install-coqdoc install-alectryon install-snippets";
# We are not going to install this system-wide, so we can afford not to have the coq version in the path to the docs.
# We do not want to have the version in the path, since it would be harder for the CI the figure out where the docs live.
# installFlags = [ "DOCDIR=$(out)/share/coq/${coq.coq-version}" "INSTALLCOQDOCROOT=coq-matching-logic" ];
installFlags = [ "DOCDIR=$(out)/share/doc" "INSTALLCOQDOCROOT=coq-matching-logic" ];
} ) { } ;
packages.koreimport
= python.pkgs.buildPythonApplication {
name = "koreimport";
src = ./koreimport;
format = "pyproject";
propagatedBuildInputs = [
python.pkgs.setuptools
pyk-py
];
};
packages.koreimport-test
= pkgs.stdenv.mkDerivation {
name = "koreimport-test";
src = ./koreimport-test;
buildInputs = [
pkgs.bash
self.outputs.packages.${system}.coq-matching-logic
self.outputs.packages.${system}.koreimport
coqPackages.coq
coqPackages.equations
coqPackages.stdpp
];
configurePhase = "";
buildPhase = ''
koreimport -o out.v --module IMP korefiles/imp.kore
coqc out.v
mkdir -p $out
'';
installPhase = "";
};
# Example: FOL embedded in matching logic
packages.coq-matching-logic-example-fol
= coqPackages.callPackage
( { coq, stdenv }:
stdenv.mkDerivation {
name = "coq-matching-logic-example-fol";
src = ./examples/03_FOL;
propagatedBuildInputs = [
self.outputs.packages.${system}.coq-matching-logic
];
installFlags = [ "COQLIB=$(out)/lib/coq/${coq.coq-version}/" ];
passthru = { inherit coqPackages; };
} ) { } ;
# Example: ProofMode tutorial
packages.coq-matching-logic-example-proofmode
= coqPackages.callPackage
( { coq, stdenv }:
stdenv.mkDerivation {
name = "coq-matching-logic-example-proofmode";
src = ./examples/02_proofmode;
propagatedBuildInputs = [
self.outputs.packages.${system}.coq-matching-logic
];
installFlags = [ "COQLIB=$(out)/lib/coq/${coq.coq-version}/" ];
passthru = { inherit coqPackages; };
} ) { } ;
# Metamath exporter: Build & Test
packages.coq-matching-logic-mm-exporter
= coqPackages.callPackage
( { coq, stdenv }:
stdenv.mkDerivation {
name = "coq-matching-logic-mm-exporter";
src = ./prover;
propagatedBuildInputs = [
self.outputs.packages.${system}.coq-matching-logic
pkgs.metamath
pkgs.ghc
];
postPatch = ''
patchShebangs --build check-generated-proof-objects.sh patch-extracted-hs.sh
'';
buildPhase = ''
make test
'';
dontInstall = true;
passthru = { inherit coqPackages; };
} ) { } ;
packages.default = self.outputs.packages.${system}.coq-matching-logic;
devShells = {
coq-matching-logic =
let
coq-matching-logic = self.outputs.packages.${system}.coq-matching-logic;
in
pkgs.mkShell {
inputsFrom = [coq-matching-logic];
packages = [coq-matching-logic.coqPackages.coq-lsp];
};
#coq-matching-logic-v8_17 =
# let
# coq-matching-logic = self.outputs.packages.${system}.coq-matching-logic-v8_17;
# in
# pkgs.mkShell {
# inputsFrom = [coq-matching-logic];
# packages = [coq-matching-logic.coqPackages.coq-lsp];
# };
coq-matching-logic-example-fol =
let
coq-matching-logic-example-fol = self.outputs.packages.${system}.coq-matching-logic-example-fol;
in
pkgs.mkShell {
inputsFrom = [coq-matching-logic-example-fol];
packages = [coq-matching-logic-example-fol.coqPackages.coq-lsp];
};
coq-matching-logic-example-proofmode =
let
coq-matching-logic-example-proofmode = self.outputs.packages.${system}.coq-matching-logic-example-proofmode;
in
pkgs.mkShell {
inputsFrom = [coq-matching-logic-example-proofmode];
packages = [coq-matching-logic-example-proofmode.coqPackages.coq-lsp];
};
koreimport =
let
koreimport = self.outputs.packages.${system}.koreimport;
in
pkgs.mkShell {
inputsFrom = [koreimport];
packages = [pkgs.python311Packages.mypy];
};
koreimport-test =
let
koreimport-test = self.outputs.packages.${system}.koreimport-test;
in
pkgs.mkShell {
inputsFrom = [koreimport-test];
#packages = [koreimport-test.coqPackages.coq-lsp];
};
coq-matching-logic-mm-exporter =
let
coq-matching-logic-mm-exporter = self.outputs.packages.${system}.coq-matching-logic-mm-exporter;
in
pkgs.mkShell {
inputsFrom = [coq-matching-logic-mm-exporter];
packages = [coq-matching-logic-mm-exporter.coqPackages.coq-lsp];
};
};
}
)
);
}