Cleanup: remove stale modules, improve libxml2 package, add wget dependency

- Remove old system-wide modules: modules/tibia.nix, modules/multimedia.nix
- libxml2-2.9: rename pname to libxml2-2-9 (avoid conflict), add meta
- Tibia module: add wget to home.packages (required for tibia-install)
- tibia-install: use wget directly (no fallback), since wget is now a dependency
This commit is contained in:
Sasza Stanczew 2026-05-30 23:28:46 +02:00
parent 1a2966e054
commit 57112d33a2
4 changed files with 9 additions and 154 deletions

View file

@ -106,14 +106,7 @@ TIBIA_WRAPPER
trap "rm -rf $TMPDIR" EXIT trap "rm -rf $TMPDIR" EXIT
echo "Downloading Tibia launcher from $URL ..." echo "Downloading Tibia launcher from $URL ..."
if command -v wget &>/dev/null; then wget -q --show-progress -O "$TMPDIR/tibia.tar.gz" "$URL"
wget -q --show-progress -O "$TMPDIR/tibia.tar.gz" "$URL"
elif command -v curl &>/dev/null; then
curl -# -L -o "$TMPDIR/tibia.tar.gz" "$URL"
else
echo "Neither wget nor curl found."
exit 1
fi
mkdir -p "$DEST" mkdir -p "$DEST"
tar xzf "$TMPDIR/tibia.tar.gz" -C "$DEST" tar xzf "$TMPDIR/tibia.tar.gz" -C "$DEST"
@ -142,6 +135,7 @@ in {
home.packages = with pkgs; [ home.packages = with pkgs; [
steam-run steam-run
libxml2_2_9 libxml2_2_9
wget
tibiaClientWrapper tibiaClientWrapper
tibiaPatcher tibiaPatcher
tibiaLauncherWrapper tibiaLauncherWrapper

View file

@ -1,7 +0,0 @@
{ pkgs, ... }: {
# paczki
environment.systemPackages = with pkgs; [
vlc
];
}

View file

@ -1,138 +0,0 @@
{ config, pkgs, lib, ... }:
let
# ────────────────────────────────────────────────────────────────
# Legacy libxml2 (2.9.x) — Tibia requires libxml2.so.2
# ────────────────────────────────────────────────────────────────
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;
};
# ────────────────────────────────────────────────────────────────
# Centralized runtime library path for Tibia
# ────────────────────────────────────────────────────────────────
tibiaLibPath = lib.makeLibraryPath [
pkgs.nss
pkgs.nspr
pkgs.libxkbfile
libxml2_2_9
];
exportLibs = ''
export LD_LIBRARY_PATH="${tibiaLibPath}:$LD_LIBRARY_PATH"
'';
# ────────────────────────────────────────────────────────────────
# System-wide wrapper for the Tibia client binary
# ────────────────────────────────────────────────────────────────
tibiaClientWrapper = pkgs.writeShellScriptBin "tibia-client" ''
#!/usr/bin/env bash
${exportLibs}
exec steam-run "$HOME/.local/share/CipSoft GmbH/Tibia/packages/Tibia/bin/client" "$@"
'';
# ────────────────────────────────────────────────────────────────
# Patcher for Tibia's package.json (launcher → wrapper redirect)
# ────────────────────────────────────────────────────────────────
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
cat > "$LOCALWRAPPER" <<EOF
#!/usr/bin/env bash
${exportLibs}
exec /run/current-system/sw/bin/tibia-client "\$@"
EOF
chmod +x "$LOCALWRAPPER"
sed -i 's#"executable": "bin/client"#"executable": "tibia-client-wrapper"#' "$PKGJSON"
echo "Tibia client patched to use tibia-client-wrapper."
'';
# ────────────────────────────────────────────────────────────────
# Wrapper for the Tibia launcher (runs patcher + launcher)
# ────────────────────────────────────────────────────────────────
tibiaLauncherWrapper = pkgs.writeShellScriptBin "tibia" ''
#!/usr/bin/env bash
set -e
LAUNCHER="$HOME/Gry/Tibia/Tibia"
if [ ! -x "$LAUNCHER" ]; then
echo "Tibia launcher not found at:"
echo " $LAUNCHER"
exit 1
fi
tibia-patch
${exportLibs}
exec steam-run "$LAUNCHER"
'';
# ────────────────────────────────────────────────────────────────
# Desktop icon (copied from ~/Gry/Tibia/tibia.ico)
# ────────────────────────────────────────────────────────────────
tibiaIcon = pkgs.runCommand "tibia-icon" {} ''
mkdir -p $out/share/icons/hicolor/256x256/apps
cp "${/home/sasza/Gry/Tibia/tibia.ico}" \
"$out/share/icons/hicolor/256x256/apps/tibia.ico"
'';
# ────────────────────────────────────────────────────────────────
# Desktop entry for Tibia
# ────────────────────────────────────────────────────────────────
tibiaDesktop = pkgs.writeTextFile {
name = "tibia.desktop";
destination = "/share/applications/tibia.desktop";
text = ''
[Desktop Entry]
Type=Application
Name=Tibia
Comment=Launch the Tibia MMORPG
Exec=tibia
Icon=tibia.ico
Terminal=false
Categories=Game;RolePlaying;
'';
};
in
{
environment.systemPackages = [
pkgs.steam-run
libxml2_2_9
tibiaClientWrapper
tibiaPatcher
tibiaLauncherWrapper
tibiaIcon
tibiaDesktop
];
}

View file

@ -1,7 +1,7 @@
{ stdenv, fetchurl, pkg-config, zlib, xz }: { stdenv, fetchurl, pkg-config, zlib, xz }:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "libxml2"; pname = "libxml2-2-9";
version = "2.9.14"; version = "2.9.14";
src = fetchurl { src = fetchurl {
@ -18,4 +18,10 @@ stdenv.mkDerivation {
]; ];
enableParallelBuilding = true; enableParallelBuilding = true;
meta = {
description = "Legacy libxml2 2.9.14, required by Tibia client";
homepage = "http://xmlsoft.org/";
license = stdenv.lib.licenses.mit;
};
} }