nixpkgs/pkgs/games/tibia/default.nix

59 lines
1.8 KiB
Nix
Raw Normal View History

2014-09-22 23:16:37 +01:00
{ stdenv, fetchurl, patchelf, glibc, libX11, mesa }:
2014-04-25 19:35:18 +01:00
with stdenv.lib;
assert stdenv.isi686;
stdenv.mkDerivation {
2015-06-17 14:44:44 +01:00
name = "tibia-10.79";
2014-04-25 19:35:18 +01:00
src = fetchurl {
2015-06-17 14:44:44 +01:00
url = http://static.tibia.com/download/tibia1079.tgz;
sha256 = "04wpg5hdfhcp12kk2va3jdijr2p9jfmfivgqrn3cnbblxi83k2sn";
2014-04-25 19:35:18 +01:00
};
shell = stdenv.shell;
# These binaries come stripped already and trying to strip after the
# files are in $out/res and after patchelf just breaks them.
# Strangely it works if the files are in $out but then nix doesn't
# put them in our PATH. We set all the files to $out/res because
# we'll be using a wrapper to start the program which will go into
# $out/bin.
dontStrip = true;
installPhase = ''
mkdir -pv $out/res
2014-09-22 23:16:37 +01:00
cp -r * $out/res
2014-04-25 19:35:18 +01:00
patchelf --set-interpreter ${glibc}/lib/ld-linux.so.2 \
--set-rpath ${stdenv.cc.cc}/lib:${libX11}/lib:${mesa}/lib \
2014-04-28 20:31:46 +01:00
"$out/res/Tibia"
2014-04-25 19:35:18 +01:00
# We've patchelf'd the files. The main Tibia binary is a bit
# dumb so it looks for ./Tibia.dat. This requires us to be in
# the same directory as the file itself but that's very tedious,
# especially with nix which changes store hashes. Here we generate
# a simple wrapper that we put in $out/bin which will do the
# directory changing for us.
mkdir -pv $out/bin
# The wrapper script itself. We use $LD_LIBRARY_PATH for libGL.
cat << EOF > "$out/bin/Tibia"
#!${stdenv.shell}
cd $out/res
${glibc}/lib/ld-linux.so.2 --library-path \$LD_LIBRARY_PATH ./Tibia "\$@"
EOF
chmod +x $out/bin/Tibia
'';
meta = {
2014-04-28 20:31:46 +01:00
description = "Top-down MMORPG set in a fantasy world";
2014-04-25 19:35:18 +01:00
homepage = "http://tibia.com";
license = stdenv.lib.licenses.unfree;
2014-04-25 19:35:18 +01:00
platforms = ["i686-linux"];
2014-11-12 09:02:50 +00:00
maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
2014-04-25 19:35:18 +01:00
};
}