commit 390115d183737a03bc3e211cf090e6ebe8f7aad5 Author: Arne Dußin Date: Mon Mar 31 19:36:58 2025 +0300 add flake for game version 10.2.7 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1cd791b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result/ diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..787db5d --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1742889210, + "narHash": "sha256-hw63HnwnqU3ZQfsMclLhMvOezpM7RSB0dMAtD5/sOiw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "698214a32beb4f4c8e3942372c694f40848b360d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..1ca3f41 --- /dev/null +++ b/flake.nix @@ -0,0 +1,22 @@ +{ + description = "Vintagestory"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + }; + + outputs = { self, nixpkgs, ... } @ inputs: + let + system = "x86_64-linux"; + + pkgs = import nixpkgs { + inherit system; + + config.allowUnfree = true; + config.permittedInsecurePackages = [ "dotnet-runtime-7.0.20" ]; + }; + in + { + packages.x86_64-linux.default = pkgs.callPackage ./vintagestory.nix {}; + }; +} diff --git a/vintagestory.nix b/vintagestory.nix new file mode 100644 index 0000000..66c9567 --- /dev/null +++ b/vintagestory.nix @@ -0,0 +1,106 @@ +{ + lib, + stdenv, + fetchurl, + makeWrapper, + makeDesktopItem, + copyDesktopItems, + xorg, + gtk2, + sqlite, + openal, + cairo, + libGLU, + SDL2, + freealut, + libglvnd, + pipewire, + libpulseaudio, + dotnet-runtime_7, +}: + +stdenv.mkDerivation rec { + pname = "vintagestory"; + version = "1.20.7"; + + src = fetchurl { + url = "https://cdn.vintagestory.at/gamefiles/stable/vs_client_linux-x64_${version}.tar.gz"; + hash = "sha256-1SBJ4E3rQBFPSCgb2Z3knEO5Y+xyJE4kyJW4we75CWA="; + }; + + 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" ]; + }) + ]; + + 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 + ''; + + meta = with lib; { + description = "In-development indie sandbox game about innovation and exploration"; + homepage = "https://www.vintagestory.at/"; + license = licenses.unfree; + maintainers = with maintainers; [ + artturin + gigglesquid + niraethm + ]; + }; +}