2023-10-20 11:52:09 -07:00
|
|
|
{
|
|
|
|
description = "Pantograph";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
2024-03-28 11:33:15 -07:00
|
|
|
lean = {
|
2024-03-30 00:03:37 -07:00
|
|
|
# Do not follow input's nixpkgs since it could cause build failures
|
2024-05-17 20:31:45 -07:00
|
|
|
url = "github:leanprover/lean4?ref=v4.8.0-rc1";
|
2024-03-28 11:33:15 -07:00
|
|
|
};
|
|
|
|
lspec = {
|
|
|
|
url = "github:lurk-lab/LSpec?ref=3388be5a1d1390594a74ec469fd54a5d84ff6114";
|
|
|
|
flake = false;
|
|
|
|
};
|
2023-10-20 11:52:09 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = inputs @ {
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
|
|
|
flake-parts,
|
|
|
|
lean,
|
2024-03-28 11:33:15 -07:00
|
|
|
lspec,
|
2023-10-20 11:52:09 -07:00
|
|
|
...
|
|
|
|
} : flake-parts.lib.mkFlake { inherit inputs; } {
|
|
|
|
flake = {
|
|
|
|
};
|
|
|
|
systems = [
|
|
|
|
"x86_64-linux"
|
|
|
|
"x86_64-darwin"
|
|
|
|
];
|
|
|
|
perSystem = { system, pkgs, ... }: let
|
|
|
|
leanPkgs = lean.packages.${system};
|
2024-03-28 11:33:15 -07:00
|
|
|
lspecLib = leanPkgs.buildLeanPackage {
|
|
|
|
name = "LSpec";
|
|
|
|
roots = [ "Main" "LSpec" ];
|
|
|
|
src = "${lspec}";
|
|
|
|
};
|
2023-10-20 11:52:09 -07:00
|
|
|
project = leanPkgs.buildLeanPackage {
|
|
|
|
name = "Pantograph";
|
|
|
|
roots = [ "Main" "Pantograph" ];
|
2024-03-28 22:23:19 -07:00
|
|
|
src = pkgs.lib.cleanSourceWith {
|
|
|
|
src = ./.;
|
|
|
|
filter = path: type:
|
|
|
|
!(pkgs.lib.hasInfix "/Test/" path) &&
|
|
|
|
!(pkgs.lib.hasSuffix ".md" path) &&
|
|
|
|
!(pkgs.lib.hasSuffix "Makefile" path);
|
|
|
|
};
|
2023-10-20 11:52:09 -07:00
|
|
|
};
|
2024-03-28 00:06:35 -07:00
|
|
|
test = leanPkgs.buildLeanPackage {
|
|
|
|
name = "Test";
|
2024-03-28 11:33:15 -07:00
|
|
|
# NOTE: The src directory must be ./. since that is where the import
|
|
|
|
# root begins (e.g. `import Test.Environment` and not `import
|
|
|
|
# Environment`) and thats where `lakefile.lean` resides.
|
|
|
|
roots = [ "Test.Main" ];
|
|
|
|
deps = [ lspecLib project ];
|
|
|
|
src = pkgs.lib.cleanSourceWith {
|
|
|
|
src = ./.;
|
|
|
|
filter = path: type:
|
|
|
|
!(pkgs.lib.hasInfix "Pantograph" path);
|
|
|
|
};
|
2024-03-28 00:06:35 -07:00
|
|
|
};
|
2023-10-20 11:52:09 -07:00
|
|
|
in rec {
|
2024-03-06 15:26:35 -08:00
|
|
|
packages = {
|
|
|
|
inherit (leanPkgs) lean lean-all;
|
|
|
|
inherit (project) sharedLib executable;
|
|
|
|
default = project.executable;
|
2023-10-20 11:52:09 -07:00
|
|
|
};
|
2024-03-28 00:06:35 -07:00
|
|
|
checks = {
|
2024-03-28 11:33:15 -07:00
|
|
|
test = pkgs.runCommand "test" {
|
|
|
|
buildInputs = [ test.executable leanPkgs.lean-all ];
|
|
|
|
} ''
|
|
|
|
#export LEAN_SRC_PATH="${./.}"
|
|
|
|
${test.executable}/bin/test > $out
|
|
|
|
'';
|
2024-03-28 00:06:35 -07:00
|
|
|
};
|
2024-03-28 22:26:46 -07:00
|
|
|
devShells.default = pkgs.mkShell {
|
|
|
|
buildInputs = [ leanPkgs.lean-all leanPkgs.lean ];
|
|
|
|
};
|
2023-10-20 11:52:09 -07:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|