about summary refs log tree commit diff
path: root/pkgs/games/vintagestory
diff options
context:
space:
mode:
authorJack Connors <jack.connors@protonmail.com>2023-07-17 18:39:42 +0300
committerArtturin <Artturin@artturin.com>2023-07-18 01:34:28 +0300
commit38176f81b00c02317d9d1cfdf52ff2e27f174202 (patch)
tree8d5f3f3bd56263c84d8ab49b6cea9defa57e594a /pkgs/games/vintagestory
parentbfa726f7dc82b40d374a94217b8686989444b68d (diff)
vintagestory: add support for experimental .net 7 build
Future versions (1.19+) will be built exclusively on .net 7, see: https://www.vintagestory.at/blog.html/news/v1186-stable-security-patch-r360/ and https://www.vintagestory.at/blog.html/news/v1186-rc2-hunting-the-performance-leak-r359/
This change crates the foundations for suporting .net 7 going forward and adds an override option to enable the experimental .net 7 build

Co-authored-by: Artturin <Artturin@artturin.com>
Diffstat (limited to 'pkgs/games/vintagestory')
-rw-r--r--pkgs/games/vintagestory/default.nix47
1 files changed, 38 insertions, 9 deletions
diff --git a/pkgs/games/vintagestory/default.nix b/pkgs/games/vintagestory/default.nix
index 2b82426b57cfc..b8b478b8ae73d 100644
--- a/pkgs/games/vintagestory/default.nix
+++ b/pkgs/games/vintagestory/default.nix
@@ -13,20 +13,39 @@
 , libGLU
 , SDL2
 , freealut
+, libglvnd
+, pipewire
+, libpulseaudio
+, experimental ? false
+, dotnet-runtime_7
 }:
 
 stdenv.mkDerivation rec {
   pname = "vintagestory";
-  version = "1.18.6";
+  version = if experimental then "1.18.6" else "1.18.6";
+
+  src =
+    if experimental
+    then
+      (fetchurl {
+        url = "https://cdn.vintagestory.at/gamefiles/net7/vs_client_linux-x64_${version}.tar.gz";
+        sha256 = "sha256-h4TyMDFid3eB6oPJix92/tmS0v+Ox6CFSRyn/JRNbxg=";
+      })
+    else
+      (fetchurl {
+        url = "https://cdn.vintagestory.at/gamefiles/stable/vs_archive_${version}.tar.gz";
+        sha256 = "sha256-Sa5R/Msg36pKRpZJXXJgM4lcCADJX9x81fMnTD3tjAI=";
+      });
 
-  src = fetchurl {
-    url = "https://cdn.vintagestory.at/gamefiles/stable/vs_archive_${version}.tar.gz";
-    sha256 = "sha256-Sa5R/Msg36pKRpZJXXJgM4lcCADJX9x81fMnTD3tjAI=";
-  };
 
   nativeBuildInputs = [ makeWrapper copyDesktopItems ];
 
-  buildInputs = [ mono ];
+  buildInputs =
+    if experimental then [
+      dotnet-runtime_7
+    ] else [
+      mono
+    ];
 
   runtimeLibs = lib.makeLibraryPath ([
     gtk2
@@ -36,6 +55,9 @@ stdenv.mkDerivation rec {
     libGLU
     SDL2
     freealut
+    libglvnd
+    pipewire
+    libpulseaudio
   ] ++ (with xorg; [
     libX11
     libXi
@@ -43,7 +65,7 @@ stdenv.mkDerivation rec {
 
   desktopItems = makeDesktopItem {
     name = "vintagestory";
-    desktopName = "Vintage Story";
+    desktopName = if experimental then "Vintage Story Experimental .net 7" else "Vintage Story";
     exec = "vintagestory";
     icon = "vintagestory";
     comment = "Innovate and explore in a sandbox world";
@@ -61,14 +83,21 @@ stdenv.mkDerivation rec {
     runHook postInstall
   '';
 
-  preFixup = ''
+  preFixup = (if experimental then ''
+    makeWrapper ${dotnet-runtime_7}/bin/dotnet $out/bin/vintagestory \
+      --prefix LD_LIBRARY_PATH : "${runtimeLibs}" \
+      --add-flags $out/share/vintagestory/Vintagestory.dll
+    makeWrapper ${dotnet-runtime_7}/bin/dotnet $out/bin/vintagestory-server \
+      --prefix LD_LIBRARY_PATH : "${runtimeLibs}" \
+      --add-flags $out/share/vintagestory/VintagestoryServer.dll
+  '' else ''
     makeWrapper ${mono}/bin/mono $out/bin/vintagestory \
       --prefix LD_LIBRARY_PATH : "${runtimeLibs}" \
       --add-flags $out/share/vintagestory/Vintagestory.exe
     makeWrapper ${mono}/bin/mono $out/bin/vintagestory-server \
       --prefix LD_LIBRARY_PATH : "${runtimeLibs}" \
       --add-flags $out/share/vintagestory/VintagestoryServer.exe
-
+  '') + ''
     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,,}"