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 in stdenv.mkDerivation (cleanAttrs // {
59 inherit pname version src patches postPatch;
61 mitmCache = gradle.fetchDeps {
66 __darwinAllowLocalNetworking = true;
73 ] ++ attrs.nativeBuildInputs or [];
75 desktopItems = [ desktopItem ];
77 gradleBuildTask = "desktop:release";
82 install -Dm644 desktop/build/libs/desktop-*.jar $out/share/${pname}.jar
84 makeWrapper ${jre}/bin/java $out/bin/${pname} \
85 --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libGL libpulseaudio ]} \
86 --add-flags "-jar $out/share/${pname}.jar"
88 for s in 16 32 48 64 128 256; do
89 # Some forks only have some icons and/or name them slightly differently
90 if [ -f desktop/src/main/assets/icons/icon_$s.png ]; then
91 install -Dm644 desktop/src/main/assets/icons/icon_$s.png \
92 $out/share/icons/hicolor/''${s}x$s/apps/${pname}.png
94 if [ -f desktop/src/main/assets/icons/icon_''${s}x$s.png ]; then
95 install -Dm644 desktop/src/main/assets/icons/icon_''${s}x$s.png \
96 $out/share/icons/hicolor/''${s}x$s/apps/${pname}.png
104 sourceProvenance = with sourceTypes; [
106 binaryBytecode # deps
108 license = licenses.gpl3Plus;
109 maintainers = with maintainers; [ fgaz ];
110 platforms = platforms.all;