1{ alsa-lib
2, alsa-utils
3, autoPatchelfHook
4, fetchurl
5, ffmpeg
6, lib
7, makeWrapper
8, openssl
9, stdenv
10, zlib
11}:
12let
13 version = "1.8-1125";
14 urlVersion = builtins.replaceStrings [ "." "-" ] [ "00" "0" ] version;
15 host = stdenv.hostPlatform.system;
16 system = if host == "x86_64-linux" then "linuxx64"
17 else if host == "aarch64-linux" then "linuxarmv8"
18 else throw "Unsupported platform ${host}";
19 src = fetchurl {
20 url = "https://download.roonlabs.com/updates/stable/RoonBridge_${system}_${urlVersion}.tar.bz2";
21 hash = if system == "linuxx64" then "sha256-DbtKPFEz2WIoKTxP+zoehzz+BjfsLZ2ZQk/FMh+zFBM="
22 else if system == "linuxarmv8" then "sha256-+przEj96R+f1z4ewETFarF4oY6tT2VW/ukSTgUBLiYk="
23 else throw "Unsupported platform ${host}";
24 };
25in
26stdenv.mkDerivation {
27 pname = "roon-bridge";
28 inherit src version;
29
30 dontConfigure = true;
31 dontBuild = true;
32
33 buildInputs = [
34 alsa-lib
35 zlib
36 stdenv.cc.cc.lib
37 ];
38
39 nativeBuildInputs = [ autoPatchelfHook makeWrapper ];
40
41 installPhase =
42 let
43 fixBin = binPath: ''
44 (
45 sed -i '/ulimit/d' ${binPath}
46 sed -i 's@^SCRIPT=.*@SCRIPT="$(basename "${binPath}")"@' ${binPath}
47 wrapProgram ${binPath} \
48 --argv0 "$(basename ${binPath})" \
49 --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ alsa-lib ffmpeg openssl ]}" \
50 --prefix PATH : "${lib.makeBinPath [ alsa-utils ffmpeg ]}"
51 )
52 '';
53 in
54 ''
55 runHook preInstall
56 mkdir -p $out
57 mv * $out
58
59 rm $out/check.sh
60 rm $out/start.sh
61 rm $out/VERSION
62
63 ${fixBin "${placeholder "out"}/Bridge/RAATServer"}
64 ${fixBin "${placeholder "out"}/Bridge/RoonBridge"}
65 ${fixBin "${placeholder "out"}/Bridge/RoonBridgeHelper"}
66
67 mkdir -p $out/bin
68 makeWrapper "$out/Bridge/RoonBridge" "$out/bin/RoonBridge" --chdir "$out"
69
70 runHook postInstall
71 '';
72
73 meta = with lib; {
74 description = "The music player for music lovers";
75 changelog = "https://community.roonlabs.com/c/roon/software-release-notes/18";
76 homepage = "https://roonlabs.com";
77 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
78 license = licenses.unfree;
79 maintainers = with maintainers; [ lovesegfault ];
80 platforms = [ "aarch64-linux" "x86_64-linux" ];
81 };
82}