-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
77 lines (73 loc) · 2.17 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
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
{
description = "A Nix implementation in Lean";
inputs = {
lean = {
url = "github:leanprover/lean4";
};
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.05";
flake-utils = {
url = "github:numtide/flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
# A lean dependency
lean-ipld = {
url = "github:yatima-inc/lean-ipld";
inputs.lean.follows = "lean";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, lean, flake-utils, nixpkgs, lean-ipld }:
let
supportedSystems = [
# "aarch64-linux"
# "aarch64-darwin"
"i686-linux"
"x86_64-darwin"
"x86_64-linux"
];
in
flake-utils.lib.eachSystem supportedSystems (system:
let
leanPkgs = lean.packages.${system};
pkgs = nixpkgs.legacyPackages.${system};
name = "Nix"; # must match the name of the top-level .lean file
project = leanPkgs.buildLeanPackage {
inherit name;
# deps = with leanPkgs; [ Init Lean ];#lean-ipld.project.${system} ];
# Where the lean files are located
src = ./src;
};
cli = leanPkgs.buildLeanPackage {
name = "Nix.Cli";
deps = [ project ];
src = ./src;
};
test = leanPkgs.buildLeanPackage {
name = "Tests";
deps = [ project ];
# Where the lean files are located
src = ./test;
};
joinDepsDerivations = getSubDrv:
pkgs.lib.concatStringsSep ":" (map (d: (builtins.tryEval "${getSubDrv d}").value) (project.allExternalDeps));
in
{
inherit project test;
packages = {
${name} = project.sharedLib;
inherit (project) lean-package print-paths;
inherit (leanPkgs) lean;
cli = cli.executable;
test = test.executable;
};
checks.test = test.executable;
defaultPackage = self.packages.${system}.cli;
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
leanPkgs.lean-dev
];
LEAN_PATH = "./src:./test";
LEAN_SRC_PATH = "./src:./test";
};
});
}