Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / games / nxengine-evo / default.nix
blob4660423a35094494eef3e40598074dfc1890459e
1 { lib, stdenv
2 , fetchpatch
3 , fetchurl
4 , fetchFromGitHub
5 , cmake
6 , libpng
7 , SDL2
8 , SDL2_mixer
9 }:
11 stdenv.mkDerivation rec {
12   pname = "nxengine-evo";
13   version = "2.6.4";
14   src = fetchFromGitHub {
15     owner = "nxengine";
16     repo = "nxengine-evo";
17     rev = "v${version}";
18     sha256 = "sha256-krK2b1E5JUMxRoEWmb3HZMNSIHfUUGXSpyb4/Zdp+5A=";
19   };
20   assets = fetchurl {
21     url = "https://github.com/nxengine/nxengine-evo/releases/download/v${version}/NXEngine-v${version}-Linux.tar.xz";
22     sha256 = "1b5hkmsrrhnjjf825ri6n62kb3fldwl7v5f1cqvqyv47zv15g5gy";
23   };
25   patches = [
26     (fetchpatch {
27       url = "https://github.com/nxengine/nxengine-evo/commit/1890127ec4b4b5f8d6cb0fb30a41868e95659840.patch";
28       sha256 = "18j22vzkikcwqd42vlhzd6rjp26dq0zslxw5yyl07flivms0hny2";
29     })
30     (fetchpatch {
31       url = "https://github.com/nxengine/nxengine-evo/commit/75b8b8e3b067fd354baa903332f2a3254d1cc017.patch";
32       sha256 = "0sjr7z63gp7nfxifxisvp2w664mxxk3xi4a3d86mm0470dj5m5bx";
33     })
34   ];
36   nativeBuildInputs = [ cmake ];
38   buildInputs = [
39     libpng
40     SDL2
41     SDL2_mixer
42   ];
44   # Allow finding game assets.
45   postPatch = ''
46     sed -i -e "s,/usr/share/,$out/share/," src/ResourceManager.cpp
47   '';
49   installPhase = ''
50     cd ..
51     unpackFile ${assets}
52     mkdir -p $out/bin/ $out/share/nxengine/
53     install bin/* $out/bin/
54     cp -r NXEngine-evo-${version}-Linux/data/ $out/share/nxengine/data
55     chmod -R a=r,a+X $out/share/nxengine/data
56   '';
58   meta = {
59     description = "A complete open-source clone/rewrite of the masterpiece jump-and-run platformer Doukutsu Monogatari (also known as Cave Story)";
60     license = with lib.licenses; [
61       gpl3                   # Game engine
62       unfreeRedistributable  # Game assets, freeware
63     ];
64     maintainers = [ lib.maintainers.scubed2 ];
65     homepage = "https://github.com/nxengine/nxengine-evo";
66     platforms = lib.platforms.linux;
67   };