-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathoverlay.nix
47 lines (47 loc) · 1.21 KB
/
overlay.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
let
manifests = import ./manifests;
readSrc = {
src,
bootstrap,
}: final: prev:
prev
// rec {
lean =
(prev.callPackage ./lib/packages.nix {inherit src bootstrap;})
// {
lake = lean.Lake-Main.executable;
};
};
readFromGit = {
args,
bootstrap,
}:
readSrc {
src = builtins.fetchGit args;
inherit bootstrap;
};
readRev = {
rev,
bootstrap,
tag,
}:
readFromGit {
args = {
url = "https://github.com/leanprover/lean4.git";
shallow = true;
ref = "refs/tags/${tag}";
inherit rev;
};
inherit bootstrap;
};
tags = builtins.mapAttrs (tag: manifest: readRev {inherit (manifest) tag rev bootstrap;}) manifests;
readToolchain = toolchain:
builtins.addErrorContext "Only leanprover/lean4:{tag} toolchains are supported" (let
matches = builtins.match "^[[:space:]]*leanprover/lean4:([a-zA-Z0-9\\-\\.]+)[[:space:]]*$" toolchain;
tag = builtins.head matches;
in
builtins.getAttr tag tags);
readToolchainFile = toolchainFile: readToolchain (builtins.readFile toolchainFile);
in {
inherit readSrc readFromGit readRev tags readToolchain readToolchainFile;
}