-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
136 lines (116 loc) · 3.73 KB
/
flake.nix
File metadata and controls
136 lines (116 loc) · 3.73 KB
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
# SPDX-License-Identifier: PMPL-1.0-or-later
# SPDX-FileCopyrightText: 2025 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
{
description = "ECHIDNA - Neurosymbolic theorem proving platform with 30 prover backends";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" "rust-analyzer" "clippy" "rustfmt" ];
};
buildDeps = with pkgs; [
pkg-config
openssl
];
devTools = with pkgs; [
just
cargo-edit
cargo-audit
cargo-outdated
cargo-tarpaulin
cargo-deny
cargo-watch
jq
];
# Runtime prover dependencies
proverDeps = with pkgs; [
z3
cvc5
idris2
];
in {
# Development shell
devShells.default = pkgs.mkShell {
buildInputs = [ rustToolchain ] ++ buildDeps ++ devTools ++ proverDeps;
shellHook = ''
export RUST_LOG=echidna=debug,info
echo "ECHIDNA development environment"
echo ""
echo "Commands:"
echo " just build - Build debug"
echo " just test - Run unit tests"
echo " just test-all - Run all tests"
echo " just lint - Run clippy"
echo " just pre-commit - All checks"
'';
};
# Main package
packages.default = pkgs.rustPlatform.buildRustPackage {
pname = "echidna";
version = "1.5.0";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs = with pkgs; [ openssl ];
# Only run unit tests (integration tests need provers)
checkPhase = ''
cargo test --lib
'';
meta = with pkgs.lib; {
description = "Neurosymbolic theorem proving platform with 30 prover backends";
homepage = "https://github.com/hyperpolymath/echidna";
license = licenses.free; # PMPL-1.0-or-later (https://github.com/hyperpolymath/palimpsest-license)
mainProgram = "echidna";
};
};
# Container image (OCI)
packages.container = pkgs.dockerTools.buildLayeredImage {
name = "echidna";
tag = "latest";
contents = [
self.packages.${system}.default
pkgs.cacert
pkgs.z3
pkgs.cvc5
pkgs.idris2
];
config = {
Cmd = [ "/bin/echidna" "--help" ];
Env = [
"RUST_LOG=info"
];
ExposedPorts = {
"8081/tcp" = {};
};
};
};
# CI checks
packages.ci = pkgs.stdenv.mkDerivation {
name = "echidna-ci";
src = ./.;
nativeBuildInputs = [ rustToolchain pkgs.pkg-config ];
buildInputs = with pkgs; [ openssl ];
buildPhase = ''
export HOME=$TMPDIR
cargo fmt --check
cargo clippy -- -D warnings
cargo test --lib
'';
installPhase = ''
mkdir -p $out
echo "CI checks passed" > $out/result
'';
};
}
);
}