forked from ocaml/ocaml-lsp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
38 lines (36 loc) · 1.14 KB
/
default.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
# paramaterised derivation with dependencies injected (callPackage style)
{ pkgs, stdenv, opam2nix }:
let
strings = pkgs.lib.strings;
args = {
inherit (pkgs.ocaml-ng.ocamlPackages_4_12) ocaml;
selection = ./opam-selection.nix;
src = builtins.filterSource (path: type:
let name = baseNameOf path;
in if type == "directory" then
name != ".git" && name != "_build" && name != "node_modules" && name
!= ".log"
else
(strings.hasSuffix ".opam" name || name == "unvendor.ml")) ../.;
};
opam-selection = opam2nix.build args;
localPackages = let contents = builtins.attrNames (builtins.readDir ../.);
in builtins.filter (strings.hasSuffix ".opam") contents;
resolve = opam2nix.resolve args (localPackages ++ [
# dev deps
"cinaps"
"menhir"
"ppx_yojson_conv"
# test deps
"ppx_expect"
"ocamlformat-rpc"
]);
in (builtins.listToAttrs (builtins.map (fname:
let packageName = strings.removeSuffix ".opam" fname;
in {
name = packageName;
value = builtins.getAttr packageName opam-selection;
}) localPackages)) // {
inherit resolve;
opam = opam-selection;
}