vintagestory: overridability, cleanups, Wayland support (#473548)

This commit is contained in:
Aleksana
2025-12-24 08:20:10 +00:00
committed by GitHub
+55 -37
View File
@@ -5,7 +5,6 @@
makeWrapper,
makeDesktopItem,
copyDesktopItems,
xorg,
gtk2,
sqlite,
openal,
@@ -17,14 +16,24 @@
pipewire,
libpulseaudio,
dotnet-runtime_8,
x11Support ? true,
xorg ? null,
waylandSupport ? false,
wayland ? null,
libxkbcommon ? null,
}:
stdenv.mkDerivation rec {
assert x11Support || waylandSupport;
assert x11Support -> xorg != null;
assert waylandSupport -> wayland != null;
assert waylandSupport -> libxkbcommon != null;
stdenv.mkDerivation (finalAttrs: {
pname = "vintagestory";
version = "1.21.6";
src = fetchurl {
url = "https://cdn.vintagestory.at/gamefiles/stable/vs_client_linux-x64_${version}.tar.gz";
url = "https://cdn.vintagestory.at/gamefiles/stable/vs_client_linux-x64_${finalAttrs.version}.tar.gz";
hash = "sha256-LkiL/8W9MKpmJxtK+s5JvqhOza0BLap1SsaDvbLYR0c=";
};
@@ -33,25 +42,27 @@ stdenv.mkDerivation rec {
copyDesktopItems
];
runtimeLibs = lib.makeLibraryPath (
[
gtk2
sqlite
openal
cairo
libGLU
SDL2
freealut
libglvnd
pipewire
libpulseaudio
]
++ (with xorg; [
libX11
libXi
libXcursor
])
);
runtimeLibs = [
gtk2
sqlite
openal
cairo
libGLU
SDL2
freealut
libglvnd
pipewire
libpulseaudio
]
++ lib.optionals x11Support [
xorg.libX11
xorg.libXi
xorg.libXcursor
]
++ lib.optionals waylandSupport [
wayland
libxkbcommon
];
desktopItems = [
(makeDesktopItem {
@@ -85,22 +96,29 @@ stdenv.mkDerivation rec {
runHook postInstall
'';
preFixup = ''
makeWrapper ${dotnet-runtime_8}/bin/dotnet $out/bin/vintagestory \
--prefix LD_LIBRARY_PATH : "${runtimeLibs}" \
--set-default mesa_glthread true \
--add-flags $out/share/vintagestory/Vintagestory.dll
preFixup =
let
runtimeLibs' = lib.strings.makeLibraryPath finalAttrs.runtimeLibs;
in
''
makeWrapper ${lib.meta.getExe dotnet-runtime_8} $out/bin/vintagestory \
--prefix LD_LIBRARY_PATH : "${runtimeLibs'}" \
--set-default mesa_glthread true \
${lib.strings.optionalString waylandSupport ''
--set-default OPENTK_4_USE_WAYLAND 1 \
''} \
--add-flags $out/share/vintagestory/Vintagestory.dll
makeWrapper ${dotnet-runtime_8}/bin/dotnet $out/bin/vintagestory-server \
--prefix LD_LIBRARY_PATH : "${runtimeLibs}" \
--set-default mesa_glthread true \
--add-flags $out/share/vintagestory/VintagestoryServer.dll
makeWrapper ${lib.meta.getExe dotnet-runtime_8} $out/bin/vintagestory-server \
--prefix LD_LIBRARY_PATH : "${runtimeLibs'}" \
--set-default mesa_glthread true \
--add-flags $out/share/vintagestory/VintagestoryServer.dll
find "$out/share/vintagestory/assets/" -not -path "*/fonts/*" -regex ".*/.*[A-Z].*" | while read -r file; do
local filename="$(basename -- "$file")"
ln -sf "$filename" "''${file%/*}"/"''${filename,,}"
done
'';
find "$out/share/vintagestory/assets/" -not -path "*/fonts/*" -regex ".*/.*[A-Z].*" | while read -r file; do
local filename="$(basename -- "$file")"
ln -sf "$filename" "''${file%/*}"/"''${filename,,}"
done
'';
meta = {
description = "In-development indie sandbox game about innovation and exploration";
@@ -116,4 +134,4 @@ stdenv.mkDerivation rec {
];
mainProgram = "vintagestory";
};
}
})