1{
2 lib,
3 stdenv,
4 argp-standalone,
5 dbus,
6 dbus_cplusplus,
7 fetchurl,
8 glibmm,
9 libavc1394,
10 libconfig,
11 libiec61883,
12 libraw1394,
13 libxmlxx3,
14 pkg-config,
15 python311,
16 scons,
17 which,
18 withMixer ? false,
19 qt5,
20}:
21
22let
23 python =
24 if withMixer then
25 python311.withPackages (
26 pkgs: with pkgs; [
27 pyqt5
28 dbus-python
29 ]
30 )
31 else
32 python311;
33in
34stdenv.mkDerivation rec {
35 pname = "ffado";
36 version = "2.4.9";
37
38 outputs = [
39 "out"
40 "bin"
41 "dev"
42 ];
43
44 src = fetchurl {
45 url = "http://www.ffado.org/files/libffado-${version}.tgz";
46 hash = "sha256-xELFL60Ryv1VE7tOhGyFHxAchIT4karFRe0ZDo/U0Q8=";
47 };
48
49 prePatch = ''
50 substituteInPlace ./support/tools/ffado-diag.in \
51 --replace /lib/modules/ "/run/booted-system/kernel-modules/lib/modules/"
52 '';
53
54 nativeBuildInputs =
55 [
56 (scons.override {
57 # SConstruct script depends on distutils removed in Python 3.12
58 python3Packages = python311.pkgs;
59 })
60 pkg-config
61 which
62 ]
63 ++ lib.optionals withMixer [
64 python
65 python.pkgs.pyqt5
66 qt5.wrapQtAppsHook
67 ];
68
69 prefixKey = "PREFIX=";
70 sconsFlags = [
71 "DEBUG=False"
72 "ENABLE_ALL=True"
73 "BUILD_TESTS=True"
74 "BUILD_MIXER=${if withMixer then "True" else "False"}"
75 "UDEVDIR=${placeholder "out"}/lib/udev/rules.d"
76 "PYPKGDIR=${placeholder "out"}/${python.sitePackages}"
77 "BINDIR=${placeholder "bin"}/bin"
78 "INCLUDEDIR=${placeholder "dev"}/include"
79 "PYTHON_INTERPRETER=${python.interpreter}"
80 ];
81
82 buildInputs = [
83 dbus
84 dbus_cplusplus
85 glibmm
86 libavc1394
87 libconfig
88 libiec61883
89 libraw1394
90 libxmlxx3
91 python
92 ] ++ lib.optionals (!stdenv.hostPlatform.isGnu) [
93 argp-standalone
94 ];
95
96 NIX_LDFLAGS = lib.optionalString (!stdenv.hostPlatform.isGnu) "-largp";
97
98 enableParallelBuilding = true;
99 dontWrapQtApps = true;
100
101 postInstall = ''
102 # prevent build tools from leaking into closure
103 echo 'See `nix-store --query --tree ${placeholder "out"}`.' > $out/lib/libffado/static_info.txt
104 '';
105
106 preFixup = lib.optionalString withMixer ''
107 wrapQtApp "$bin/bin/ffado-mixer"
108 '';
109
110 meta = with lib; {
111 homepage = "http://www.ffado.org";
112 description = "FireWire audio drivers";
113 license = licenses.gpl3;
114 maintainers = with maintainers; [
115 michojel
116 ];
117 platforms = platforms.linux;
118 };
119}