nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 autoPatchelfHook,
5 buildFHSEnv,
6 cairo,
7 dpkg,
8 fetchurl,
9 gcc-unwrapped,
10 glib,
11 glibc,
12 gtk2-x11,
13 libGL,
14 libpulseaudio,
15 libSM,
16 libXxf86vm,
17 libx11,
18 openssl_1_1,
19 pango,
20 SDL2,
21 wrapGAppsHook3,
22 xdg-utils,
23 xorg_sys_opengl,
24 zlib,
25}:
26let
27
28 runescape = stdenv.mkDerivation rec {
29 pname = "runescape-launcher";
30 version = "2.2.11";
31
32 # Packages: https://content.runescape.com/downloads/ubuntu/dists/trusty/non-free/binary-amd64/Packages
33 # upstream is https://content.runescape.com/downloads/ubuntu/pool/non-free/r/${pname}/${pname}_${version}_amd64.deb
34 src = fetchurl {
35 url = "https://archive.org/download/${pname}_${version}_amd64/${pname}_${version}_amd64.deb";
36 sha256 = "0dyilgbsr28zqpf711wygg706vn7sqxklnsnbghwkxfzzjppz2xw";
37 };
38
39 nativeBuildInputs = [
40 autoPatchelfHook
41 dpkg
42 wrapGAppsHook3
43 ];
44
45 buildInputs = [
46 cairo
47 gcc-unwrapped
48 glib
49 glibc
50 gtk2-x11
51 libSM
52 libXxf86vm
53 libx11
54 openssl_1_1
55 pango
56 zlib
57 ];
58
59 runtimeDependencies = [
60 libGL
61 libpulseaudio
62 SDL2
63 openssl_1_1
64 xdg-utils # The launcher uses `xdg-open` to open HTTP URLs in the user's browser
65 xorg_sys_opengl
66 zlib
67 ];
68
69 dontUnpack = true;
70
71 preBuild = ''
72 export DH_VERBOSE=1
73 '';
74
75 envVarsWithXmodifiers = ''
76 export MESA_GLSL_CACHE_DIR=~/Jagex
77 export GDK_SCALE=2
78 unset XMODIFIERS
79 '';
80
81 installPhase = ''
82 mkdir -p $out/bin $out/share
83 dpkg -x $src $out
84
85 patchShebangs $out/usr/bin/runescape-launcher
86 substituteInPlace $out/usr/bin/runescape-launcher \
87 --replace "unset XMODIFIERS" "$envVarsWithXmodifiers" \
88 --replace "/usr/share/games/runescape-launcher/runescape" "$out/share/games/runescape-launcher/runescape"
89
90 cp -r $out/usr/bin $out/
91 cp -r $out/usr/share $out/
92
93 rm -r $out/usr
94 '';
95
96 meta = {
97 description = "Launcher for RuneScape 3, the current main RuneScape";
98 homepage = "https://www.runescape.com/";
99 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
100 license = lib.licenses.unfree;
101 maintainers = [ ];
102 platforms = [ "x86_64-linux" ];
103 };
104 };
105
106in
107
108/*
109 * We can patch the runescape launcher, but it downloads a client at runtime and checks it for changes.
110 * For that we need use a buildFHSEnv.
111 * FHS simulates a classic linux shell
112*/
113buildFHSEnv {
114 pname = "RuneScape";
115 inherit (runescape) version;
116 targetPkgs = pkgs: [
117 runescape
118 cairo
119 dpkg
120 gcc-unwrapped
121 glib
122 glibc
123 gtk2-x11
124 libGL
125 libpulseaudio
126 libSM
127 libXxf86vm
128 libx11
129 openssl_1_1
130 pango
131 SDL2
132 xdg-utils
133 libx11
134 xorg_sys_opengl
135 zlib
136 ];
137 multiPkgs = pkgs: [ libGL ];
138 runScript = "runescape-launcher";
139 extraInstallCommands = ''
140 mkdir -p "$out/share/applications"
141 cp ${runescape}/share/applications/runescape-launcher.desktop "$out/share/applications"
142 cp -r ${runescape}/share/icons "$out/share/icons"
143 substituteInPlace "$out/share/applications/runescape-launcher.desktop" \
144 --replace "/usr/bin/runescape-launcher" "RuneScape"
145 '';
146
147 meta = {
148 description = "RuneScape Game Client (NXT) - Launcher for RuneScape 3";
149 homepage = "https://www.runescape.com/";
150 license = lib.licenses.unfree;
151 maintainers = [ ];
152 platforms = [ "x86_64-linux" ];
153 };
154}