Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / games / vintagestory / default.nix
blobd2138759bca8fbfa2e5dea5af5cbb7a70e992668
1 { lib
2 , stdenv
3 , fetchurl
4 , makeWrapper
5 , makeDesktopItem
6 , copyDesktopItems
7 , xorg
8 , gtk2
9 , sqlite
10 , openal
11 , cairo
12 , libGLU
13 , SDL2
14 , freealut
15 , libglvnd
16 , pipewire
17 , libpulseaudio
18 , dotnet-runtime_7
21 stdenv.mkDerivation rec {
22   pname = "vintagestory";
23   version = "1.18.15";
25   src = fetchurl {
26     url = "https://cdn.vintagestory.at/gamefiles/stable/vs_client_linux-x64_${version}.tar.gz";
27     hash = "sha256-luZwRKVptSd69tCaf6Jv0YOfwOeDOcuY7VoL+21tTEo=";
28   };
31   nativeBuildInputs = [ makeWrapper copyDesktopItems ];
33   buildInputs = [ dotnet-runtime_7 ];
35   runtimeLibs = lib.makeLibraryPath ([
36     gtk2
37     sqlite
38     openal
39     cairo
40     libGLU
41     SDL2
42     freealut
43     libglvnd
44     pipewire
45     libpulseaudio
46   ] ++ (with xorg; [
47     libX11
48     libXi
49   ]));
51   desktopItems = makeDesktopItem {
52     name = "vintagestory";
53     desktopName = "Vintage Story";
54     exec = "vintagestory";
55     icon = "vintagestory";
56     comment = "Innovate and explore in a sandbox world";
57     categories = [ "Game" ];
58   };
60   installPhase = ''
61     runHook preInstall
63     mkdir -p $out/share/vintagestory $out/bin $out/share/pixmaps $out/share/fonts/truetype
64     cp -r * $out/share/vintagestory
65     cp $out/share/vintagestory/assets/gameicon.xpm $out/share/pixmaps/vintagestory.xpm
66     cp $out/share/vintagestory/assets/game/fonts/*.ttf $out/share/fonts/truetype
68     runHook postInstall
69   '';
71   preFixup = ''
72     makeWrapper ${dotnet-runtime_7}/bin/dotnet $out/bin/vintagestory \
73       --prefix LD_LIBRARY_PATH : "${runtimeLibs}" \
74       --add-flags $out/share/vintagestory/Vintagestory.dll
75     makeWrapper ${dotnet-runtime_7}/bin/dotnet $out/bin/vintagestory-server \
76       --prefix LD_LIBRARY_PATH : "${runtimeLibs}" \
77       --add-flags $out/share/vintagestory/VintagestoryServer.dll
78   '' + ''
79     find "$out/share/vintagestory/assets/" -not -path "*/fonts/*" -regex ".*/.*[A-Z].*" | while read -r file; do
80       local filename="$(basename -- "$file")"
81       ln -sf "$filename" "''${file%/*}"/"''${filename,,}"
82     done
83   '';
85   meta = with lib; {
86     description = "An in-development indie sandbox game about innovation and exploration";
87     homepage = "https://www.vintagestory.at/";
88     license = licenses.unfree;
89     maintainers = with maintainers; [ artturin gigglesquid ];
90   };