1{
2 config,
3 stdenv,
4 lib,
5 fetchurl,
6 intltool,
7 pkg-config,
8 python3Packages,
9 bluez,
10 gtk3,
11 obex_data_server,
12 xdg-utils,
13 dnsmasq,
14 dhcpcd,
15 iproute2,
16 adwaita-icon-theme,
17 librsvg,
18 wrapGAppsHook3,
19 gobject-introspection,
20 networkmanager,
21 withPulseAudio ? config.pulseaudio or stdenv.hostPlatform.isLinux,
22 libpulseaudio,
23 procps,
24}:
25
26let
27 pythonPackages = python3Packages;
28
29in
30stdenv.mkDerivation rec {
31 pname = "blueman";
32 version = "2.4.6";
33
34 src = fetchurl {
35 url = "https://github.com/blueman-project/blueman/releases/download/${version}/${pname}-${version}.tar.xz";
36 sha256 = "sha256-xxKnN/mFWQZoTAdNFm1PEMfxZTeK+WYSgYu//Pv45WY=";
37 };
38
39 nativeBuildInputs = [
40 gobject-introspection
41 intltool
42 pkg-config
43 pythonPackages.cython
44 pythonPackages.wrapPython
45 wrapGAppsHook3
46 ];
47
48 buildInputs = [
49 bluez
50 gtk3
51 pythonPackages.python
52 librsvg
53 adwaita-icon-theme
54 networkmanager
55 procps
56 ]
57 ++ pythonPath
58 ++ lib.optional withPulseAudio libpulseaudio;
59
60 postPatch = lib.optionalString withPulseAudio ''
61 sed -i 's,CDLL(",CDLL("${libpulseaudio.out}/lib/,g' blueman/main/PulseAudioUtils.py
62 '';
63
64 pythonPath = with pythonPackages; [
65 pygobject3
66 pycairo
67 ];
68
69 propagatedUserEnvPkgs = [ obex_data_server ];
70
71 configureFlags = [
72 "--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
73 "--with-systemduserunitdir=${placeholder "out"}/lib/systemd/user"
74 # Don't check for runtime dependency `ip` during the configure
75 "--disable-runtime-deps-check"
76 (lib.enableFeature withPulseAudio "pulseaudio")
77 ];
78
79 makeWrapperArgs = [
80 "--prefix PATH ':' ${
81 lib.makeBinPath [
82 dnsmasq
83 dhcpcd
84 iproute2
85 ]
86 }"
87 "--suffix PATH ':' ${lib.makeBinPath [ xdg-utils ]}"
88 ];
89
90 postFixup = ''
91 # This mimics ../../../development/interpreters/python/wrap.sh
92 wrapPythonProgramsIn "$out/bin" "$out $pythonPath"
93 wrapPythonProgramsIn "$out/libexec" "$out $pythonPath"
94 '';
95
96 meta = {
97 homepage = "https://github.com/blueman-project/blueman";
98 description = "GTK-based Bluetooth Manager";
99 license = lib.licenses.gpl3;
100 platforms = lib.platforms.linux;
101 changelog = "https://github.com/blueman-project/blueman/releases/tag/${version}";
102 maintainers = with lib.maintainers; [ abbradar ];
103 };
104}