From da26db7be45ea9a205f708f97076d83ccd4853ed Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 7 Jun 2025 18:56:27 +0200 Subject: [PATCH 1/6] vintagestory: factor out `makeWrapperArgs` Co-authored-by: ShamrockLee --- pkgs/by-name/vi/vintagestory/package.nix | 96 +++++++++++++----------- 1 file changed, 52 insertions(+), 44 deletions(-) diff --git a/pkgs/by-name/vi/vintagestory/package.nix b/pkgs/by-name/vi/vintagestory/package.nix index ce5ee91fcdbc..42a4bd89f292 100644 --- a/pkgs/by-name/vi/vintagestory/package.nix +++ b/pkgs/by-name/vi/vintagestory/package.nix @@ -39,34 +39,14 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-LkiL/8W9MKpmJxtK+s5JvqhOza0BLap1SsaDvbLYR0c="; }; + __structuredAttrs = true; + nativeBuildInputs = [ makeWrapper copyDesktopItems imagemagick ]; - runtimeLibs = [ - gtk2 - sqlite - openal - cairo - libGLU - SDL2 - freealut - libglvnd - pipewire - libpulseaudio - ] - ++ lib.optionals x11Support [ - libx11 - libxi - libxcursor - ] - ++ lib.optionals waylandSupport [ - wayland - libxkbcommon - ]; - desktopItems = [ (makeDesktopItem { name = "vintagestory"; @@ -99,31 +79,59 @@ stdenv.mkDerivation (finalAttrs: { runHook postInstall ''; - 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 + makeWrapperArgs = [ + "--set-default" + "mesa_glthread" + "true" + ] + ++ lib.optionals waylandSupport [ + "--set-default" + "OPENTK_4_USE_WAYLAND" + "1" + ]; - 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 + runtimeLibraryPath = lib.makeLibraryPath finalAttrs.passthru.runtimeLibs; + preFixup = '' + makeWrapperArgs+=(--prefix LD_LIBRARY_PATH : "$runtimeLibraryPath") - 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 - ''; + makeWrapper ${lib.meta.getExe dotnet-runtime_8} $out/bin/vintagestory \ + "''${makeWrapperArgs[@]}" \ + --add-flags $out/share/vintagestory/Vintagestory.dll - passthru.updateScript = ./update.sh; + makeWrapper ${lib.getExe dotnet-runtime_8} $out/bin/vintagestory-server \ + "''${makeWrapperArgs[@]}" \ + --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 + ''; + + passthru = { + updateScript = ./update.sh; + runtimeLibs = [ + gtk2 + sqlite + openal + cairo + libGLU + SDL2 + freealut + libglvnd + pipewire + libpulseaudio + ] + ++ lib.optionals x11Support [ + libx11 + libxi + libxcursor + ] + ++ lib.optionals waylandSupport [ + wayland + libxkbcommon + ]; + }; meta = { description = "In-development indie sandbox game about innovation and exploration"; From fa576c401a07bf6aa65989e3e4502ec5d3d9f369 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 7 Jun 2025 19:08:08 +0200 Subject: [PATCH 2/6] vintagestory: remove scripts that should not get invoked on NixOS Not entirely sure wether this is a good idea or not. --- pkgs/by-name/vi/vintagestory/package.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/by-name/vi/vintagestory/package.nix b/pkgs/by-name/vi/vintagestory/package.nix index 42a4bd89f292..05ffce39883f 100644 --- a/pkgs/by-name/vi/vintagestory/package.nix +++ b/pkgs/by-name/vi/vintagestory/package.nix @@ -76,6 +76,8 @@ stdenv.mkDerivation (finalAttrs: { magick $out/share/vintagestory/assets/gameicon.xpm $out/share/icons/hicolor/512x512/apps/vintagestory.png cp $out/share/vintagestory/assets/game/fonts/*.ttf $out/share/fonts/truetype + rm -rvf $out/share/vintagestory/{install,run,server}.sh + runHook postInstall ''; From 068fa9e2d58a640986cc31eadb5668bfe784cd3d Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 4 Oct 2025 14:47:39 +0200 Subject: [PATCH 3/6] vintagestory: remove gtk2 (#410814) Doesn't actually need it --- pkgs/by-name/vi/vintagestory/package.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/by-name/vi/vintagestory/package.nix b/pkgs/by-name/vi/vintagestory/package.nix index 05ffce39883f..e61c61e264df 100644 --- a/pkgs/by-name/vi/vintagestory/package.nix +++ b/pkgs/by-name/vi/vintagestory/package.nix @@ -5,7 +5,6 @@ makeWrapper, makeDesktopItem, copyDesktopItems, - gtk2, sqlite, openal, cairo, @@ -113,7 +112,6 @@ stdenv.mkDerivation (finalAttrs: { passthru = { updateScript = ./update.sh; runtimeLibs = [ - gtk2 sqlite openal cairo From 3649c2512d12df7898ca04783fea02d7e52f2ca0 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 4 Oct 2025 14:47:39 +0200 Subject: [PATCH 4/6] vintagestory: remove unused deps Used ltrace and LD_DEBUG=libs to deduce which libraries weren't loaded from the nix store and thus already vendored. This saves ~400 MiB in closure size. --- pkgs/by-name/vi/vintagestory/package.nix | 8 -------- 1 file changed, 8 deletions(-) diff --git a/pkgs/by-name/vi/vintagestory/package.nix b/pkgs/by-name/vi/vintagestory/package.nix index e61c61e264df..b075b9b23dc2 100644 --- a/pkgs/by-name/vi/vintagestory/package.nix +++ b/pkgs/by-name/vi/vintagestory/package.nix @@ -5,12 +5,8 @@ makeWrapper, makeDesktopItem, copyDesktopItems, - sqlite, - openal, cairo, libGLU, - SDL2, - freealut, libglvnd, pipewire, libpulseaudio, @@ -112,12 +108,8 @@ stdenv.mkDerivation (finalAttrs: { passthru = { updateScript = ./update.sh; runtimeLibs = [ - sqlite - openal cairo libGLU - SDL2 - freealut libglvnd pipewire libpulseaudio From f92f8e2ac3548208307d15d9ae9abd4582bb4584 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Wed, 12 Nov 2025 17:19:56 +0100 Subject: [PATCH 5/6] vintagestory: enable versionCheckHook Co-authored-by: ShamrockLee --- pkgs/by-name/vi/vintagestory/package.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/by-name/vi/vintagestory/package.nix b/pkgs/by-name/vi/vintagestory/package.nix index b075b9b23dc2..f8a11503341a 100644 --- a/pkgs/by-name/vi/vintagestory/package.nix +++ b/pkgs/by-name/vi/vintagestory/package.nix @@ -5,6 +5,7 @@ makeWrapper, makeDesktopItem, copyDesktopItems, + versionCheckHook, cairo, libGLU, libglvnd, @@ -105,6 +106,9 @@ stdenv.mkDerivation (finalAttrs: { done ''; + doInstallCheck = true; + installCheckInputs = [ versionCheckHook ]; + passthru = { updateScript = ./update.sh; runtimeLibs = [ From cdfe9595794dffd41c2054466099968b20393f57 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Sat, 13 Dec 2025 16:11:13 +0100 Subject: [PATCH 6/6] vintagestory: set `meta.platforms = ["x86_64-linux"]` --- pkgs/by-name/vi/vintagestory/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/vi/vintagestory/package.nix b/pkgs/by-name/vi/vintagestory/package.nix index f8a11503341a..6d066f7d3d64 100644 --- a/pkgs/by-name/vi/vintagestory/package.nix +++ b/pkgs/by-name/vi/vintagestory/package.nix @@ -134,7 +134,7 @@ stdenv.mkDerivation (finalAttrs: { homepage = "https://www.vintagestory.at/"; license = lib.licenses.unfree; sourceProvenance = [ lib.sourceTypes.binaryBytecode ]; - platforms = lib.platforms.linux; + platforms = [ "x86_64-linux" ]; maintainers = with lib.maintainers; [ artturin gigglesquid