Skip to content

Commit a6652a4

Browse files
feat: Add Nix flake (#52)
* feat: Add Nix flake * Simplify Nix build
1 parent f9bb7ad commit a6652a4

File tree

4 files changed

+192
-5
lines changed

4 files changed

+192
-5
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,36 @@
1-
name: "CI"
1+
name: CI Tests
2+
23
on:
3-
pull_request:
44
push:
5-
branches:
6-
- main
5+
branches: main
6+
pull_request:
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
11+
cancel-in-progress: true
12+
713
jobs:
8-
build:
14+
lean:
15+
name: Lean Build
916
runs-on: ubuntu-latest
1017
steps:
1118
- uses: actions/checkout@v4
1219
- uses: leanprover/lean-action@v1
1320
with:
1421
build-args: "--wfail"
22+
23+
nix:
24+
name: Nix Flake Check
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: cachix/install-nix-action@v30
29+
with:
30+
nix_path: nixpkgs=channel:nixos-unstable
31+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
32+
- uses: cachix/cachix-action@v14
33+
with:
34+
name: argumentcomputer
35+
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
36+
- run: nix build

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/build
22
/lake-packages
33
.lake/
4+
/result*

flake.lock

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

flake.nix

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
description = "LSpec Nix Flake";
3+
4+
inputs = {
5+
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
6+
flake-parts.url = "github:hercules-ci/flake-parts";
7+
lean4-nix = {
8+
url = "github:argumentcomputer/lean4-nix";
9+
inputs.nixpkgs.follows = "nixpkgs";
10+
};
11+
};
12+
13+
outputs = inputs @ {
14+
nixpkgs,
15+
flake-parts,
16+
lean4-nix,
17+
...
18+
}:
19+
flake-parts.lib.mkFlake {inherit inputs;} {
20+
systems = [
21+
"aarch64-darwin"
22+
"aarch64-linux"
23+
"x86_64-darwin"
24+
"x86_64-linux"
25+
];
26+
27+
perSystem = {
28+
system,
29+
pkgs,
30+
self',
31+
config,
32+
...
33+
}:
34+
{
35+
_module.args.pkgs = import nixpkgs {
36+
inherit system;
37+
overlays = [(lean4-nix.readToolchainFile ./lean-toolchain)];
38+
};
39+
40+
# Build the library with `nix build`
41+
packages.default = ((lean4-nix.lake {inherit pkgs;}).mkPackage {
42+
src = ./.;
43+
roots = ["LSpec"];
44+
}).modRoot;
45+
46+
devShells.default = pkgs.mkShell {
47+
packages = with pkgs.lean; [lean lean-all];
48+
};
49+
};
50+
};
51+
}

0 commit comments

Comments
 (0)