2024-03-25 22:06:47 +01:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
SDL2,
|
|
|
|
SDL2_mixer,
|
2024-05-02 04:54:21 +02:00
|
|
|
callPackage,
|
2024-03-25 22:06:47 +01:00
|
|
|
cmake,
|
|
|
|
pkg-config,
|
|
|
|
ninja,
|
|
|
|
fetchFromGitHub,
|
|
|
|
fetchpatch,
|
|
|
|
fetchurl,
|
|
|
|
libpng,
|
|
|
|
stdenv,
|
2019-07-20 07:52:07 +02:00
|
|
|
}:
|
|
|
|
|
2024-03-25 22:06:47 +01:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2019-07-20 07:52:07 +02:00
|
|
|
pname = "nxengine-evo";
|
|
|
|
version = "2.6.4";
|
2024-03-25 22:06:47 +01:00
|
|
|
|
2022-01-03 00:31:00 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "nxengine";
|
|
|
|
repo = "nxengine-evo";
|
2024-03-25 22:06:47 +01:00
|
|
|
rev = "v${finalAttrs.version}";
|
|
|
|
hash = "sha256-krK2b1E5JUMxRoEWmb3HZMNSIHfUUGXSpyb4/Zdp+5A=";
|
2019-07-20 07:52:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
2024-03-25 22:06:47 +01:00
|
|
|
# Fix building by adding SDL_MIXER to include path
|
2019-07-20 07:52:07 +02:00
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/nxengine/nxengine-evo/commit/1890127ec4b4b5f8d6cb0fb30a41868e95659840.patch";
|
2024-03-25 22:06:47 +01:00
|
|
|
hash = "sha256-wlsIdN2RugOo94V3qj/AzYgrs2kf0i1Iw5zNOP8WQqI=";
|
2019-07-20 07:52:07 +02:00
|
|
|
})
|
2024-03-25 22:06:47 +01:00
|
|
|
# Fix buffer overflow
|
2019-07-20 07:52:07 +02:00
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/nxengine/nxengine-evo/commit/75b8b8e3b067fd354baa903332f2a3254d1cc017.patch";
|
2024-03-25 22:06:47 +01:00
|
|
|
hash = "sha256-fZVaZAOHgFoNakOR2MfsvRJjuLhbx+5id/bcN8w/WWo=";
|
|
|
|
})
|
|
|
|
# Add missing include
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/nxengine/nxengine-evo/commit/0076ebb11bcfec5dc5e2e923a50425f1a33a4133.patch";
|
|
|
|
hash = "sha256-8j3fFFw8DMljV7aAFXE+eA+vkbz1HdFTMAJmk3BRU04=";
|
2019-07-20 07:52:07 +02:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-03-25 22:06:47 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
SDL2
|
|
|
|
cmake
|
|
|
|
ninja
|
|
|
|
pkg-config
|
|
|
|
];
|
2019-07-20 07:52:07 +02:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
SDL2
|
|
|
|
SDL2_mixer
|
2024-03-25 22:06:47 +01:00
|
|
|
libpng
|
2019-07-20 07:52:07 +02:00
|
|
|
];
|
|
|
|
|
2024-03-25 22:06:47 +01:00
|
|
|
strictDeps = true;
|
|
|
|
|
2019-07-20 07:52:07 +02:00
|
|
|
# Allow finding game assets.
|
|
|
|
postPatch = ''
|
|
|
|
sed -i -e "s,/usr/share/,$out/share/," src/ResourceManager.cpp
|
|
|
|
'';
|
|
|
|
|
2024-05-02 04:54:21 +02:00
|
|
|
installPhase = ''
|
2024-03-25 22:06:47 +01:00
|
|
|
runHook preInstall
|
|
|
|
|
2019-07-20 07:52:07 +02:00
|
|
|
cd ..
|
|
|
|
mkdir -p $out/bin/ $out/share/nxengine/
|
|
|
|
install bin/* $out/bin/
|
2024-05-02 04:54:21 +02:00
|
|
|
'' + ''
|
|
|
|
cp -r ${finalAttrs.finalPackage.assets}/share/nxengine/data $out/share/nxengine/data
|
2019-07-20 07:52:07 +02:00
|
|
|
chmod -R a=r,a+X $out/share/nxengine/data
|
2024-05-02 04:54:21 +02:00
|
|
|
'' + ''
|
2024-03-25 22:06:47 +01:00
|
|
|
runHook postInstall
|
2019-07-20 07:52:07 +02:00
|
|
|
'';
|
|
|
|
|
2024-05-02 04:54:21 +02:00
|
|
|
passthru = {
|
|
|
|
assets = callPackage ./assets.nix { };
|
|
|
|
};
|
|
|
|
|
2019-07-20 07:52:07 +02:00
|
|
|
meta = {
|
2024-03-25 22:06:47 +01:00
|
|
|
homepage = "https://github.com/nxengine/nxengine-evo";
|
2019-07-20 07:52:07 +02:00
|
|
|
description = "A complete open-source clone/rewrite of the masterpiece jump-and-run platformer Doukutsu Monogatari (also known as Cave Story)";
|
2021-01-15 05:31:39 +01:00
|
|
|
license = with lib.licenses; [
|
2024-05-02 04:54:21 +02:00
|
|
|
gpl3Plus
|
2019-07-20 07:52:07 +02:00
|
|
|
];
|
2024-03-25 22:06:47 +01:00
|
|
|
mainProgram = "nx";
|
|
|
|
maintainers = with lib.maintainers; [ AndersonTorres ];
|
2021-01-15 05:31:39 +01:00
|
|
|
platforms = lib.platforms.linux;
|
2019-07-20 07:52:07 +02:00
|
|
|
};
|
2024-03-25 22:06:47 +01:00
|
|
|
})
|