toppler: modernize derivation

This commit is contained in:
Marcin Serwin 2025-03-04 23:01:46 +01:00
parent ce22aab43e
commit 45693de57e
No known key found for this signature in database
GPG key ID: DACFAC4EA0B194E0

View file

@ -2,14 +2,17 @@
lib, lib,
stdenv, stdenv,
fetchFromGitLab, fetchFromGitLab,
nix-update-script,
writableTmpDirAsHomeHook,
buildPackages,
pkg-config, pkg-config,
gettext, gettext,
povray, povray,
imagemagick, imagemagick,
gimp, gimp,
SDL2, sdl2-compat,
SDL2_mixer, SDL2_mixer,
SDL2_image, SDL2_image,
libpng, libpng,
@ -27,19 +30,31 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-ecEaELu52Nmov/BD9VzcUw6wyWeHJcsKQkEzTnaW330="; hash = "sha256-ecEaELu52Nmov/BD9VzcUw6wyWeHJcsKQkEzTnaW330=";
}; };
strictDeps = true;
enableParallelBuilding = true;
depsBuildBuild = [
buildPackages.stdenv.cc
pkg-config
sdl2-compat
SDL2_image
libpng
zlib
];
nativeBuildInputs = [ nativeBuildInputs = [
pkg-config pkg-config
gettext gettext
povray povray
imagemagick imagemagick
gimp gimp
# GIMP needs a writable home
writableTmpDirAsHomeHook
]; ];
buildInputs = [ buildInputs = [
SDL2 sdl2-compat
SDL2_mixer SDL2_mixer
SDL2_image
libpng
zlib zlib
]; ];
@ -48,20 +63,29 @@ stdenv.mkDerivation (finalAttrs: {
./gcc14.patch ./gcc14.patch
]; ];
# GIMP needs a writable home makeFlags = [
"CXX_NATIVE=$(CXX_FOR_BUILD)"
"PKG_CONFIG_NATIVE=$(PKG_CONFIG_FOR_BUILD)"
"PREFIX=${placeholder "out"}"
];
preBuild = '' preBuild = ''
export HOME=$(mktemp -d) # The `$` is escaped in `makeFlags` so using it for these parameters results in infinite recursion
makeFlagsArray+=(CXX=$CXX PKG_CONFIG=$PKG_CONFIG);
''; '';
makeFlags = [ "PREFIX=$(out)" ]; passthru.updateScript = nix-update-script { };
hardeningDisable = [ "format" ]; meta = {
meta = with lib; {
description = "Jump and run game, reimplementation of Tower Toppler/Nebulus"; description = "Jump and run game, reimplementation of Tower Toppler/Nebulus";
homepage = "https://gitlab.com/roever/toppler"; homepage = "https://gitlab.com/roever/toppler";
license = licenses.gpl2Plus; license = with lib.licenses; [
maintainers = with maintainers; [ fgaz ]; gpl2Plus
platforms = platforms.all; # Makefile
gpl3Plus
];
maintainers = with lib.maintainers; [ fgaz ];
platforms = lib.platforms.all;
mainProgram = "toppler";
}; };
}) })