summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--lib/maintainers.nix1
-rw-r--r--pkgs/games/tibia/default.nix58
-rw-r--r--pkgs/top-level/all-packages.nix2
3 files changed, 61 insertions, 0 deletions
diff --git a/lib/maintainers.nix b/lib/maintainers.nix
index 4218d774217a..0acb04b14862 100644
--- a/lib/maintainers.nix
+++ b/lib/maintainers.nix
@@ -32,6 +32,7 @@
   emery = "Emery Hemingawy <emery@vfemail.net>";
   ertes = "Ertugrul Söylemez <ertesx@gmx.de>";
   falsifian = "James Cook <james.cook@utoronto.ca>";
+  fuuzetsu = "Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk>";
   garbas = "Rok Garbas <rok@garbas.si>";
   goibhniu = "Cillian de Róiste <cillian.deroiste@gmail.com>";
   guibert = "David Guibert <david.guibert@gmail.com>";
diff --git a/pkgs/games/tibia/default.nix b/pkgs/games/tibia/default.nix
new file mode 100644
index 000000000000..5cf451e9201a
--- /dev/null
+++ b/pkgs/games/tibia/default.nix
@@ -0,0 +1,58 @@
+{stdenv, fetchurl, patchelf, glibc, libX11, mesa}:
+
+with stdenv.lib;
+assert stdenv.isi686;
+stdenv.mkDerivation {
+  name = "tibia-10.38";
+
+  src = fetchurl {
+    url = http://static.tibia.com/download/tibia1038.tgz;
+    sha256 = "13mxsdh0p0bhdiv5p0hbfdx4a5ha2fv9p2yvn6250z9plfi9xq2h";
+  };
+
+  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
+    cp -r ./* $out/res
+
+    patchelf --set-interpreter ${glibc}/lib/ld-linux.so.2 \
+             --set-rpath ${stdenv.gcc.gcc}/lib:${libX11}/lib:${mesa}/lib \
+             "$out/res/Tibia" || true
+
+    # 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 = {
+    description = "Top-down MMORPG set in a fantasy setting";
+    homepage = "http://tibia.com";
+    license = "unfree";
+    maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
+    platforms = ["i686-linux"];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 36d52bbb2131..45ba490702e7 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -9897,6 +9897,8 @@ let
 
   tennix = callPackage ../games/tennix { };
 
+  tibia = callPackage ../games/tibia { };
+
   tintin = callPackage ../games/tintin { };
 
   tpm = callPackage ../games/thePenguinMachine { };