Skip to content

Commit 5e8c146

Browse files
authored
Nix setup (#250)
2 parents 0dce0dd + 178c65d commit 5e8c146

File tree

10 files changed

+539
-3
lines changed

10 files changed

+539
-3
lines changed

.github/coq-concert.opam.locked

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pin-depends: [
3434
["coq-metacoq-erasure.1.3.2+8.19" "git+https://github.com/MetaCoq/metacoq.git#a9f5da7534b62cda3c870e64f00998e7ee5485f5"]
3535
]
3636
build: [
37-
[make]
37+
[make "core"]
3838
[make "examples"] {with-test}
3939
[make "html"] {with-doc}
4040
]

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- '**.md'
99
- '**.gitignore'
1010
- '**.opam'
11+
- '**.nix'
1112
- '**.editorconfig'
1213
- 'LICENSE'
1314
- 'papers/**'
@@ -17,6 +18,7 @@ on:
1718
- '**.md'
1819
- '**.gitignore'
1920
- '**.opam'
21+
- '**.nix'
2022
- '**.editorconfig'
2123
- 'LICENSE'
2224
- 'papers/**'

.github/workflows/nix-action-8.19.yml

Lines changed: 450 additions & 0 deletions
Large diffs are not rendered by default.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
*.tmp
33
.DS_Store
44

5+
# Nix outputs
6+
result
7+
58
# dpd-graph outputs
69
*.dpd
710
*.dot

.nix/config.nix

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
## DO NOT CHANGE THIS
3+
format = "1.0.0";
4+
## unless you made an automated or manual update
5+
## to another supported format.
6+
7+
attribute = "ConCert";
8+
9+
default-bundle = "8.19";
10+
11+
bundles."8.19" = {
12+
coqPackages.coq.override.version = "8.19";
13+
coqPackages.metacoq.override.version = "coq-8.19";
14+
coqPackages.stdpp.override.version = "1.10.0";
15+
coqPackages.QuickChick.override.version = "2.0.4";
16+
coqPackages.RustExtraction.override.version = "0.1.0";
17+
coqPackages.ElmExtraction.override.version = "0.1.0";
18+
};
19+
20+
cachix.coq = {};
21+
cachix.coq-community = {};
22+
cachix.metacoq = {};
23+
24+
cachix.au-cobra.authToken = "CACHIX_AUTH_TOKEN";
25+
}

.nix/coq-nix-toolbox.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"a24e6f4fb01d4ca0811dc8d16246cfe36b37ac52"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{ lib, mkCoqDerivation, which, coq
2+
, metacoq, bignums, QuickChick, stdpp, RustExtraction, ElmExtraction
3+
, version ? null }:
4+
5+
with lib; mkCoqDerivation {
6+
pname = "ConCert";
7+
repo = "ConCert";
8+
owner = "AU-COBRA";
9+
domain = "github.com";
10+
11+
inherit version;
12+
## The `defaultVersion` attribute is important for nixpkgs but can be kept unchanged
13+
## for local usage since it will be ignored locally if
14+
## - this derivation corresponds to the main attribute,
15+
## - or its version is overridden (by a branch, PR, url or path) in `.nix/config.nix`.
16+
defaultVersion = with versions; switch coq.coq-version [
17+
## Example of possible dependencies
18+
# { case = range "8.13" "8.14"; out = "1.2.0"; }
19+
## other predicates are `isLe v`, `isLt v`, `isGe v`, `isGt v`, `isEq v` etc
20+
] null;
21+
22+
## Declare existing releases
23+
## leave sha256 empty at first and then copy paste
24+
## the resulting sha given by the error message
25+
# release."1.1.1".sha256 = "";
26+
## if the tag is not exactly the version number you can amend like this
27+
# release."1.1.1".rev = "v1.1.1";
28+
## if a consistent scheme gives the tag from the release number, you can do like this:
29+
# releaseRev = v: "v${v}";
30+
31+
propagatedBuildInputs = [ coq.ocamlPackages.findlib metacoq bignums QuickChick stdpp RustExtraction ElmExtraction ];
32+
33+
postPatch = ''patchShebangs ./extraction/process-extraction-examples.sh'';
34+
35+
meta = {
36+
description = "A framework for smart contract verification in Coq";
37+
maintainers = with maintainers; [ _4ever2 ];
38+
license = licenses.mit;
39+
};
40+
}

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
all: utils execution embedding extraction
1+
all: utils execution embedding extraction examples
22
.PHONY: all
33

4+
core: utils execution embedding extraction
5+
.PHONY: core
6+
47
utils:
58
+make -C utils
69
.PHONY: utils

coq-concert.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pin-depends: [
4040
]
4141

4242
build: [
43-
[make]
43+
[make "core"]
4444
[make "examples"] {with-test}
4545
[make "html"] {with-doc}
4646
]

default.nix

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{ config ? {}, withEmacs ? false, print-env ? false, do-nothing ? false,
2+
update-nixpkgs ? false, ci-matrix ? false,
3+
override ? {}, ocaml-override ? {}, global-override ? {},
4+
bundle ? null, job ? null, inNixShell ? null, src ? ./.,
5+
}@args:
6+
let auto = fetchGit {
7+
url = "https://github.com/coq-community/coq-nix-toolbox.git";
8+
ref = "master";
9+
rev = import .nix/coq-nix-toolbox.nix;
10+
};
11+
in
12+
import auto ({inherit src;} // args)

0 commit comments

Comments
 (0)