-
Notifications
You must be signed in to change notification settings - Fork 16
/
flake.nix
51 lines (47 loc) · 1.57 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
{
description = "Experimental implementation of Cartesian cubical type theory";
inputs = {
opam-repository = {
url = "github:ocaml/opam-repository";
flake = false;
};
opam-nix.url = "github:tweag/opam-nix";
opam-nix.inputs.opam-repository.follows = "opam-repository";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.follows = "opam-nix/nixpkgs";
};
outputs = { self, flake-utils, opam-nix, opam-repository, nixpkgs }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
on = opam-nix.lib.${system};
localPackagesQuery = builtins.mapAttrs (_: pkgs.lib.last)
(on.listRepo (on.makeOpamRepo ./.));
devPackagesQuery = {
ocaml-lsp-server = "*";
ocp-indent = "*";
merlin = "*";
};
query = devPackagesQuery // {
ocaml-base-compiler = "*";
};
scope = on.buildDuneProject { } "cooltt" ./. query;
devPackages = builtins.attrValues
(pkgs.lib.getAttrs (builtins.attrNames devPackagesQuery) scope);
packages =
pkgs.lib.getAttrs (builtins.attrNames localPackagesQuery) scope;
in
{
legacyPackages = scope;
packages = packages // { default = packages.cooltt; };
devShells.default = pkgs.mkShell {
inputsFrom = builtins.attrValues packages;
buildInputs = devPackages ++ [
pkgs.fd
pkgs.nixpkgs-fmt
pkgs.pkg-config
pkgs.shellcheck
];
};
});
}