-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathdefault.nix
129 lines (111 loc) · 4.67 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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# This might be helfpul later:
# https://www.reddit.com/r/NixOS/comments/6hswg4/how_do_i_turn_an_overlay_into_a_proper_package_set/
self: super:
let
inherit (super) lib stdenv pkgs;
gitignoreNix = pkgs.fetchFromGitHub {
owner = "hercules-ci";
repo = "gitignore.nix";
rev = "00b237fb1813c48e20ee2021deb6f3f03843e9e4";
sha256 = "186pvp1y5fid8mm8c7ycjzwzhv7i6s3hh33rbi05ggrs7r3as3yy";
};
gitignoreSource = (import gitignoreNix { inherit lib; }).gitignoreSource;
overlayOcamlPackages = version: {
"ocamlPackages_${version}" =
super.ocaml-ng."ocamlPackages_${version}".overrideScope'
(pkgs.callPackage ./ocaml {});
};
ocamlVersions = ["4_06" "4_08" "4_09" "4_10" "4_11" "4_12"];
oPs =
lib.fold lib.mergeAttrs {}
(builtins.map overlayOcamlPackages ocamlVersions);
in
{
# Stripped down postgres without the `bin` part, to allow static linking
# with musl
libpq = super.postgresql.override { enableSystemd = false; };
dot-merlin-reader = (super.dot-merlin-reader.override {
inherit (self) ocamlPackages;
}).overrideAttrs (_: {
src = builtins.fetchurl {
url = https://github.com/ocaml/merlin/archive/487eb6f.tar.gz;
sha256 = "0jy5ixzlhplx7yy7l9wlq2ix9j5a1w4mj7q8rggz0y95wp6xprnh";
};
});
ocamlPackages-bs = self.ocaml-ng.ocamlPackages_4_06.overrideScope' (oself: osuper: {
ocaml = import ./bucklescript-experimental/ocaml.nix {
stdenv = super.stdenv;
src = "${self.bucklescript-experimental.src}/ocaml";
version = "4.06.1+BS";
};
});
ocamlPackages = oPs.ocamlPackages_4_11;
ocamlPackages_latest = self.ocamlPackages;
opaline = (super.opaline.override {
inherit (self) ocamlPackages;
}).overrideAttrs (o: {
nativeBuildInputs = o.buildInputs;
});
# 4.06, 4.09 and 4.10 treated specially out of convenience because:
# - 4.09 is still used in some of my projects
# - 4.10 is the latest stable version
# - 4.06 is used by BuckleScript
ocaml-ng = super.ocaml-ng // oPs // {
ocamlPackages = self.ocamlPackages;
ocamlPackages_multicore = (oPs.ocamlPackages_4_10.overrideScope' (oself: osuper: {
ocaml = osuper.ocaml.overrideAttrs (_: {
version = "4.10.0+multicore+no-effect-syntax";
hardeningDisable = ["strictoverflow"];
src = builtins.fetchurl {
url = https://github.com/ocaml-multicore/ocaml-multicore/archive/f7310b057a65159aa7627237bd14dca3a58e9a53.tar.gz;
sha256 = "05dzf3x8p37kvpwk7358s1ibmi8yx2dn02blh19298dh6d7dqbgv";
};
});
})).overrideScope' (pkgs.callPackage ./ocaml {});
};
ocamlformat = super.ocamlformat.overrideAttrs (o: {
src = builtins.fetchurl {
url = https://github.com/ocaml-ppx/ocamlformat/releases/download/0.16.0/ocamlformat-0.16.0.tbz;
sha256 = "1vwjvvwha0ljc014v8jp8snki5zsqxlwd7x0dl0rg2i9kcmwc4mr";
};
buildInputs = (lib.remove self.ocamlPackages.ocaml-migrate-parsetree-1-8 o.buildInputs) ++
(with self.ocamlPackages; [ ppxlib dune-build-info ocaml-version ocaml-migrate-parsetree-2-1 ]);
});
# BuckleScript
bs-platform = pkgs.callPackage ./bs-platform {
ocamlPackages = self.ocamlPackages-bs;
};
dune_2 =
if lib.versionAtLeast self.ocamlPackages.ocaml.version "4.07"
then self.ocamlPackages.dune_2
else if lib.versionAtLeast self.ocamlPackages.ocaml.version "4.02"
then self.ocaml-ng.ocamlPackages_4_11.dune_2
else throw "dune_2 is not available for OCaml ${self.ocamlPackages.ocaml.version}";
bucklescript-experimental = pkgs.callPackage ./bucklescript-experimental {
ocamlPackages = self.ocamlPackages-bs;
dune_2 = self.ocamlPackages.dune_2;
};
pkgsCross = super.pkgsCross // {
musl64 = super.pkgsCross.musl64.appendOverlays (super.pkgsCross.musl64.callPackage ./static {
inherit ocamlVersions;
});
};
# Other packages
lib = super.lib // rec {
inherit gitignoreSource;
filterSource = { src, dirs ? [], files ? [] }: (super.lib.cleanSourceWith rec {
inherit src;
# Good examples: https://github.com/NixOS/nixpkgs/blob/master/lib/sources.nix
filter = name: type:
let
path = toString name;
baseName = baseNameOf path;
relPath = lib.removePrefix (toString src + "/") path;
in
lib.any (dir: dir == relPath || (lib.hasPrefix "${dir}/" relPath)) dirs ||
(type == "regular" && (lib.any (file: file == baseName) files));
});
filterGitSource = args: gitignoreSource (filterSource args);
};
cockroachdb = pkgs.callPackage ./cockroachdb {};
}