190 lines
6.0 KiB
Nix
190 lines
6.0 KiB
Nix
# EQLogParser on Linux via Wine.
|
|
#
|
|
# Mirrors bottles/Games/eqlogparser.yml and Bottles dependencies:
|
|
# - win64, Wine runner (no DXVK/VKD3D)
|
|
# - dotnetcoredesktop8 -> windowsdesktop-runtime-8.0.12-win-x64.exe
|
|
# - renderer=gdi (WPF stability under Wine)
|
|
# - EQLogParser-install-pipertts (Piper TTS; Wine x64 has no Windows TTS)
|
|
#
|
|
# wine-mono: wineWow64Packages.stableFull bundles the MSI (embedInstallers).
|
|
# Install it into the prefix before .NET Desktop Runtime — otherwise Wine shows
|
|
# the interactive "wine-mono package" dialog.
|
|
{ lib
|
|
, fetchurl
|
|
, runCommand
|
|
, writeShellScript
|
|
, writeShellScriptBin
|
|
, makeDesktopItem
|
|
, wineWow64Packages
|
|
, corefonts
|
|
, vista-fonts
|
|
, liberation_ttf
|
|
, dejavu_fonts
|
|
, noto-fonts
|
|
, symlinkJoin
|
|
,
|
|
}:
|
|
|
|
let
|
|
version = "2.3.54";
|
|
setupVersion = "${version}-nix-fonts2";
|
|
|
|
wine = wineWow64Packages.stableFull;
|
|
|
|
installer = fetchurl {
|
|
url = "https://github.com/kauffman12/EQLogParser/releases/download/${version}/EQLogParser-install-pipertts-${version}.exe";
|
|
hash = "sha256-d4kXv6tjR4Um/ELsJ5C0uX3q0ZE5A/4EDACmsk6/Uuk=";
|
|
};
|
|
|
|
# bottlesdevs/dependencies Essentials/dotnetcoredesktop8.yml (x64)
|
|
dotnetDesktopRuntime = fetchurl {
|
|
url = "https://download.visualstudio.microsoft.com/download/pr/f1e7ffc8-c278-4339-b460-517420724524/f36bb75b2e86a52338c4d3a90f8dac9b/windowsdesktop-runtime-8.0.12-win-x64.exe";
|
|
hash = "sha256-y1G1WfNDy1biPK0uWvjE0XAeIhoKKkEWGToqk3VWiBQ=";
|
|
};
|
|
|
|
installFonts = writeShellScript "eqlogparser-install-fonts" ''
|
|
set -euo pipefail
|
|
|
|
font_dir="$WINEPREFIX/drive_c/windows/Fonts"
|
|
mkdir -p "$font_dir"
|
|
|
|
for font_source in \
|
|
"${wine}/share/wine/fonts" \
|
|
"${corefonts}/share/fonts/truetype" \
|
|
"${vista-fonts}/share/fonts/truetype" \
|
|
"${liberation_ttf}/share/fonts/truetype" \
|
|
"${dejavu_fonts}/share/fonts/truetype" \
|
|
"${noto-fonts}/share/fonts/noto"
|
|
do
|
|
[ -d "$font_source" ] || continue
|
|
|
|
while IFS= read -r -d "" font; do
|
|
cp -f "$font" "$font_dir/"
|
|
done < <(find "$font_source" -type f \( -iname "*.ttf" -o -iname "*.ttc" -o -iname "*.otf" \) -print0)
|
|
done
|
|
|
|
font_reg="$WINEPREFIX/eqlogparser-fonts.reg"
|
|
{
|
|
printf 'Windows Registry Editor Version 5.00\r\n\r\n'
|
|
printf '[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts]\r\n'
|
|
|
|
for font in "$font_dir"/*.[tT][tT][fFcC] "$font_dir"/*.[oO][tT][fF]; do
|
|
[ -f "$font" ] || continue
|
|
|
|
file_name="$(basename "$font")"
|
|
font_name="''${file_name%.*}"
|
|
font_name="''${font_name//_/ }"
|
|
font_type="TrueType"
|
|
case "$file_name" in
|
|
*.[oO][tT][fF])
|
|
font_type="OpenType"
|
|
;;
|
|
esac
|
|
|
|
printf '"%s (%s)"="%s"\r\n' "$font_name" "$font_type" "$file_name"
|
|
done
|
|
} > "$font_reg"
|
|
|
|
wine regedit /S "$font_reg"
|
|
'';
|
|
|
|
setupPrefix = writeShellScript "eqlogparser-setup-prefix" ''
|
|
set -euo pipefail
|
|
|
|
export WINEARCH=win64
|
|
export WINEDEBUG=-all
|
|
export PATH="${wine}/bin:$PATH"
|
|
|
|
data_home="''${XDG_DATA_HOME:-$HOME/.local/share}"
|
|
export WINEPREFIX="''${data_home}/eqlogparser/wine"
|
|
version_file="''${WINEPREFIX}/.eqlogparser-nix-version"
|
|
|
|
if [ -f "$version_file" ] && [ "$(cat "$version_file")" = "${setupVersion}" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
echo "eqlogparser: creating Wine prefix (${version}) — one-time setup, may take several minutes..."
|
|
rm -rf "$WINEPREFIX"
|
|
mkdir -p "$WINEPREFIX"
|
|
|
|
WINEDLLOVERRIDES="mscoree,mshtml=" wineboot -u
|
|
wineserver -w
|
|
|
|
mono_msi=$(echo ${wine}/share/wine/mono/wine-mono-*.msi)
|
|
echo "eqlogparser: installing wine-mono..."
|
|
wine msiexec /i "$mono_msi" /qn
|
|
wineserver -w
|
|
|
|
echo "eqlogparser: installing Windows-compatible fonts..."
|
|
${installFonts}
|
|
wine reg add "HKCU\\Software\\Wine\\Fonts\\Replacements" /v "Segoe UI" /t REG_SZ /d "Arial" /f
|
|
wine reg add "HKCU\\Software\\Wine\\Fonts\\Replacements" /v "Calibri" /t REG_SZ /d "Arial" /f
|
|
wine reg add "HKCU\\Software\\Wine\\Fonts\\Replacements" /v "MS Shell Dlg" /t REG_SZ /d "Tahoma" /f
|
|
wine reg add "HKCU\\Software\\Wine\\Fonts\\Replacements" /v "MS Shell Dlg 2" /t REG_SZ /d "Tahoma" /f
|
|
wineboot -u
|
|
wineserver -w
|
|
|
|
echo "eqlogparser: installing .NET 8 Desktop Runtime..."
|
|
wine ${dotnetDesktopRuntime} /quiet
|
|
wineserver -w
|
|
|
|
echo "eqlogparser: configuring GDI renderer (Bottles renderer=gdi)..."
|
|
wine reg add "HKCU\\Software\\Wine\\Direct3D" /v renderer /t REG_SZ /d gdi /f
|
|
|
|
echo "eqlogparser: installing EQLogParser (Piper TTS)..."
|
|
wine ${installer} /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-
|
|
wineserver -w
|
|
|
|
test -f "$WINEPREFIX/drive_c/Program Files/EQLogParser/EQLogParser.exe"
|
|
echo "${setupVersion}" > "$version_file"
|
|
echo "eqlogparser: setup complete."
|
|
'';
|
|
|
|
launcher = writeShellScriptBin "eqlogparser" ''
|
|
set -euo pipefail
|
|
|
|
export WINEARCH=win64
|
|
export WINEDEBUG="''${WINEDEBUG:--all}"
|
|
export PATH="${wine}/bin:$PATH"
|
|
|
|
data_home="''${XDG_DATA_HOME:-$HOME/.local/share}"
|
|
export WINEPREFIX="''${data_home}/eqlogparser/wine"
|
|
|
|
# App disables hardware acceleration when WINELOADER is set (App.xaml.cs).
|
|
export WINELOADER=${wine}/bin/wine
|
|
|
|
${setupPrefix}
|
|
|
|
exec wine "$WINEPREFIX/drive_c/Program Files/EQLogParser/EQLogParser.exe" "$@"
|
|
'';
|
|
|
|
desktopItem = makeDesktopItem {
|
|
name = "eqlogparser";
|
|
desktopName = "EQLogParser";
|
|
comment = "EverQuest log parser (Wine)";
|
|
exec = "eqlogparser";
|
|
categories = [ "Game" ];
|
|
};
|
|
|
|
desktopFiles = runCommand "eqlogparser-desktop" { } ''
|
|
mkdir -p $out/share/applications
|
|
ln -s ${desktopItem}/share/applications/eqlogparser.desktop $out/share/applications/
|
|
'';
|
|
|
|
in
|
|
symlinkJoin {
|
|
name = "eqlogparser-${version}";
|
|
paths = [
|
|
launcher
|
|
desktopFiles
|
|
];
|
|
|
|
meta = {
|
|
description = "EverQuest Log Parser ${version} (Wine; matches Bottles/Flatpak setup)";
|
|
homepage = "https://github.com/kauffman12/EQLogParser";
|
|
license = lib.licenses.unfree;
|
|
platforms = lib.platforms.linux;
|
|
mainProgram = "eqlogparser";
|
|
};
|
|
}
|