diff options
author | Jon Santmyer <jon@jonsantmyer.com> | 2025-07-23 08:29:48 -0400 |
---|---|---|
committer | Jon Santmyer <jon@jonsantmyer.com> | 2025-07-23 08:29:48 -0400 |
commit | e4781a2c772c1bd6802e65847629f2248ba37336 (patch) | |
tree | d4d068c4dc5ce499b138daaf023e8310d8d8bffc /packages/vintagestory/default.nix | |
parent | 93280382da83e885d919d3b13f4383c2ac6102d3 (diff) | |
download | nix-config-e4781a2c772c1bd6802e65847629f2248ba37336.tar.gz nix-config-e4781a2c772c1bd6802e65847629f2248ba37336.tar.bz2 nix-config-e4781a2c772c1bd6802e65847629f2248ba37336.zip |
2025-07-23
Diffstat (limited to 'packages/vintagestory/default.nix')
-rw-r--r-- | packages/vintagestory/default.nix | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/packages/vintagestory/default.nix b/packages/vintagestory/default.nix new file mode 100644 index 0000000..364cdc2 --- /dev/null +++ b/packages/vintagestory/default.nix @@ -0,0 +1,113 @@ +{ + lib, + stdenv, + fetchurl, + makeWrapper, + makeDesktopItem, + copyDesktopItems, + xorg, + gtk2, + sqlite, + openal, + cairo, + libGLU, + SDL2, + freealut, + libglvnd, + pipewire, + libpulseaudio, + dotnet-runtime_7 +}: + +stdenv.mkDerivation rec { + name = "vintagestory-${version}"; + version = "1.20.11"; + + src = fetchurl { + url = "https://cdn.vintagestory.at/gamefiles/stable/vs_client_linux-x64_${version}.tar.gz"; + hash = "sha256-IOreg6j/jLhOK8jm2AgSnYQrql5R6QxsshvPs8OUcQA="; + }; + + nativeBuildInputs = [ + makeWrapper + copyDesktopItems + ]; + + buildInputs = [ dotnet-runtime_7 ]; + + runtimeLibs = lib.makeLibraryPath ( + [ + gtk2 + sqlite + openal + cairo + libGLU + SDL2 + freealut + libglvnd + pipewire + libpulseaudio + ] + ++ (with xorg; [ + libX11 + libXi + libXcursor + ]) + ); + + desktopItems = [ + (makeDesktopItem { + name = "vintagestory"; + desktopName = "Vintage Story"; + exec = "vintagestory"; + icon = "vintagestory"; + comment = "Innovate and explore in a sandbox world"; + categories = [ "Game" ]; + }) + (makeDesktopItem { + name = "Vintagestory_url_connect"; + desktopName = "Vintage Story URI Connect"; + type = "Application"; + noDisplay = true; + mimeTypes = [ "x-scheme-handler/vintagestoryjoin" ]; + exec = "vintagestory -c %U"; + categories = [ "Game" ]; + }) + (makeDesktopItem { + name = "Vintagestory_url_mod"; + desktopName = "Vintage Story URI mod install"; + type = "Application"; + noDisplay = true; + mimeTypes = [ "x-scheme-handler/vintagestorymodinstall" ]; + exec = "vintagestory -i %U"; + categories = [ "Game" ]; + }) + ]; + + installPhase = '' + runHook preInstall + + mkdir -p $out/share/vintagestory $out/bin $out/share/pixmaps $out/share/fonts/truetype + cp -r * $out/share/vintagestory + cp $out/share/vintagestory/assets/gameicon.xpm $out/share/pixmaps/vintagestory.xpm + cp $out/share/vintagestory/assets/game/fonts/*.ttf $out/share/fonts/truetype + + runHook postInstall + ''; + + preFixup = + '' + 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 + '' + + '' + 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 + ''; +} |