From 2ac7a5de52eda9d70983117dc650bc3ee979a4e5 Mon Sep 17 00:00:00 2001 From: Sasza Stanczew Date: Mon, 16 Feb 2026 12:58:59 +0100 Subject: [PATCH] tibia WORKS! --- modules/tibia.nix | 113 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 102 insertions(+), 11 deletions(-) diff --git a/modules/tibia.nix b/modules/tibia.nix index a69c7c5..86abf06 100644 --- a/modules/tibia.nix +++ b/modules/tibia.nix @@ -1,14 +1,105 @@ -{ pkgs, ... }: { - nixpkgs.overlays = [ - (self: super: { - tibia = super.tibia.overrideAttrs (old: { - src = builtins.path { path = "/home/sasza/Gry/tibia.x64.tar.gz"; name = "tibia.tar.gz"; }; - }); - }) - ]; - # paczki - environment.systemPackages = with pkgs; [ - tibia +{ config, pkgs, lib, ... }: +let + + # Inline legacy libxml2 (2.9.x) because modern Nixpkgs removed it + libxml2_2_9 = pkgs.stdenv.mkDerivation { + pname = "libxml2-2.9"; + version = "2.9.14"; + + src = pkgs.fetchurl { + url = "https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.14.tar.xz"; + sha256 = "sha256-YNdKJX0czsBHXnScui8hVZ5IE577pv8oIkNXx8eY3+4="; + }; + + nativeBuildInputs = [ pkgs.pkg-config ]; + buildInputs = [ pkgs.zlib pkgs.xz ]; + + configureFlags = [ + "--disable-static" + "--without-python" + ]; + + enableParallelBuilding = true; + }; + + # Wrapper for the real client + tibiaClientWrapper = pkgs.writeShellScriptBin "tibia-client" '' + #!/usr/bin/env bash + export LD_LIBRARY_PATH="${pkgs.nss}/lib:${pkgs.libxkbfile}/lib:${pkgs.nspr}/lib:${libxml2_2_9}/lib:$LD_LIBRARY_PATH" + exec steam-run "$HOME/.local/share/CipSoft GmbH/Tibia/packages/Tibia/bin/client" "$@" + ''; + # Script that patches Tibia's package.json + tibiaPatcher = pkgs.writeShellScriptBin "tibia-patch" '' + #!/usr/bin/env bash + set -e + + PKGDIR="$HOME/.local/share/CipSoft GmbH/Tibia/packages/Tibia" + PKGJSON="$PKGDIR/package.json" + LOCALWRAPPER="$PKGDIR/tibia-client-wrapper" + + if [ ! -f "$PKGJSON" ]; then + echo "package.json not found — run the launcher once first." + exit 0 + fi + + # Create wrapper INSIDE the Tibia package directory + cat > "$LOCALWRAPPER" <