about summary refs log tree commit diff
path: root/pkgs/games/humblebundle/liads.nix
blob: 281b137db9483f52b72f117892bef290da769c5e (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
41
42
43
{ stdenv, fetchHumbleBundle, unzip, mesa, xorg, libpulseaudio }:

stdenv.mkDerivation rec {
  name = "liads-${version}";
  version = "20160121";

  src = fetchHumbleBundle {
    machineName = "loversinadangerousspacetime_linux";
    suffix = "zip";
    md5 = "e838cad67e8814e955dab42efd4995e2";
  };

  unpackCmd = ''
    ${unzip}/bin/unzip -qq -d liads "$src" || :
  '';

  arch = if stdenv.system == "x86_64-linux" then "x86_64" else "x86";
  executable = "LoversInADangerousSpacetime.${arch}";

  buildPhase = let
    rpath = stdenv.lib.makeLibraryPath [
      stdenv.cc.cc mesa xorg.libX11 xorg.libXcursor xorg.libXrandr libpulseaudio
    ];
  in ''
    patchelf \
      --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
      --set-rpath "${rpath}" "$executable"
  '';

  installPhase = ''
    install -vD "$executable" "$out/libexec/liads/liads"
    ln -s "$out/share/liads" "$out/libexec/liads/Data"

    mkdir -p "$out/bin"
    ln -s "$out/libexec/liads/liads" "$out/bin/liads"

    mkdir -p "$out/share"
    cp -vRd LoversInADangerousSpacetime_Data "$out/share/liads"
  '';

  dontStrip = true;
  dontPatchELF = true;
}