add flake for game version 10.2.7

This commit is contained in:
Arne Dußin 2025-03-31 19:36:58 +03:00
commit 390115d183
4 changed files with 156 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
result/

27
flake.lock generated Normal file
View file

@ -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
}

22
flake.nix Normal file
View file

@ -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 {};
};
}

106
vintagestory.nix Normal file
View file

@ -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
];
};
}