From 2282f6f5e1bfcb6acd550b6e889525daab8f0ec9 Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Sun, 17 Mar 2024 16:42:14 -0400 Subject: [PATCH 1/2] papermc: revert to old URL construction This uses two bindings to build the URL instead of three. This allows the version string to differ from the papermc URL format, at the loss of... nothing, as far as I can tell. My motivation for reverting the change is to reduce the number of references to 'version', since it requires special handling to handle overrides correctly. --- pkgs/games/papermc/derivation.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/games/papermc/derivation.nix b/pkgs/games/papermc/derivation.nix index f244031f0590..d6bce24443e6 100644 --- a/pkgs/games/papermc/derivation.nix +++ b/pkgs/games/papermc/derivation.nix @@ -11,7 +11,7 @@ stdenvNoCC.mkDerivation { buildNum = builtins.elemAt version-split 1; in fetchurl { - url = "https://papermc.io/api/v2/projects/paper/versions/${mcVersion}/builds/${buildNum}/downloads/paper-${version}.jar"; + url = "https://papermc.io/api/v2/projects/paper/versions/${mcVersion}/builds/${buildNum}/downloads/paper-${mcVersion}-${buildNum}.jar"; inherit hash; }; From 85f544d85e92e86b30f9e2c4327f3cd44b51bcbe Mon Sep 17 00:00:00 2001 From: Majiir Paktu Date: Sun, 17 Mar 2024 16:44:35 -0400 Subject: [PATCH 2/2] papermc: fix version/hash overrides Reintroduces the use of finalAttrs that was introduced in d0bb02b106d4fb00445e71253df34497ffd556cc and erroneously removed in ef321a0ed68ccc8b0babaca977303ff5528e8fa5. --- pkgs/games/papermc/derivation.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/games/papermc/derivation.nix b/pkgs/games/papermc/derivation.nix index d6bce24443e6..50796407c297 100644 --- a/pkgs/games/papermc/derivation.nix +++ b/pkgs/games/papermc/derivation.nix @@ -1,18 +1,18 @@ { lib, stdenvNoCC, fetchurl, makeBinaryWrapper, jre, version, hash }: -stdenvNoCC.mkDerivation { +stdenvNoCC.mkDerivation (finalAttrs: { pname = "papermc"; - inherit version; + inherit version hash; src = let - version-split = lib.strings.splitString "-" version; + version-split = lib.strings.splitString "-" finalAttrs.version; mcVersion = builtins.elemAt version-split 0; buildNum = builtins.elemAt version-split 1; in fetchurl { url = "https://papermc.io/api/v2/projects/paper/versions/${mcVersion}/builds/${buildNum}/downloads/paper-${mcVersion}-${buildNum}.jar"; - inherit hash; + inherit (finalAttrs) hash; }; installPhase = '' @@ -47,4 +47,4 @@ stdenvNoCC.mkDerivation { maintainers = with lib.maintainers; [ aaronjanse neonfuz MayNiklas ]; mainProgram = "minecraft-server"; }; -} +})