From 6726897b9ed4a48e0a085e44061e7d067ea369a0 Mon Sep 17 00:00:00 2001 From: novenary Date: Tue, 23 Dec 2025 12:18:47 +0200 Subject: [PATCH 1/5] vintagestory: use finalAttrs instead of rec This ensures that whatever overrideAttrs changes is properly fed back into the package definition. --- pkgs/by-name/vi/vintagestory/package.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/vi/vintagestory/package.nix b/pkgs/by-name/vi/vintagestory/package.nix index d9c3654d7058..63aa284b48f7 100644 --- a/pkgs/by-name/vi/vintagestory/package.nix +++ b/pkgs/by-name/vi/vintagestory/package.nix @@ -19,12 +19,12 @@ dotnet-runtime_8, }: -stdenv.mkDerivation rec { +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="; }; @@ -87,12 +87,12 @@ stdenv.mkDerivation rec { preFixup = '' makeWrapper ${dotnet-runtime_8}/bin/dotnet $out/bin/vintagestory \ - --prefix LD_LIBRARY_PATH : "${runtimeLibs}" \ + --prefix LD_LIBRARY_PATH : "${finalAttrs.runtimeLibs}" \ --set-default mesa_glthread true \ --add-flags $out/share/vintagestory/Vintagestory.dll makeWrapper ${dotnet-runtime_8}/bin/dotnet $out/bin/vintagestory-server \ - --prefix LD_LIBRARY_PATH : "${runtimeLibs}" \ + --prefix LD_LIBRARY_PATH : "${finalAttrs.runtimeLibs}" \ --set-default mesa_glthread true \ --add-flags $out/share/vintagestory/VintagestoryServer.dll @@ -116,4 +116,4 @@ stdenv.mkDerivation rec { ]; mainProgram = "vintagestory"; }; -} +}) From 0841b49cf12e5a006c9a303d3163da8467eaa644 Mon Sep 17 00:00:00 2001 From: novenary Date: Tue, 23 Dec 2025 12:28:26 +0200 Subject: [PATCH 2/5] vintagestory: make runtimeLibs more override-friendly --- pkgs/by-name/vi/vintagestory/package.nix | 68 ++++++++++++------------ 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/pkgs/by-name/vi/vintagestory/package.nix b/pkgs/by-name/vi/vintagestory/package.nix index 63aa284b48f7..5ab1b9ce9ebe 100644 --- a/pkgs/by-name/vi/vintagestory/package.nix +++ b/pkgs/by-name/vi/vintagestory/package.nix @@ -33,25 +33,23 @@ stdenv.mkDerivation (finalAttrs: { 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 + ] + ++ (with xorg; [ + libX11 + libXi + libXcursor + ]); desktopItems = [ (makeDesktopItem { @@ -85,22 +83,26 @@ stdenv.mkDerivation (finalAttrs: { runHook postInstall ''; - preFixup = '' - makeWrapper ${dotnet-runtime_8}/bin/dotnet $out/bin/vintagestory \ - --prefix LD_LIBRARY_PATH : "${finalAttrs.runtimeLibs}" \ - --set-default mesa_glthread true \ - --add-flags $out/share/vintagestory/Vintagestory.dll + preFixup = + let + runtimeLibs' = lib.strings.makeLibraryPath finalAttrs.runtimeLibs; + in + '' + 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 - makeWrapper ${dotnet-runtime_8}/bin/dotnet $out/bin/vintagestory-server \ - --prefix LD_LIBRARY_PATH : "${finalAttrs.runtimeLibs}" \ - --set-default mesa_glthread true \ - --add-flags $out/share/vintagestory/VintagestoryServer.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 - 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"; From 20abb59615caff6d8364c249f482b2c5dbfd7661 Mon Sep 17 00:00:00 2001 From: novenary Date: Tue, 23 Dec 2025 12:47:05 +0200 Subject: [PATCH 3/5] vintagestory: remove with --- pkgs/by-name/vi/vintagestory/package.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/vi/vintagestory/package.nix b/pkgs/by-name/vi/vintagestory/package.nix index 5ab1b9ce9ebe..3f9c83418be9 100644 --- a/pkgs/by-name/vi/vintagestory/package.nix +++ b/pkgs/by-name/vi/vintagestory/package.nix @@ -45,11 +45,11 @@ stdenv.mkDerivation (finalAttrs: { pipewire libpulseaudio ] - ++ (with xorg; [ - libX11 - libXi - libXcursor - ]); + ++ [ + xorg.libX11 + xorg.libXi + xorg.libXcursor + ]; desktopItems = [ (makeDesktopItem { From 20f8f7251417fffbe4bb57296150c026dafc3d5a Mon Sep 17 00:00:00 2001 From: novenary Date: Tue, 23 Dec 2025 13:57:15 +0200 Subject: [PATCH 4/5] vintagestory: use lib.meta.getExe --- pkgs/by-name/vi/vintagestory/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/vi/vintagestory/package.nix b/pkgs/by-name/vi/vintagestory/package.nix index 3f9c83418be9..1a9d4374c728 100644 --- a/pkgs/by-name/vi/vintagestory/package.nix +++ b/pkgs/by-name/vi/vintagestory/package.nix @@ -88,12 +88,12 @@ stdenv.mkDerivation (finalAttrs: { runtimeLibs' = lib.strings.makeLibraryPath finalAttrs.runtimeLibs; in '' - makeWrapper ${dotnet-runtime_8}/bin/dotnet $out/bin/vintagestory \ + makeWrapper ${lib.meta.getExe dotnet-runtime_8} $out/bin/vintagestory \ --prefix LD_LIBRARY_PATH : "${runtimeLibs'}" \ --set-default mesa_glthread true \ --add-flags $out/share/vintagestory/Vintagestory.dll - makeWrapper ${dotnet-runtime_8}/bin/dotnet $out/bin/vintagestory-server \ + 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 From e7f3a8df3cfe48753a9760df44b80f07e1c06287 Mon Sep 17 00:00:00 2001 From: novenary Date: Tue, 23 Dec 2025 13:05:19 +0200 Subject: [PATCH 5/5] vintagestory: add optional Wayland support --- pkgs/by-name/vi/vintagestory/package.nix | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/vi/vintagestory/package.nix b/pkgs/by-name/vi/vintagestory/package.nix index 1a9d4374c728..fc7026083f22 100644 --- a/pkgs/by-name/vi/vintagestory/package.nix +++ b/pkgs/by-name/vi/vintagestory/package.nix @@ -5,7 +5,6 @@ makeWrapper, makeDesktopItem, copyDesktopItems, - xorg, gtk2, sqlite, openal, @@ -17,8 +16,18 @@ pipewire, libpulseaudio, dotnet-runtime_8, + x11Support ? true, + xorg ? null, + waylandSupport ? false, + wayland ? null, + libxkbcommon ? null, }: +assert x11Support || waylandSupport; +assert x11Support -> xorg != null; +assert waylandSupport -> wayland != null; +assert waylandSupport -> libxkbcommon != null; + stdenv.mkDerivation (finalAttrs: { pname = "vintagestory"; version = "1.21.6"; @@ -45,10 +54,14 @@ stdenv.mkDerivation (finalAttrs: { pipewire libpulseaudio ] - ++ [ + ++ lib.optionals x11Support [ xorg.libX11 xorg.libXi xorg.libXcursor + ] + ++ lib.optionals waylandSupport [ + wayland + libxkbcommon ]; desktopItems = [ @@ -91,6 +104,9 @@ stdenv.mkDerivation (finalAttrs: { 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 ${lib.meta.getExe dotnet-runtime_8} $out/bin/vintagestory-server \