summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple/ftb/default.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2018-01-30 21:07:48 +0100
committermakefu <github@syntax-fehler.de>2018-01-30 21:07:48 +0100
commitfac9f4d2a0d855e4b27244df6a3bb831e0305f6b (patch)
tree1412cf1283c90199ec5c3abbe3d87a6035f8e66b /krebs/5pkgs/simple/ftb/default.nix
parentb31a37799eff274215d4cd9d435a9c16d496a88c (diff)
parentffc294575cb59585c3bfb6b85fa45fb69cdf1d41 (diff)
Merge branch 'master' of prism:stockholm
Diffstat (limited to 'krebs/5pkgs/simple/ftb/default.nix')
-rw-r--r--krebs/5pkgs/simple/ftb/default.nix51
1 files changed, 51 insertions, 0 deletions
diff --git a/krebs/5pkgs/simple/ftb/default.nix b/krebs/5pkgs/simple/ftb/default.nix
new file mode 100644
index 000000000..199c12b44
--- /dev/null
+++ b/krebs/5pkgs/simple/ftb/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchurl, makeDesktopItem
+, jre, libX11, libXext, libXcursor, libXrandr, libXxf86vm
+, openjdk
+, mesa, openal
+, useAlsa ? false, alsaOss ? null }:
+with stdenv.lib;
+
+assert useAlsa -> alsaOss != null;
+
+let
+ desktopItem = makeDesktopItem {
+ name = "minecraft";
+ exec = "minecraft";
+ icon = "minecraft";
+ comment = "A sandbox-building game";
+ desktopName = "Minecraft";
+ genericName = "minecraft";
+ categories = "Game;";
+ };
+
+in stdenv.mkDerivation {
+ name = "ftb";
+
+ src = fetchurl {
+ url = "http://ftb.cursecdn.com/FTB2/launcher/FTB_Launcher.jar";
+ sha256 = "10ga4jgyfsj5dy4rj2rla0fpnfpnxv8r3bmxpqpwn7fsry4il79v";
+ };
+
+ phases = "installPhase";
+
+ installPhase = ''
+ set -x
+ mkdir -pv $out/bin
+ cp -v $src $out/ftb.jar
+
+ cat > $out/bin/ftb << EOF
+ #!${stdenv.shell}
+
+ export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${makeLibraryPath [ libX11 libXext libXcursor libXrandr libXxf86vm mesa openal ]}
+ ${if useAlsa then "${alsaOss}/bin/aoss" else "" } \
+ ${jre}/bin/java -jar $out/ftb.jar
+ EOF
+
+ chmod +x $out/bin/ftb
+
+ mkdir -p $out/share/applications
+ ln -s ${desktopItem}/share/applications/* $out/share/applications/
+
+ ${openjdk}/bin/jar xf $out/ftb.jar favicon.png
+ '';
+}