ctucx.git: nixfiles

ctucx' nixfiles

commit 6428a1246fb57f87487c496b370ea18d6850db69
parent 7d910c8d5fce79bb4223dac9838f6e1ec6aabe57
Author: Leah (ctucx) <git@ctu.cx>
Date: Mon, 18 Nov 2024 09:00:25 +0100

pkgs: add `pocketmine-mp`
2 files changed, 46 insertions(+), 0 deletions(-)
M
pkgs/overlay.nix
|
1
+
A
pkgs/pocketmine-mp.nix
|
45
+++++++++++++++++++++++++++++++++++++++++++++
diff --git a/pkgs/overlay.nix b/pkgs/overlay.nix
@@ -13,6 +13,7 @@ final: prev:
   mbusd                    = final.callPackage ./mbusd.nix {};
   homebridge               = final.callPackage ./homebridge {};
   agenix                   = final.callPackage ./agenix {};
+  pocketmine-mp            = final.callPackage ./pocketmine-mp.nix {};
 
   usbtan-cli               = final.callPackage ./usbtan-cli {};
   rofi-iwd-wifi-menu       = final.callPackage ./rofi-iwd-wifi-menu.nix {};
diff --git a/pkgs/pocketmine-mp.nix b/pkgs/pocketmine-mp.nix
@@ -0,0 +1,44 @@
+{ lib, stdenvNoCC, fetchurl, fetchzip, autoPatchelfHook, libcxx, readline }:
+
+stdenvNoCC.mkDerivation rec {
+  pname = "PocketMine-MP";
+  version = "5.21.1";
+
+  php = fetchzip {
+    url = "https://github.com/pmmp/PHP-Binaries/releases/download/php-8.2-latest/PHP-Linux-x86_64-PM5.tar.gz";
+    hash = "sha256-OO7wGQxJ/0+WiNILd8IE3xwBVFjfcD/AiK0E9aGi2gw=";
+  };
+
+  dontUnpack = true;
+  src = fetchurl {
+    url  = "https://github.com/pmmp/${pname}/releases/download/${version}/PocketMine-MP.phar";
+    hash = "sha256-cZH+GAMBdpQwXeqIPSLZWk2oEtWD/4ZgjPYySomZqSQ=";
+  };
+
+  nativeBuildInputs = [
+    autoPatchelfHook
+  ];
+
+  buildInputs = [
+    libcxx
+    readline
+  ];
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir $out;
+    cp -r ${php}/php7/. $out/
+
+    cp $src $out/PocketMine-MP.phar
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "A server software for Minecraft: Bedrock Edition in PHP.";
+    homepage = "https://github.com/pmmp/PocketMine-MP";
+    license = with licenses; [ gpl3Only ];
+    platforms = platforms.linux;
+  };
+}+
\ No newline at end of file