-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
50 lines (41 loc) · 1.66 KB
/
flake.nix
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
{
description = "LeanProtocPlugin";
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixpkgs-unstable;
inputs.lean.url = github:leanprover/lean4;
inputs.flake-utils.url = github:numtide/flake-utils;
inputs.leanproto.url = github:zygi/lean-proto;
inputs.leanproto.inputs.lean.follows = "lean";
inputs.assrt-command.url = github:pnwamk/lean4-assert-command;
inputs.assrt-command.inputs.lean.follows = "lean";
outputs = { self, lean, flake-utils, leanproto, assrt-command, nixpkgs }: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
leanPkgs = lean.packages.${system};
pkg = leanPkgs.buildLeanPackage {
name = "LeanProtocPlugin"; # must match the name of the top-level .lean file
src = ./.;
deps = [ leanproto.packages.${system} assrt-command.packages.${system} ];
};
# For easier testing, set up derivations that will build some proto files.
leanProtoPackageLib = import ./leanProtoPackage.nix
{ inherit pkgs system leanPkgs leanproto; generator = pkg; };
protoGenParams = {
inpPathsStrList = [
"${pkg.src}/proto/google/protobuf/descriptor.proto"
"${pkg.src}/proto/google/protobuf/compiler/plugin.proto"
];
inpRootStr = "${pkg.src}/proto";
rootPackageNameStr = "LeanProtocPlugin";
};
runGeneratorPkg = leanProtoPackageLib.leanProtoPackage protoGenParams;
runGenerator = leanProtoPackageLib.runGenerator protoGenParams;
in
{
packages = pkg // {
inherit (leanPkgs) lean runGeneratorPkg runGenerator;
};
defaultPackage = pkg.modRoot;
});
}