aboutsummaryrefslogtreecommitdiff
path: root/packages/zenithproxy/default.nix
blob: c468145436e6897dbe5da7471b0a3c60c7ae9bba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{ lib, pkgs, stdenvNoCC, autoPatchelfHook, ... }:

let
  zenithproxy-launcher = stdenvNoCC.mkDerivation rec {
    pname = "zenithproxy-launcher";
    version = "v3";

    src = pkgs.fetchzip {
      url = "https://github.com/rfresh2/ZenithProxy/releases/download/launcher-${version}/ZenithProxy-launcher-linux-amd64.zip";
      hash = "sha256-ImoPNNxn3kpOWGkXwgQBAj/dJlK9BR50PSJnTwUVxU8=";
    };
    
    buildInputs = with pkgs; [
      zlib
    ];

    nativeBuildInputs = [ autoPatchelfHook ];

    installPhase = ''
      runHook preInstall
      install -Dm755 launch -t $out/bin
      runHook postInstall
    '';
  };
in pkgs.buildFHSEnv {
  name = "zenithproxy";

  targetPkgs = (pkgs: with pkgs; [
    zenithproxy-launcher
  ]);

  runScript = pkgs.writeShellScript "zenithproxy-wrapper" ''
    rm -f ./launch
    cp "${zenithproxy-launcher}/bin/launch" ./launch
    shift; exec ./launch "$@"
  '';

  meta = {
    description = "2b2t minecraft proxy / bot";
    homepage = "https://github.com/rfresh2/ZenithProxy";
    license = lib.licenses.agpl3Only;
    maintainers = with lib.maintainers; [ CartConnoisseur ];
  };
}