-
Notifications
You must be signed in to change notification settings - Fork 28
/
default.nix
30 lines (28 loc) · 967 Bytes
/
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
{ callPackage
, lib
, jre8_headless
, jre_headless
}:
let
versions = lib.importJSON ./versions.json;
# Older Minecraft versions that were written for Java 8, required Java 8.
# Mojang has since rewritten a lot of their codebase so that Java versions
# are no longer as important for stability as they used to be. Meaning we can
# target latest the latest JDK for all newer versions of Minecraft.
# TODO: Assert that jre_headless >= java version
getJavaVersion = v: if v == 8 then jre8_headless else jre_headless;
packages = lib.mapAttrs'
(version: value: {
name = "vanilla-${lib.our.escapeVersion version}";
value = callPackage ./derivation.nix {
inherit (value) version url sha1;
jre_headless = getJavaVersion value.javaVersion;
};
})
versions;
in
lib.recurseIntoAttrs (
packages // {
vanilla = builtins.getAttr "vanilla-${lib.our.escapeVersion (lib.our.latestVersion versions)}" packages;
}
)