about summary refs log tree commit diff
path: root/pkgs/by-name/mo/modrinth-app/package.nix
blob: c92b6319d5a571168150e34d01ad0cce7be2a78c (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
{
  lib,
  stdenv,
  symlinkJoin,
  modrinth-app-unwrapped,
  wrapGAppsHook3,
  addDriverRunpath,
  flite,
  glib,
  glib-networking,
  jdk8,
  jdk17,
  jdk21,
  jdks ? [
    jdk8
    jdk17
    jdk21
  ],
  libGL,
  libpulseaudio,
  udev,
  xorg,
}:
symlinkJoin rec {
  name = "${pname}-${version}";
  pname = "modrinth-app";
  inherit (modrinth-app-unwrapped) version;

  paths = [ modrinth-app-unwrapped ];

  buildInputs = [
    glib
    glib-networking
  ];

  nativeBuildInputs = [
    wrapGAppsHook3
  ];

  runtimeDependencies = lib.optionalString stdenv.hostPlatform.isLinux (lib.makeLibraryPath [
    addDriverRunpath.driverLink
    flite # narrator support

    udev # oshi

    # lwjgl
    libGL
    libpulseaudio
    stdenv.cc.cc.lib
    xorg.libX11
    xorg.libXcursor
    xorg.libXext
    xorg.libXxf86vm
    xorg.libXrandr
  ]);

  postBuild = ''
    gappsWrapperArgs+=(
      --prefix PATH : ${lib.makeSearchPath "bin/java" jdks}
      ${lib.optionalString stdenv.hostPlatform.isLinux ''
        --prefix PATH : ${lib.makeBinPath [xorg.xrandr]}
        --set LD_LIBRARY_PATH $runtimeDependencies
      ''}
    )

    wrapGAppsHook
  '';

  inherit (modrinth-app-unwrapped) meta;
}