1 { lib, stdenv, fetchurl, glibc, libX11, runtimeShell, libGLU, libGL }:
3 stdenv.mkDerivation rec {
8 url = "http://static.tibia.com/download/tibia${lib.replaceStrings ["."] [""] version}.tgz";
9 sha256 = "11mkh2dynmbpay51yfaxm5dmcys3rnpk579s9ypfkhblsrchbkhx";
14 # These binaries come stripped already and trying to strip after the
15 # files are in $out/res and after patchelf just breaks them.
16 # Strangely it works if the files are in $out but then nix doesn't
17 # put them in our PATH. We set all the files to $out/res because
18 # we'll be using a wrapper to start the program which will go into
26 patchelf --set-interpreter ${glibc.out}/lib/ld-linux.so.2 \
27 --set-rpath ${lib.makeLibraryPath [ stdenv.cc.cc libX11 libGLU libGL ]} \
30 # We've patchelf'd the files. The main ‘Tibia’ binary is a bit
31 # dumb so it looks for ‘./Tibia.dat’. This requires us to be in
32 # the same directory as the file itself but that's very tedious,
33 # especially with nix which changes store hashes. Here we generate
34 # a simple wrapper that we put in $out/bin which will do the
35 # directory changing for us.
39 # The wrapper script itself. We use $LD_LIBRARY_PATH for libGL.
40 cat << EOF > "$out/bin/Tibia"
43 ${glibc.out}/lib/ld-linux.so.2 --library-path \$LD_LIBRARY_PATH ./Tibia "\$@"
46 chmod +x $out/bin/Tibia
51 description = "Top-down MMORPG set in a fantasy world";
52 homepage = "http://tibia.com";
53 license = lib.licenses.unfree;
54 platforms = ["i686-linux"];
55 maintainers = with lib.maintainers; [ ];