From b254d2b1fefa96aed7f832ba5f1ab792ff50b8c4 Mon Sep 17 00:00:00 2001 From: Joel Date: Sat, 15 Jan 2022 11:59:56 +1000 Subject: [PATCH] minecraftServers: init - move all minecraft-server versions into minecraftServers --- .../default.nix | 13 ++++++------ .../derivation.nix | 0 .../update.py | 0 .../versions.json | 0 pkgs/top-level/all-packages.nix | 21 ++----------------- 5 files changed, 9 insertions(+), 25 deletions(-) rename pkgs/games/{minecraft-server => minecraft-servers}/default.nix (66%) rename pkgs/games/{minecraft-server => minecraft-servers}/derivation.nix (100%) rename pkgs/games/{minecraft-server => minecraft-servers}/update.py (100%) rename pkgs/games/{minecraft-server => minecraft-servers}/versions.json (100%) diff --git a/pkgs/games/minecraft-server/default.nix b/pkgs/games/minecraft-servers/default.nix similarity index 66% rename from pkgs/games/minecraft-server/default.nix rename to pkgs/games/minecraft-servers/default.nix index 2ea8d2a5a508..f3d4aad16698 100644 --- a/pkgs/games/minecraft-server/default.nix +++ b/pkgs/games/minecraft-servers/default.nix @@ -1,16 +1,15 @@ { callPackage, lib, javaPackages }: -# if you add more versions make sure to add to all-packages.nix let versions = lib.importJSON ./versions.json; latestVersion = lib.last (builtins.sort lib.versionOlder (builtins.attrNames versions)); - escapeVersion = builtins.replaceStrings [ "." ] [ "_" ]; + escapeVersion = builtins.replaceStrings [ "." ] [ "-" ]; getJavaVersion = v: (builtins.getAttr "openjdk${toString v}" javaPackages.compiler).headless; packages = lib.mapAttrs' (version: value: { - name = "minecraft-server_${escapeVersion version}"; + 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 @@ -18,6 +17,8 @@ let }) versions; in -packages // { - minecraft-server = builtins.getAttr "minecraft-server_${escapeVersion latestVersion}" packages; -} +lib.recurseIntoAttrs ( + packages // { + vanilla = builtins.getAttr "vanilla-${escapeVersion latestVersion}" packages; + } +) diff --git a/pkgs/games/minecraft-server/derivation.nix b/pkgs/games/minecraft-servers/derivation.nix similarity index 100% rename from pkgs/games/minecraft-server/derivation.nix rename to pkgs/games/minecraft-servers/derivation.nix diff --git a/pkgs/games/minecraft-server/update.py b/pkgs/games/minecraft-servers/update.py similarity index 100% rename from pkgs/games/minecraft-server/update.py rename to pkgs/games/minecraft-servers/update.py diff --git a/pkgs/games/minecraft-server/versions.json b/pkgs/games/minecraft-servers/versions.json similarity index 100% rename from pkgs/games/minecraft-server/versions.json rename to pkgs/games/minecraft-servers/versions.json diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 48ac8d6200f6..b953821145d8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -30810,25 +30810,8 @@ with pkgs; minecraft = callPackage ../games/minecraft { }; - inherit (import ../games/minecraft-server { inherit callPackage lib javaPackages; }) - minecraft-server_1_2 - minecraft-server_1_3 - minecraft-server_1_4 - minecraft-server_1_5 - minecraft-server_1_6 - minecraft-server_1_7 - minecraft-server_1_8 - minecraft-server_1_9 - minecraft-server_1_10 - minecraft-server_1_11 - minecraft-server_1_12 - minecraft-server_1_13 - minecraft-server_1_14 - minecraft-server_1_15 - minecraft-server_1_16 - minecraft-server_1_17 - minecraft-server_1_18 - minecraft-server; + minecraftServers = import ../games/minecraft-servers { inherit callPackage lib javaPackages; }; + minecraft-server = minecraftServers.vanilla; # backwards compatibility moon-buggy = callPackage ../games/moon-buggy {};