forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / development / libraries / pipewire / default.nix
blobf8735c294a071b26f9d384dbb7ddbd833bf49a05
1 { stdenv
2 , lib
3 , fetchFromGitLab
4 , python3
5 , meson
6 , ninja
7 , elogind
8 , systemd
9 , enableSystemd ? true # enableSystemd=false maintained by maintainers.qyliss.
10 , pkg-config
11 , docutils
12 , doxygen
13 , graphviz
14 , glib
15 , dbus
16 , alsa-lib
17 , libjack2
18 , libusb1
19 , udev
20 , libsndfile
21 , vulkanSupport ? true
22 , vulkan-headers
23 , vulkan-loader
24 , webrtc-audio-processing
25 , webrtc-audio-processing_1
26 , ncurses
27 , readline # meson can't find <7 as those versions don't have a .pc file
28 , lilv
29 , makeFontsConf
30 , nixosTests
31 , valgrind
32 , libcamera
33 , libdrm
34 , gst_all_1
35 , ffmpeg
36 , bluez
37 , sbc
38 , libfreeaptx
39 , liblc3
40 , fdk_aac
41 , libopus
42 , ldacbt
43 , modemmanager
44 , libpulseaudio
45 , zeroconfSupport ? true
46 , avahi
47 , raopSupport ? true
48 , openssl
49 , rocSupport ? true
50 , roc-toolkit
51 , x11Support ? true
52 , libcanberra
53 , xorg
54 , libmysofa
55 , ffadoSupport ? x11Support && lib.systems.equals stdenv.buildPlatform stdenv.hostPlatform
56 , ffado
57 , libselinux
60 stdenv.mkDerivation(finalAttrs: {
61   pname = "pipewire";
62   version = "1.2.6";
64   outputs = [
65     "out"
66     "jack"
67     "dev"
68     "doc"
69     "man"
70     "installedTests"
71   ];
73   src = fetchFromGitLab {
74     domain = "gitlab.freedesktop.org";
75     owner = "pipewire";
76     repo = "pipewire";
77     rev = finalAttrs.version;
78     sha256 = "sha256-AmrbA1YQBeETLC9u9rQ2f85rG9TASvcbCZ/Xlz7ICdY=";
79   };
81   patches = [
82     # Load libjack from a known location
83     ./0060-libjack-path.patch
84     # Move installed tests into their own output.
85     ./0070-installed-tests-path.patch
86   ];
88   strictDeps = true;
89   nativeBuildInputs = [
90     docutils
91     doxygen
92     graphviz
93     meson
94     ninja
95     pkg-config
96     python3
97     glib
98   ];
100   buildInputs = [
101     alsa-lib
102     bluez
103     dbus
104     fdk_aac
105     ffmpeg
106     glib
107     gst_all_1.gst-plugins-base
108     gst_all_1.gstreamer
109     libcamera
110     libjack2
111     libfreeaptx
112     liblc3
113     libmysofa
114     libopus
115     libpulseaudio
116     libusb1
117     libselinux
118     libsndfile
119     lilv
120     modemmanager
121     ncurses
122     readline
123     sbc
124   ] ++ (if enableSystemd then [ systemd ] else [ elogind udev ])
125   ++ (if lib.meta.availableOn stdenv.hostPlatform webrtc-audio-processing_1 then [ webrtc-audio-processing_1 ] else [ webrtc-audio-processing ])
126   ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform ldacbt) ldacbt
127   ++ lib.optional zeroconfSupport avahi
128   ++ lib.optional raopSupport openssl
129   ++ lib.optional rocSupport roc-toolkit
130   ++ lib.optionals vulkanSupport [ libdrm vulkan-headers vulkan-loader ]
131   ++ lib.optionals x11Support [ libcanberra xorg.libX11 xorg.libXfixes ]
132   ++ lib.optional ffadoSupport ffado;
134   # Valgrind binary is required for running one optional test.
135   nativeCheckInputs =  lib.optional (lib.meta.availableOn stdenv.hostPlatform valgrind) valgrind;
137   mesonFlags = [
138     (lib.mesonEnable "docs" true)
139     (lib.mesonOption "udevrulesdir" "lib/udev/rules.d")
140     (lib.mesonEnable "installed_tests" true)
141     (lib.mesonOption "installed_test_prefix" (placeholder "installedTests"))
142     (lib.mesonOption "libjack-path" "${placeholder "jack"}/lib")
143     (lib.mesonEnable "libcamera" true)
144     (lib.mesonEnable "libffado" ffadoSupport)
145     (lib.mesonEnable "roc" rocSupport)
146     (lib.mesonEnable "libpulse" true)
147     (lib.mesonEnable "avahi" zeroconfSupport)
148     (lib.mesonEnable "gstreamer" true)
149     (lib.mesonEnable "gstreamer-device-provider" true)
150     (lib.mesonOption "logind-provider" (if enableSystemd then "libsystemd" else "libelogind"))
151     (lib.mesonEnable "systemd" enableSystemd)
152     (lib.mesonEnable "systemd-system-service" enableSystemd)
153     (lib.mesonEnable "udev" (!enableSystemd))
154     (lib.mesonEnable "ffmpeg" true)
155     (lib.mesonEnable "pw-cat-ffmpeg" true)
156     (lib.mesonEnable "bluez5" true)
157     (lib.mesonEnable "bluez5-backend-hsp-native" true)
158     (lib.mesonEnable "bluez5-backend-hfp-native" true)
159     (lib.mesonEnable "bluez5-backend-native-mm" true)
160     (lib.mesonEnable "bluez5-backend-ofono" true)
161     (lib.mesonEnable "bluez5-backend-hsphfpd" true)
162     # source code is not easily obtainable
163     (lib.mesonEnable "bluez5-codec-lc3plus" false)
164     (lib.mesonEnable "bluez5-codec-lc3" true)
165     (lib.mesonEnable "bluez5-codec-ldac" (lib.meta.availableOn stdenv.hostPlatform ldacbt))
166     (lib.mesonEnable "opus" true)
167     (lib.mesonOption "sysconfdir" "/etc")
168     (lib.mesonEnable "raop" raopSupport)
169     (lib.mesonOption "session-managers" "")
170     (lib.mesonEnable "vulkan" vulkanSupport)
171     (lib.mesonEnable "x11" x11Support)
172     (lib.mesonEnable "x11-xfixes" x11Support)
173     (lib.mesonEnable "libcanberra" x11Support)
174     (lib.mesonEnable "libmysofa" true)
175     (lib.mesonEnable "sdl2" false) # required only to build examples, causes dependency loop
176     (lib.mesonBool "rlimits-install" false) # installs to /etc, we won't use this anyway
177     (lib.mesonEnable "compress-offload" true)
178     (lib.mesonEnable "man" true)
179     (lib.mesonEnable "snap" false) # we don't currently have a working snapd
180   ];
182   # Fontconfig error: Cannot load default config file
183   FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; };
185   doCheck = true;
187   postUnpack = ''
188     patchShebangs source/doc/*.py
189     patchShebangs source/doc/input-filter-h.sh
190   '';
192   postInstall = ''
193     moveToOutput "bin/pw-jack" "$jack"
194   '';
196   passthru.tests.installed-tests = nixosTests.installed-tests.pipewire;
198   meta = with lib; {
199     description = "Server and user space API to deal with multimedia pipelines";
200     changelog = "https://gitlab.freedesktop.org/pipewire/pipewire/-/releases/${finalAttrs.version}";
201     homepage = "https://pipewire.org/";
202     license = licenses.mit;
203     platforms = platforms.linux;
204     maintainers = with maintainers; [ kranzes k900 ];
205   };