depot/third_party/nixpkgs/pkgs/games/minecraft-servers/default.nix
Default email 4cb23072fc Project import generated by Copybara.
GitOrigin-RevId: 6d8215281b2f87a5af9ed7425a26ac575da0438f
2022-01-20 00:45:15 +01:00

24 lines
816 B
Nix

{ callPackage, lib, javaPackages }:
let
versions = lib.importJSON ./versions.json;
latestVersion = lib.last (builtins.sort lib.versionOlder (builtins.attrNames versions));
escapeVersion = builtins.replaceStrings [ "." ] [ "-" ];
getJavaVersion = v: (builtins.getAttr "openjdk${toString v}" javaPackages.compiler).headless;
packages = lib.mapAttrs'
(version: value: {
name = "vanilla-${escapeVersion version}";
value = callPackage ./derivation.nix {
inherit (value) version url sha1;
jre_headless = getJavaVersion (if value.javaVersion == null then 8 else value.javaVersion); # versions <= 1.6 will default to 8
};
})
versions;
in
lib.recurseIntoAttrs (
packages // {
vanilla = builtins.getAttr "vanilla-${escapeVersion latestVersion}" packages;
}
)