about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/roon-server/default.nix
blob: a5924e37331d2e94b3f00b76d8e2e829ea940b2c (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{ alsaLib, alsaUtils, cifs-utils, fetchurl, ffmpeg_3, libav, mono, stdenv }:

with stdenv.lib;
stdenv.mkDerivation rec {
  name = "roon-server";
  version = "100600401";

  src = fetchurl {
    url = "http://download.roonlabs.com/updates/stable/RoonServer_linuxx64_${version}.tar.bz2";
    sha256 = "121mmdh35q4bpgsqhcps6a6q1f4ld9v4hq9gp181bf2n779pk8sh";
  };

  installPhase = ''
    runHook preInstall

    # Check script
    sed -i '3i PATH=$PATH:${makeBinPath [ cifs-utils ffmpeg_3 libav ]}' check.sh
    sed -i '/check_ulimit$/d' check.sh

    # Start script
    sed -i '3i PATH=$PATH:${makeBinPath [ alsaUtils cifs-utils ffmpeg_3 libav ]}' start.sh

    # Debug logging
    sed -i '/--debug--gc=sgen --server/exec "$HARDLINK" --debug --gc=sgen --server "$SCRIPT.exe" "$@" -storagetrace -watchertrace' Appliance/RoonAppliance

    # Binaries
    sed -i '/# boost ulimit/,+2 d' Appliance/RAATServer
    sed -i '/# boost ulimit/,+2 d' Appliance/RoonAppliance
    sed -i '/# boost ulimit/,+2 d' Server/RoonServer
    sed -i '/ln -sf/ d' Appliance/RAATServer
    sed -i '/ln -sf/ d' Appliance/RoonAppliance
    sed -i '/ln -sf/ d' Server/RoonServer
    mkdir -p $out/opt
    mv * $out/opt
    ln -sf $out/opt/RoonMono/bin/mono-sgen $out/opt/RoonMono/bin/RoonServer
    ln -sf $out/opt/RoonMono/bin/mono-sgen $out/opt/RoonMono/bin/RoonAppliance
    ln -sf $out/opt/RoonMono/bin/mono-sgen $out/opt/RoonMono/bin/RAATServer

    runHook postInstall
  '';

  preFixup = ''
    patchelf \
      --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
      --set-rpath "${alsaLib}/lib" \
      $out/opt/RoonMono/bin/mono-sgen

    # Checkers
    patchelf \
      --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
      --set-rpath "${alsaLib}/lib" \
      $out/opt/Appliance/check_alsa
    patchelf \
      --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
      $out/opt/Appliance/check_bincompat
  '';

  meta = {
    description = "The music player for music lovers.";
    homepage    = "https://roonlabs.com";
    license     = licenses.unfree;
    maintainers = with maintainers; [ steell ];
    platforms   = platforms.linux;
  };
}