about summary refs log tree commit diff
path: root/pkgs/games/humblebundle/fez.nix
blob: 5f23b97c2e0cbfc9cdcbfab5bd8b96d0edc9be3c (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
{ stdenv, fetchHumbleBundle, unzip, mono, openal, SDL2 }:

let
  version = "1.0.2";
  usVersion = stdenv.lib.replaceChars ["."] ["_"] version;
in stdenv.mkDerivation rec {
  name = "fez-${version}";
  version = "09152013";

  src = fetchHumbleBundle {
    name = "${name}-bin";
    md5 = "4ac954101835311f3528f5369e1fecb7";
  };

  unpackPhase = ''
    ${unzip}/bin/unzip -qq "$src" 'data/*' || true
    sourceRoot=data
  '';

  dontStrip = true;

  buildPhase = ''
    patchelf \
      --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
      --set-rpath "${stdenv.lib.makeLibraryPath [ mono openal SDL2 ]}" \
      FEZ.bin.x86_64
  '';

  installPhase = ''
    ensureDir "$out/bin" "$out/libexec/fez/mono/2.0"
    install -vD FEZ.bin.x86_64 "$out/libexec/fez/fez"
    install -vt "$out/libexec/fez/mono/2.0" *.dll
    ln -s "$out/libexec/fez/fez" "$out/bin/fez"
  '';
}