mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-29 10:23:29 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
52 lines
1.4 KiB
Nix
52 lines
1.4 KiB
Nix
{ lib, stdenvNoCC, fetchurl, makeBinaryWrapper, jre, version, hash, udev }:
|
|
|
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
|
pname = "papermc";
|
|
inherit version hash;
|
|
|
|
src =
|
|
let
|
|
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 (finalAttrs) hash;
|
|
};
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
install -D $src $out/share/papermc/papermc.jar
|
|
|
|
makeWrapper ${lib.getExe jre} "$out/bin/minecraft-server" \
|
|
--append-flags "-jar $out/share/papermc/papermc.jar nogui" \
|
|
${lib.optionalString stdenvNoCC.hostPlatform.isLinux "--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ udev ]}"}
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
nativeBuildInputs = [
|
|
makeBinaryWrapper
|
|
];
|
|
|
|
dontUnpack = true;
|
|
preferLocalBuild = true;
|
|
allowSubstitutes = false;
|
|
|
|
passthru = {
|
|
updateScript = ./update.py;
|
|
};
|
|
|
|
meta = {
|
|
description = "High-performance Minecraft Server";
|
|
homepage = "https://papermc.io/";
|
|
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
|
|
license = lib.licenses.gpl3Only;
|
|
platforms = lib.platforms.unix;
|
|
maintainers = with lib.maintainers; [ aaronjanse neonfuz MayNiklas ];
|
|
mainProgram = "minecraft-server";
|
|
};
|
|
})
|