depot/pkgs/games/minecraft-servers/default.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

28 lines
896 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 if value.javaVersion == 16 then 17
else value.javaVersion
); # versions <= 1.6 will default to 8
};
})
versions;
in
lib.recurseIntoAttrs (
packages // {
vanilla = builtins.getAttr "vanilla-${escapeVersion latestVersion}" packages;
}
)