summary refs log tree commit diff
path: root/pkgs/games/runelite/default.nix
blob: f6d8a9c198ba00db2fcc378bf0dd83e354fd9566 (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
{ lib
, stdenv
, makeDesktopItem
, fetchurl
, makeWrapper
, xorg
, jre
,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "runelite";
  version = "2.6.9";

  jar = fetchurl {
    url = "https://github.com/runelite/launcher/releases/download/${finalAttrs.version}/RuneLite.jar";
    hash = "sha256-91iBBviXM3tJN/jRgcOzUuTAr9VrKnW55uYrNW7eB5Q=";
  };

  icon = fetchurl {
    url = "https://github.com/runelite/launcher/raw/${finalAttrs.version}/appimage/runelite.png";
    hash = "sha256-gcts59jEuRVOmECrnSk40OYjTyJwSfAEys+Qck+VzBE=";
  };
  dontUnpack = true;

  desktop = makeDesktopItem {
    name = "RuneLite";
    type = "Application";
    exec = "runelite";
    icon = finalAttrs.icon;
    comment = "Open source Old School RuneScape client";
    desktopName = "RuneLite";
    genericName = "Oldschool Runescape";
    categories = [ "Game" ];
  };

  nativeBuildInputs = [ makeWrapper ];
  installPhase = ''
    mkdir -p $out/share/runelite
    mkdir -p $out/share/applications

    ln -s ${finalAttrs.jar} $out/share/runelite/RuneLite.jar
    ln -s ${finalAttrs.desktop}/share/applications/RuneLite.desktop $out/share/applications/RuneLite.desktop

    makeWrapper ${jre}/bin/java $out/bin/runelite \
      --prefix LD_LIBRARY_PATH : "${xorg.libXxf86vm}/lib" \
      --add-flags "-jar $out/share/runelite/RuneLite.jar"
  '';

  meta = {
    description = "Open source Old School RuneScape client";
    homepage = "https://runelite.net/";
    sourceProvenance = with lib.sourceTypes; [
      binaryBytecode
      binaryNativeCode
    ];
    license = lib.licenses.bsd2;
    maintainers = with lib.maintainers; [ kmeakin ];
    platforms = [ "x86_64-linux" ];
    mainProgram = "runelite";
  };
})