about summary refs log tree commit diff
path: root/pkgs/by-name/po/portablemc/package.nix
blob: 444dd9d20550638e4701881043b44e674cddb25a (plain) (blame)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{
  lib,
  stdenv,
  python3Packages,
  fetchFromGitHub,
  installShellFiles,
  jre,

  libX11,
  libXext,
  libXcursor,
  libXrandr,
  libXxf86vm,
  libpulseaudio,
  libGL,
  glfw,
  openal,
  udev,

  textToSpeechSupport ? stdenv.isLinux,
  flite,
}:

let
  # Copied from the `prismlauncher` package
  runtimeLibs = [
    libX11
    libXext
    libXcursor
    libXrandr
    libXxf86vm

    # lwjgl
    libpulseaudio
    libGL
    glfw
    openal
    stdenv.cc.cc.lib

    # oshi
    udev
  ] ++ lib.optional textToSpeechSupport flite;
in
python3Packages.buildPythonApplication rec {
  pname = "portablemc";
  version = "4.3.0";
  pyproject = true;

  disabled = python3Packages.pythonOlder "3.8";

  src = fetchFromGitHub {
    owner = "mindstorm38";
    repo = "portablemc";
    rev = "v${version}";
    hash = "sha256-jCv4ncXUWbkWlBZr3P1hNeVpdQzY9HtrFz+pmKknL0I=";
  };

  patches = [
    # Use the jre package provided by nixpkgs by default
    ./use-builtin-java.patch
  ];

  nativeBuildInputs = [ installShellFiles ];

  build-system = [ python3Packages.poetry-core ];

  dependencies = [ python3Packages.certifi ];

  # Note: Tests use networking, so we don't run them

  postInstall = ''
    installShellCompletion --cmd portablemc \
        --bash <($out/bin/portablemc show completion bash) \
        --zsh <($out/bin/portablemc show completion zsh)
  '';

  preFixup = ''
    makeWrapperArgs+=(
      --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath runtimeLibs}
      --prefix PATH : ${lib.makeBinPath [ jre ]}
    )
  '';

  meta = {
    homepage = "https://github.com/mindstorm38/portablemc";
    description = "A fast, reliable and cross-platform command-line Minecraft launcher and API for developers";
    longDescription = ''
      A fast, reliable and cross-platform command-line Minecraft launcher and API for developers.
      Including fast and easy installation of common mod loaders such as Fabric, Forge, NeoForge and Quilt.
      This launcher is compatible with the standard Minecraft directories.
    '';
    changelog = "https://github.com/mindstorm38/portablemc/releases/tag/${src.rev}";
    license = lib.licenses.gpl3Only;
    mainProgram = "portablemc";
    maintainers = with lib.maintainers; [ tomasajt ];
  };
}