summary refs log tree commit diff
path: root/pkgs/servers/roon-server/default.nix
blob: 61af3f2425e79862627a4b555cab0ed53b076d8f (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
66
67
68
69
70
71
72
73
{ alsa-lib
, alsa-utils
, autoPatchelfHook
, cifs-utils
, fetchurl
, ffmpeg
, freetype
, lib
, makeWrapper
, stdenv
, zlib
}: stdenv.mkDerivation rec {
  pname = "roon-server";
  version = "1.8-814";

  # N.B. The URL is unstable. I've asked for them to provide a stable URL but
  # they have ignored me. If this package fails to build for you, you may need
  # to update the version and sha256.
  # c.f. https://community.roonlabs.com/t/latest-roon-server-is-not-available-for-download-on-nixos/118129
  src = fetchurl {
    url = "https://web.archive.org/web/20210729154130/http://download.roonlabs.com/builds/RoonServer_linuxx64.tar.bz2";
    sha256 = "sha256-GbWcgNq+dmzoHNFZyB/QFCvJ7Hh48v8IuGS4WMNlKgI=";
  };

  buildInputs = [
    alsa-lib
    alsa-utils
    cifs-utils
    ffmpeg
    freetype
    zlib
  ];

  nativeBuildInputs = [ autoPatchelfHook makeWrapper ];

  installPhase = ''
    runHook preInstall
    mkdir -p $out
    mv * $out
    runHook postInstall
  '';

  postFixup =
    let
      linkFix = bin: ''
        sed -i '/ulimit/d' ${bin}
        sed -i '/ln -sf/d' ${bin}
        ln -sf $out/RoonMono/bin/mono-sgen $out/RoonMono/bin/${builtins.baseNameOf bin}
      '';
      wrapFix = bin: ''
        wrapProgram ${bin} --prefix PATH : ${lib.makeBinPath [ alsa-utils cifs-utils ffmpeg ]}
      '';
    in
    ''
      ${linkFix "$out/Appliance/RAATServer"}
      ${linkFix "$out/Appliance/RoonAppliance"}
      ${linkFix "$out/Server/RoonServer"}

      sed -i '/which avconv/c\    WHICH_AVCONV=1' $out/check.sh
      sed -i '/^check_ulimit/d' $out/check.sh
      ${wrapFix "$out/check.sh"}
      ${wrapFix "$out/start.sh"}
    '';

  meta = with lib; {
    description = "The music player for music lovers";
    changelog = "https://community.roonlabs.com/c/roon/software-release-notes/18";
    homepage = "https://roonlabs.com";
    license = licenses.unfree;
    maintainers = with maintainers; [ lovesegfault steell ];
    platforms = platforms.linux;
  };
}