about summary refs log tree commit diff
path: root/pkgs/games/humblebundle/hammerwatch.nix
blob: ab5bc29f06bcfb6f7b2996b1fac46aa7845e2773 (plain) (blame)
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
39
40
{ stdenv, fetchHumbleBundle, makeWrapper, unzip, mono, SDL2, libGL, openal
, pulseaudio
}:

# FIXME: Dosn't support the XDG Base Directory Specification,
#        so enforce it using LD_PRELOAD maybe?

stdenv.mkDerivation rec {
  name = "hammerwatch-${version}";
  version = "1.3";

  src = fetchHumbleBundle {
    machineName = "hammerwatch_linux";
    suffix = "zip";
    md5 = "7cd77e4395f394c3062322c96e418732";
  };

  buildInputs = [ unzip makeWrapper ];

  installPhase = let
    rpath = stdenv.lib.makeLibraryPath [ SDL2 libGL openal pulseaudio ];
    monoNoLLVM = mono.override { withLLVM = false; };
  in ''
    mkdir -p "$out/lib"
    cp -rt "$out/lib" SDL2-CS.dll SDL2-CS.dll.config \
      TiltedEngine.dll Lidgren.Network.dll FarseerPhysicsOTK.dll \
      ICSharpCode.SharpZipLib.dll SteamworksManaged.dll NVorbis.dll

    libexec="$out/libexec/hammerwatch"
    install -vD Hammerwatch.exe "$libexec/hammerwatch.exe"
    cp -rt "$libexec" assets.bin editor levels

    makeWrapper "${monoNoLLVM}/bin/mono" "$out/bin/hammerwatch" \
      --add-flags "$libexec/hammerwatch.exe" \
      --set MONO_PATH "$out/lib" \
      --set LD_LIBRARY_PATH "${rpath}"
  '';

  dontStrip = true;
}