Hi,
I'm very new to the Nix file format, and while I am trying to learn it so I can create a runescape-launcher package for it myself I was wondering if anyone in the community is interested in creating a runescape-launcher package. This package should, in theory, be rather simple as it'd be built from a pre-compiled Debian binary. If it helps here is a PKGBUILD for it. Rather impressive how many games are provided by this repository already.
Thanks for your time
I've found a nix file for it https://gist.github.com/matejc/5f60a62b31303b7fe6b809bd422ffd4b. Here is how I've updated it:
{ pkgs ? import <nixpkgs> {} }:
let
version = "2.2.4";
env = pkgs.buildEnv {
name = "runscape-env";
paths = with pkgs; [
/* required by launcher executable */
xorg.libSM xorg.libXxf86vm libpng12 xorg.libX11
webkitgtk2 glib.out pango.out cairo.out gdk_pixbuf gtk.out
stdenv.cc.cc.lib glib_networking.out curl.out
/* required by library additionaly downloaded by launcher - $HOME/Jagex/launcher/librs2client.so */
SDL2 zlib mesa glew110 mesa_drivers
];
};
in
pkgs.stdenv.mkDerivation rec {
name = "runescape-launcher-${version}";
src = pkgs.fetchurl {
url = "https://content.runescape.com/downloads/ubuntu/pool/non-free/r/runescape-launcher/runescape-launcher_${version}_amd64.deb";
sha256 = "02rf2s5498dgh53x08b1mr8grjijpymy0hblqywg0zrazxdvr1da";
};
dontPatchELF = true;
dontStrip = true;
nativeBuildInputs = [ pkgs.dpkg pkgs.makeWrapper ];
unpackCmd = "mkdir root ; dpkg-deb -x $curSrc root";
installPhase = ''
mkdir -p $out
cp -r ./usr/* $out/
substituteInPlace $out/bin/runescape-launcher \
--replace "/usr/share/games/runescape-launcher/runescape" "$out/share/games/runescape-launcher/runescape"
patchelf --set-interpreter $(cat ${pkgs.stdenv.cc}/nix-support/dynamic-linker) \
$out/share/games/runescape-launcher/runescape
wrapProgram $out/share/games/runescape-launcher/runescape \
--prefix LD_LIBRARY_PATH : "/run/opengl-driver/lib:${env}/lib:${env}/lib64"
'';
}
Tried building it by adding this file to pkgs/games/runescape-launcher and running nix-build -A runescape-launcher from the root of this repo but it returned the error:
error: attribute ‘runescape-launcher’ in selection path ‘runescape-launcher’ not found
running this from pkgs/games/runescape-launcher:
nix-build --keep-failed --expr 'with import <nixpkgs> {}; callPackage ./default.nix {}'
and it returned:
error: undefined variable ‘webkitgtk2’ at /data/GitHub/others/nixpkgs/pkgs/games/runescape-launcher/default.nix:9:7
(use ‘--show-trace’ to show detailed location information)
If there's another way to try to build this package I'm afraid I don't know it.
I've updated it to:
{ pkgs ? import <nixpkgs> {} }:
let
version = "2.2.4";
env = pkgs.buildEnv {
name = "runscape-env";
paths = with pkgs; [
/* required by launcher executable */
xorg.libSM xorg.libXxf86vm libpng12 xorg.libX11
webkitgtk glib.out pango.out cairo.out gdk_pixbuf
stdenv.cc.cc.lib glib_networking.out curl.out gtk2 expat
/* required by library additionaly downloaded by launcher - $HOME/Jagex/launcher/librs2client.so */
SDL2 zlib mesa glew110 mesa_drivers
];
};
in
pkgs.stdenv.mkDerivation rec {
name = "runescape-launcher-${version}";
src = pkgs.fetchurl {
url = "https://content.runescape.com/downloads/ubuntu/pool/non-free/r/runescape-launcher/runescape-launcher_${version}_amd64.deb";
sha256 = "0yab34widf3j4s6lhn6w1q76kihrbyphmr4ifkkawg10csd0n17l";
};
dontPatchELF = true;
dontStrip = true;
nativeBuildInputs = [ pkgs.dpkg pkgs.makeWrapper ];
unpackCmd = "mkdir root ; dpkg-deb -x $curSrc root";
installPhase = ''
mkdir -p $out
cp -r ./usr/* $out/
substituteInPlace $out/bin/runescape-launcher \
--replace "/usr/share/games/runescape-launcher/runescape" "$out/share/games/runescape-launcher/runescape"
patchelf --set-interpreter $(cat ${pkgs.stdenv.cc}/nix-support/dynamic-linker) \
$out/share/games/runescape-launcher/runescape
wrapProgram $out/share/games/runescape-launcher/runescape \
--prefix LD_LIBRARY_PATH : "/run/opengl-driver/lib:${env}/lib:${env}/lib64"
'';
}
and now it's building properly. It starts fine but it crashes with the error:
/nix/store/b7scrq1jhja9s1gnclp0p9ycik5x01cg-runescape-launcher-2.2.4/share/games/runescape-launcher/runescape: /nix/store/f80yzx6jjiwhrxvq62qzr09f3j31188v-runscape-env/lib/libcurl.so.4: no version information available (required by /nix/store/b7scrq1jhja9s1gnclp0p9ycik5x01cg-runescape-launcher-2.2.4/share/games/runescape-launcher/runescape)
Gtk-Message: Failed to load module "canberra-gtk-module"
(runescape:23121): Gtk-WARNING **: Unable to locate theme engine in module_path: "murrine",
(runescape:23121): Gtk-WARNING **: Unable to locate theme engine in module_path: "murrine",
(runescape:23121): Gtk-WARNING **: Unable to locate theme engine in module_path: "murrine",
(runescape:23121): Gtk-WARNING **: Unable to locate theme engine in module_path: "adwaita",
(runescape:23121): Gtk-WARNING **: Unable to locate theme engine in module_path: "adwaita",
(runescape:23121): Gtk-WARNING **: Unable to locate theme engine in module_path: "murrine",
(runescape:23121): Gtk-WARNING **: Unable to locate theme engine in module_path: "murrine",
(runescape:23121): Gtk-WARNING **: Unable to locate theme engine in module_path: "murrine",
(runescape:23121): Gtk-WARNING **: Unable to locate theme engine in module_path: "murrine",
(runescape:23121): Gtk-WARNING **: Unable to locate theme engine in module_path: "murrine",
(runescape:23121): Gtk-WARNING **: Unable to locate theme engine in module_path: "murrine",
(runescape:23121): Gtk-WARNING **: Unable to locate theme engine in module_path: "murrine",
(runescape:23121): Gtk-WARNING **: Unable to locate theme engine in module_path: "murrine",
(runescape:23121): Gtk-WARNING **: Unable to locate theme engine in module_path: "murrine",
(runescape:23121): Gtk-WARNING **: Unable to locate theme engine in module_path: "murrine",
(runescape:23121): Gtk-WARNING **: Unable to locate theme engine in module_path: "murrine",
/home/fusion809/Jagex/launcher/rs2client: /nix/store/f80yzx6jjiwhrxvq62qzr09f3j31188v-runscape-env/lib/libcurl.so.4: no version information available (required by /home/fusion809/Jagex/launcher/rs2client)
/home/fusion809/Jagex/launcher/rs2client: relocation error: /nix/store/yydnhs7migvlbl48wpsxan1yvq2icbr9-glibc-2.25-49/lib/libresolv.so.2: symbol __res_maybe_init, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference
I have tried removing ~/Jagex and re-running this but the error persists.
Hi @fusion809, I've sent a PR with runescape-launcher, should hit Nixpkgs soon. For the time being, here is an archive: runescape-launcher.tar.gz. Unpack it, cd into it and run nix-build. You should have the game at result/.
Any progress on this?
Not really, although it did run. If you want to help, you could use the same derivation and update it to the latest version.
The launcher is still at 2.2.4, but they occasionally (every couple of weeks or so) update their .deb, so the sha256 has to be updated. Arch Linux has solved this by validating PGP signature instead of hashes, but maybe @ryantm can have his bot update the hashes?
https://github.com/ryantm/nixpkgs-update only updates things that are in nixpkgs! First get it in, then I'll try to keep it up to date.
In case you were looking for guidance to how to structure the nix expr to get it to auto update, I think my scripts would not be able to update this as is. If you put the version and src derivation into the default.nix file, I think it would figure it out. Oh, also my scripts don't know how to update things that start failing to build, they only update things where the version number changes currently.
I guess nixpkgs-update has to be modified for this to work. The simplest way I can figure out how to look for updates would be to occasionally grab the content-length of the .deb and treat that as a version number, if it's different, download the .deb, get sha256 and update package. Actual version updates happens so rarely that they can be done manually, last 2.2.4 update was released 03 Apr 2017.
Grabbing content-length with curl:
curl -I https://content.runescape.com/downloads/ubuntu/pool/non-free/r/runescape-launcher/runescape-launcher_2.2.4_amd64.deb
I built it today, after updating the checksum (upstream frequently updates the checksums without bumping package version), and running the game caused the splash screen to pop up and then it crashed with the error:
/home/fusion809/Jagex/launcher/rs2client: error while loading shared libraries: libGL.so.1: cannot open shared object file: No such file or directory
After adding the libglvnd package as a dep to wrapper.nix, this error went away, just for another to take its place:
/home/fusion809/Jagex/launcher/rs2client: /usr/lib/libcurl.so.4: no version information available (required by /home/fusion809/Jagex/launcher/rs2client)
(normally this isn't a fatal error to the game, but it did crash).
LD_DEBUG=libs result/bin/runescape-launcher &> debug.log give the debug.log: https://gist.github.com/fusion809/9b81f6c4f21d6a1f2b04d696530660b2, while strace -o strace.log result/bin/runescape-launcher gives the log: https://gist.github.com/c0b1c977bb8a4bd122c49a4d005cb6c0.
After adding the libglvnd package as a dep to wrapper.nix, this error went away, just for another to take its place [...]
Maybe this will help once it hits master: https://github.com/NixOS/nixpkgs/commit/d60421571af455fb6b39478551911a1a134c33ef
Error explanation: https://stackoverflow.com/a/156387
Either they just keep bumping their libcurl dependency or :man_shrugging:
wait4(-1, /nix/store/ixqpxf8npg8pcl07gif5pja93lhlm0gz-runescape-launcher-2.2.4/share/games/runescape-launcher/runescape: /nix/store/sxrvyv32c7p0mxda7vq74npdwvgi3nlj-runscape-env/lib/libcurl.so.4: no version information available (required by /nix/store/ixqpxf8npg8pcl07gif5pja93lhlm0gz-runescape-launcher-2.2.4/share/games/runescape-launcher/runescape)
libcurl version used is 7.64.0
Any thoughts?
Edit: Might this be relevant?
And just in case: relevant strace
The libcurl warning can be ignored. We have the same issue with the Flatpak and it still works.
I figured as much.
strace seems to stop there unless I follow forks.
I noticed this in the log @fusion809 posted: 3599: /nix/store/62lc2nhyx92vw64mhgi1rj5im51hp84i-runescape-launcher-2.2.4/share/games/runescape-launcher/runescape: error: symbol lookup error: undefined symbol: gtk_widget_device_is_shadowed (fatal)
According to the GTK docs, this feature is for 3.0+, unless I'm reading something wrong.
Ahhhhhhhhhhhh. I was using https://github.com/NixOS/nixpkgs/issues/30582#issuecomment-339061893 and didn't realize it was completely different from the wrapper/runtime format that was being used before.
With @fusion809's addition of libglvnd to the wrapper.nix, it seems to launch fine.
The only weird thing is the social network login buttons, which require xdg-open, though I'm not sure what needs to be done beyond that.
After adding xdg_utils and firefox, the app seems to have feature parity with the Gentoo package.
I'm sure an option could be added at some point for xdg_utils, but for now, this is working fine.
The only catch is that the launcher must be closed manually after the client launches, though as mentioned, the Gentoo package suffers the same issue.
Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:
While I would be happy to see this on here, I’m curious as to how we’d handle the constant updates from the same url.
I’m not sure if there’s a way to accomplish this with nixpkgs if we need a fixed hash.
I only closed this as I am sick of getting notified from stale bots. I'd still like to see a native RuneScape launcher package for NixOS.
Oh for sure. I got hit too and know what you mean.
Most helpful comment
Hi @fusion809, I've sent a PR with runescape-launcher, should hit Nixpkgs soon. For the time being, here is an archive: runescape-launcher.tar.gz. Unpack it,
cdinto it and runnix-build. You should have the game atresult/.