Skip to content

Commit 3e23a4a

Browse files
samuelburnhamSerhii Khoma
andauthored
chore: Update Lean to v4.31.0 (#79)
* feat: update to lean v4.31.0 * ci: Update Nix config --------- Co-authored-by: Serhii Khoma <sergey@nordicresults.com>
1 parent d3c15b9 commit 3e23a4a

6 files changed

Lines changed: 65 additions & 15 deletions

File tree

.envrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
# Trust the flake's nixConfig (the Cachix substituter) without prompting, so
2+
# the cache applies to every nix command in this shell, not just the devShell
3+
# build. Non-direnv users are unaffected: nix asks them before using it.
4+
export NIX_CONFIG="accept-flake-config = true"
15
use flake

.github/workflows/ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,22 @@ jobs:
1919
- uses: leanprover/lean-action@v1
2020
with:
2121
build-args: "--wfail"
22+
23+
# Builds the library and runs the test suite via Nix flake checks
24+
nix-test:
25+
name: Nix Tests
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v6
29+
- uses: cachix/install-nix-action@v31
30+
with:
31+
nix_path: nixpkgs=channel:nixos-unstable
32+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
33+
- uses: cachix/cachix-action@v16
34+
with:
35+
name: argumentcomputer
36+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
37+
# Build the library and test binary
38+
- run: nix build --print-build-logs --accept-flake-config
39+
# Run the test suite as a flake check
40+
- run: nix flake check --print-build-logs --accept-flake-config

LSpec/LSpec.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ instance (priority := 25) (p : Prop) [d : Decidable p] : Testable p :=
9595
| isTrue h => .isTrue h
9696

9797
open SlimCheck in
98-
instance instTestableOfCheckable (p : Prop) (cfg : Configuration) [Checkable p] : Testable p :=
98+
abbrev instTestableOfCheckable (p : Prop) (cfg : Configuration) [Checkable p] : Testable p :=
9999
let ((res, numSamples), _) := ReaderT.run (Checkable.runSuite p cfg) (.up mkStdGen)
100100
match res with
101101
| .success (.inr h) => .isTrue h

flake.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
{
22
description = "LSpec Nix Flake";
33

4+
nixConfig = {
5+
extra-substituters = [
6+
"https://argumentcomputer.cachix.org"
7+
];
8+
extra-trusted-public-keys = [
9+
"argumentcomputer.cachix.org-1:ovhbTx1V56BYDerOWInQvXKXl68LlhNwEA+n7EWk1m4="
10+
];
11+
};
12+
413
inputs = {
514
nixpkgs.follows = "lean4-nix/nixpkgs";
615
flake-parts.url = "github:hercules-ci/flake-parts";
@@ -29,17 +38,35 @@
2938
...
3039
}: let
3140
lake2nix = pkgs.callPackage lean4-nix.lake {};
41+
42+
# Library build, shared between the package output and the test check
43+
# so the `tests` exe reuses these artifacts instead of recompiling them.
44+
lspec = lake2nix.mkPackage {
45+
name = "LSpec";
46+
src = ./.;
47+
};
48+
49+
# `mkPackage "LSpec"` only builds the library target, so the `tests`
50+
# exe is built explicitly, reusing `lspec`'s build artifacts.
51+
lspecTest = lake2nix.mkPackage {
52+
name = "tests";
53+
src = ./.;
54+
lakeArtifacts = lspec;
55+
};
3256
in {
3357
_module.args.pkgs = import nixpkgs {
3458
inherit system;
3559
overlays = [(lean4-nix.readToolchainFile ./lean-toolchain)];
3660
};
3761

3862
# Build the library with `nix build`
39-
packages.default = lake2nix.mkPackage {
40-
name = "LSpec";
41-
src = ./.;
42-
};
63+
packages.default = lspec;
64+
65+
# Build and run the test suite as a flake check (`nix flake check`).
66+
checks.tests = pkgs.runCommand "LSpec-tests" { } ''
67+
${lspecTest}/bin/tests
68+
touch $out
69+
'';
4370

4471
devShells.default = pkgs.mkShell {
4572
packages = with pkgs.lean; [lean-all];

lean-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
leanprover/lean4:v4.29.0
1+
leanprover/lean4:v4.31.0

0 commit comments

Comments
 (0)