1{ config, stdenv, lib, fetchurl, intltool, pkg-config, python3Packages, bluez, gtk3
2, obex_data_server, xdg-utils, dnsmasq, dhcp, libappindicator, iproute2
3, gnome, librsvg, wrapGAppsHook, gobject-introspection
4, networkmanager, withPulseAudio ? config.pulseaudio or stdenv.isLinux, libpulseaudio }:
5
6let
7 pythonPackages = python3Packages;
8
9in stdenv.mkDerivation rec {
10 pname = "blueman";
11 version = "2.3.5";
12
13 src = fetchurl {
14 url = "https://github.com/blueman-project/blueman/releases/download/${version}/${pname}-${version}.tar.xz";
15 sha256 = "sha256-stIa/fd6Bs2G2vVAJAb30qU0WYF+KeC+vEkR1PDc/aE=";
16 };
17
18 nativeBuildInputs = [
19 gobject-introspection intltool pkg-config pythonPackages.cython
20 pythonPackages.wrapPython wrapGAppsHook
21 ];
22
23 buildInputs = [ bluez gtk3 pythonPackages.python librsvg
24 gnome.adwaita-icon-theme iproute2 networkmanager ]
25 ++ pythonPath
26 ++ lib.optional withPulseAudio libpulseaudio;
27
28 postPatch = lib.optionalString withPulseAudio ''
29 sed -i 's,CDLL(",CDLL("${libpulseaudio.out}/lib/,g' blueman/main/PulseAudioUtils.py
30 '';
31
32 pythonPath = with pythonPackages; [ pygobject3 pycairo ];
33
34 propagatedUserEnvPkgs = [ obex_data_server ];
35
36 configureFlags = [
37 "--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
38 "--with-systemduserunitdir=${placeholder "out"}/lib/systemd/user"
39 (lib.enableFeature withPulseAudio "pulseaudio")
40 ];
41
42 makeWrapperArgs = [
43 "--prefix PATH ':' ${lib.makeBinPath [ dnsmasq dhcp iproute2 ]}"
44 "--suffix PATH ':' ${lib.makeBinPath [ xdg-utils ]}"
45 ];
46
47 postFixup = ''
48 # This mimics ../../../development/interpreters/python/wrap.sh
49 wrapPythonProgramsIn "$out/bin" "$out $pythonPath"
50 wrapPythonProgramsIn "$out/libexec" "$out $pythonPath"
51 '';
52
53 meta = with lib; {
54 homepage = "https://github.com/blueman-project/blueman";
55 description = "GTK-based Bluetooth Manager";
56 license = licenses.gpl3;
57 platforms = platforms.linux;
58 changelog = "https://github.com/blueman-project/blueman/releases/tag/${version}";
59 maintainers = with maintainers; [ abbradar ];
60 };
61}