-
Notifications
You must be signed in to change notification settings - Fork 2
/
overlay.nix
27 lines (27 loc) · 1.1 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
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;
}