summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple/ftb/default.nix
blob: ab7d6e6518699f89eb62aa4132c6ba4abc600a0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{ stdenv, fetchurl
, jre, libX11, libXext, libXcursor, libXrandr, libXxf86vm
, openjdk
, mesa_glu, openal
, useAlsa ? false, alsaOss ? null }:
with stdenv.lib;

assert useAlsa -> alsaOss != null;

stdenv.mkDerivation {
  name = "ftb";

  src = fetchurl {
    url = "http://ftb.cursecdn.com/FTB2/launcher/FTB_Launcher.jar";
    sha256 = "0pyh83hhni97ryvz6yy8lyiagjrlx67cwr780s2bja92rxc1sqpj";
  };

  phases = "installPhase";

  installPhase = ''
    set -x
    mkdir -pv $out/bin
    cp -v $src $out/ftb.jar

    cat > $out/bin/ftb << EOF
    #!${stdenv.shell}

    export _JAVA_AWT_WM_NONREPARENTING=1
    export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${makeLibraryPath [ libX11 libXext libXcursor libXrandr libXxf86vm mesa_glu openal ]}
    ${if useAlsa then "${alsaOss}/bin/aoss" else "" } \
      ${jre}/bin/java -jar $out/ftb.jar
    EOF

    chmod +x $out/bin/ftb

    ${openjdk}/bin/jar xf $out/ftb.jar favicon.png
  '';
}