-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathpkgs.nix
76 lines (69 loc) · 1.63 KB
/
pkgs.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
nixpkgs: nixpkgsForGraal: system: let
makeOverlays = java: graal: let
ammoniteOverlay = final: prev: let
pkgsForGraal = import nixpkgsForGraal {
inherit system;
};
in {
ammonite = prev.ammonite.override {
jre =
if graal
then pkgsForGraal.${java}
else final.${java};
};
};
bloopOverlay = final: prev: {
bloop = prev.bloop.override {
jre = final.jre;
};
};
millOverlay = final: prev: {
mill = prev.mill.override {
jre = final.jre;
};
};
javaOverlay = final: _: let
pkgsForGraal = import nixpkgsForGraal {
inherit system;
};
in {
jdk =
if graal
then pkgsForGraal.${java}
else final.${java};
jre =
if graal
then pkgsForGraal.${java}
else final.${java};
};
scalaCliOverlay = _: prev: let
pkgsForGraal = import nixpkgsForGraal {
inherit system;
};
in {
scala-cli = prev.scala-cli.override {
# hardcoded because scala-cli requires 17 or above
jre = pkgsForGraal.graalvm-ce;
};
};
in [
javaOverlay
bloopOverlay
scalaCliOverlay
ammoniteOverlay
millOverlay
];
makePackages = java: graal: let
overlays = makeOverlays java graal;
in
import nixpkgs {
inherit system overlays;
};
default = pkgs21;
pkgs21 = makePackages "graalvm-ce" true;
pkgs17 = makePackages "temurin-bin-17" false;
pkgs11 = makePackages "temurin-bin-11" false;
pkgs8 = makePackages "openjdk8" false;
in {
inherit default pkgs21 pkgs17 pkgs11 pkgs8;
}