nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 autoPatchelfHook,
4 dpkg,
5 fetchurl,
6 lib,
7 alsa-lib,
8}:
9let
10 inherit (stdenv.hostPlatform) system;
11 throwSystem = throw "Unsupported system: ${system}";
12in
13stdenv.mkDerivation rec {
14 pname = "networkaudiod";
15 version = "4.1.1-46";
16
17 src =
18 {
19 x86_64-linux = fetchurl {
20 url = "https://www.signalyst.eu/bins/naa/linux/buster/${pname}_${version}_amd64.deb";
21 sha256 = "sha256-un5VcCnvCCS/KWtW991Rt9vz3flYilERmRNooEsKCkA=";
22 };
23 aarch64-linux = fetchurl {
24 url = "https://www.signalyst.eu/bins/naa/linux/buster/${pname}_${version}_arm64.deb";
25 sha256 = "sha256-fjSCWX9VYhVJ43N2kSqd5gfTtDJ1UiH4j5PJ9I5Skag=";
26 };
27 }
28 .${system} or throwSystem;
29
30 unpackPhase = ''
31 dpkg -x $src .
32 '';
33
34 nativeBuildInputs = [
35 autoPatchelfHook
36 dpkg
37 ];
38
39 buildInputs = [
40 alsa-lib
41 (lib.getLib stdenv.cc.cc)
42 ];
43
44 dontConfigure = true;
45 dontBuild = true;
46
47 installPhase = ''
48 runHook preInstall
49
50 # main executable
51 mkdir -p $out/bin
52 cp ./usr/sbin/networkaudiod $out/bin
53
54 # systemd service file
55 mkdir -p $out/lib/systemd/system
56 cp ./lib/systemd/system/networkaudiod.service $out/lib/systemd/system
57
58 # documentation
59 mkdir -p $out/share/doc/networkaudiod
60 cp -r ./usr/share/doc/networkaudiod $out/share/doc/
61
62 runHook postInstall
63 '';
64
65 postInstall = ''
66 substituteInPlace $out/lib/systemd/system/networkaudiod.service \
67 --replace /usr/sbin/networkaudiod $out/bin/networkaudiod
68 '';
69
70 meta = {
71 homepage = "https://www.signalyst.com/index.html";
72 description = "Network Audio Adapter daemon";
73 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
74 license = lib.licenses.unfree;
75 maintainers = with lib.maintainers; [ lovesegfault ];
76 platforms = lib.platforms.linux;
77 mainProgram = "networkaudiod";
78 };
79}