1 # Generic builder for shattered pixel forks/mods
7 , patches ? [ ./disable-beryx.patch ]
24 cleanAttrs = builtins.removeAttrs attrs [
37 # disable gradle plugins with native code and their targets
38 perl -i.bak1 -pe "s#(^\s*id '.+' version '.+'$)#// \1#" build.gradle
39 perl -i.bak2 -pe "s#(.*)#// \1# if /^(buildscript|task portable|task nsis|task proguard|task tgz|task\(afterEclipseImport\)|launch4j|macAppBundle|buildRpm|buildDeb|shadowJar|robovm|git-version)/ ... /^}/" build.gradle
40 # Remove unbuildable Android/iOS stuff
41 rm -f android/build.gradle ios/build.gradle
42 ${attrs.postPatch or ""}
45 desktopItem = makeDesktopItem {
48 comment = meta.description;
52 categories = [ "Game" "AdventureGame" ];
53 keywords = [ "roguelike" "dungeon" "crawler" ];
56 depsPath' = if depsPath != null then depsPath else ./. + "/${pname}/deps.json";
58 # "Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0."
61 in stdenv.mkDerivation (cleanAttrs // {
62 inherit pname version src patches postPatch;
64 mitmCache = gradle.fetchDeps {
69 __darwinAllowLocalNetworking = true;
76 ] ++ attrs.nativeBuildInputs or [];
78 desktopItems = [ desktopItem ];
80 gradleBuildTask = "desktop:release";
85 install -Dm644 desktop/build/libs/desktop-*.jar $out/share/${pname}.jar
87 makeWrapper ${jre}/bin/java $out/bin/${pname} \
88 --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libGL libpulseaudio ]} \
89 --add-flags "-jar $out/share/${pname}.jar"
91 for s in 16 32 48 64 128 256; do
92 # Some forks only have some icons and/or name them slightly differently
93 if [ -f desktop/src/main/assets/icons/icon_$s.png ]; then
94 install -Dm644 desktop/src/main/assets/icons/icon_$s.png \
95 $out/share/icons/hicolor/''${s}x$s/apps/${pname}.png
97 if [ -f desktop/src/main/assets/icons/icon_''${s}x$s.png ]; then
98 install -Dm644 desktop/src/main/assets/icons/icon_''${s}x$s.png \
99 $out/share/icons/hicolor/''${s}x$s/apps/${pname}.png
107 sourceProvenance = with sourceTypes; [
109 binaryBytecode # deps
111 license = licenses.gpl3Plus;
112 maintainers = with maintainers; [ fgaz ];
113 platforms = platforms.all;