Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 alsa-lib,
3 alsa-utils,
4 autoPatchelfHook,
5 cifs-utils,
6 fetchurl,
7 ffmpeg,
8 freetype,
9 icu66,
10 krb5,
11 lib,
12 libtasn1,
13 lttng-ust_2_12,
14 makeWrapper,
15 openssl,
16 stdenv,
17}:
18let
19 version = "2.53.1544";
20 urlVersion = builtins.replaceStrings [ "." ] [ "0" ] version;
21in
22stdenv.mkDerivation {
23 pname = "roon-server";
24 inherit version;
25
26 src = fetchurl {
27 url = "https://download.roonlabs.com/updates/production/RoonServer_linuxx64_${urlVersion}.tar.bz2";
28 hash = "sha256-Hbe2EfBbpA3Xzyh4ZYjm1G8qrwg+dEq5YAwZEG59ClI=";
29 };
30
31 dontConfigure = true;
32 dontBuild = true;
33
34 buildInputs = [
35 alsa-lib
36 freetype
37 krb5
38 libtasn1
39 lttng-ust_2_12
40 (lib.getLib stdenv.cc.cc)
41 ];
42
43 nativeBuildInputs = [
44 autoPatchelfHook
45 makeWrapper
46 ];
47
48 installPhase =
49 let
50 # NB: While this might seem like odd behavior, it's what Roon expects. The
51 # tarball distribution provides scripts that do a bunch of nonsense on top
52 # of what wrapBin is doing here, so consider it the lesser of two evils.
53 # I didn't bother checking whether the symlinks are really necessary, but
54 # I wouldn't put it past Roon to have custom code based on the binary
55 # name, so we're playing it safe.
56 wrapBin = binPath: ''
57 (
58 binDir="$(dirname "${binPath}")"
59 binName="$(basename "${binPath}")"
60 dotnetDir="$out/RoonDotnet"
61
62 ln -sf "$dotnetDir/dotnet" "$dotnetDir/$binName"
63 rm "${binPath}"
64 makeWrapper "$dotnetDir/$binName" "${binPath}" \
65 --add-flags "$binDir/$binName.dll" \
66 --argv0 "$binName" \
67 --prefix LD_LIBRARY_PATH : "${
68 lib.makeLibraryPath [
69 alsa-lib
70 icu66
71 ffmpeg
72 openssl
73 ]
74 }" \
75 --prefix PATH : "$dotnetDir" \
76 --prefix PATH : "${
77 lib.makeBinPath [
78 alsa-utils
79 cifs-utils
80 ffmpeg
81 ]
82 }" \
83 --chdir "$binDir" \
84 --set DOTNET_ROOT "$dotnetDir"
85 )
86 '';
87 in
88 ''
89 runHook preInstall
90 mkdir -p $out
91 mv * $out
92
93 rm $out/check.sh
94 rm $out/start.sh
95 rm $out/VERSION
96
97 ${wrapBin "$out/Appliance/RAATServer"}
98 ${wrapBin "$out/Appliance/RoonAppliance"}
99 ${wrapBin "$out/Server/RoonServer"}
100
101 mkdir -p $out/bin
102 makeWrapper "$out/Server/RoonServer" "$out/bin/RoonServer" --chdir "$out"
103
104 runHook postInstall
105 '';
106
107 passthru.updateScript = ./update.py;
108 meta = with lib; {
109 description = "Music player for music lovers";
110 changelog = "https://community.roonlabs.com/c/roon/software-release-notes/18";
111 homepage = "https://roonlabs.com";
112 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
113 license = licenses.unfree;
114 maintainers = with maintainers; [
115 lovesegfault
116 steell
117 ramblurr
118 ];
119 platforms = [ "x86_64-linux" ];
120 mainProgram = "RoonServer";
121 };
122}