nixpkgs/pkgs/tools/bluetooth/blueman/default.nix
Christoph Heiss 1303bc206e blueman: fix cross-compilation
blueman checks runtime deps during the configure.

Fixes the following error when cross-compiling (in this case, to
aarch64):

```
error: builder for '/nix/store/kzrxxlk0vpsz6hwhl4rgf0ankfp3639h-blueman-aarch64-unknown-linux-gnu-2.3.5.drv' failed with exit code 1;
       last 10 log lines:
       > checking for python version... 3.10
       > checking for python platform... linux
       > checking for GNU default python prefix... ${prefix}
       > checking for GNU default python exec_prefix... ${exec_prefix}
       > checking for python script directory (pythondir)... ${PYTHON_PREFIX}/lib/python3.10/site-packages
       > checking for python extension module directory (pyexecdir)... ${PYTHON_EXEC_PREFIX}/lib/python3.10/site-packages
       > checking for python-3.10... yes
       > checking for ifconfig... no
       > checking for ip... no
       > configure: error: ifconfig or ip not found, install net-tools or iproute2
       For full logs, run 'nix log /nix/store/kzrxxlk0vpsz6hwhl4rgf0ankfp3639h-blueman-aarch64-unknown-linux-gnu-2.3.5.drv'.
error: building '/nix/store/kzrxxlk0vpsz6hwhl4rgf0ankfp3639h-blueman-aarch64-unknown-linux-gnu-2.3.5.drv' failed
```

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
2023-10-10 00:53:35 +03:00

64 lines
2.2 KiB
Nix

{ config, stdenv, lib, fetchurl, intltool, pkg-config, python3Packages, bluez, gtk3
, obex_data_server, xdg-utils, dnsmasq, dhcpcd, iproute2
, gnome, librsvg, wrapGAppsHook, gobject-introspection
, networkmanager, withPulseAudio ? config.pulseaudio or stdenv.isLinux, libpulseaudio }:
let
pythonPackages = python3Packages;
in stdenv.mkDerivation rec {
pname = "blueman";
version = "2.3.5";
src = fetchurl {
url = "https://github.com/blueman-project/blueman/releases/download/${version}/${pname}-${version}.tar.xz";
sha256 = "sha256-stIa/fd6Bs2G2vVAJAb30qU0WYF+KeC+vEkR1PDc/aE=";
};
nativeBuildInputs = [
gobject-introspection intltool pkg-config pythonPackages.cython
pythonPackages.wrapPython wrapGAppsHook
];
buildInputs = [ bluez gtk3 pythonPackages.python librsvg
gnome.adwaita-icon-theme networkmanager ]
++ pythonPath
++ lib.optional withPulseAudio libpulseaudio;
postPatch = lib.optionalString withPulseAudio ''
sed -i 's,CDLL(",CDLL("${libpulseaudio.out}/lib/,g' blueman/main/PulseAudioUtils.py
'';
pythonPath = with pythonPackages; [ pygobject3 pycairo ];
propagatedUserEnvPkgs = [ obex_data_server ];
configureFlags = [
"--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
"--with-systemduserunitdir=${placeholder "out"}/lib/systemd/user"
# Don't check for runtime dependency `ip` during the configure
"--disable-runtime-deps-check"
(lib.enableFeature withPulseAudio "pulseaudio")
];
makeWrapperArgs = [
"--prefix PATH ':' ${lib.makeBinPath [ dnsmasq dhcpcd iproute2 ]}"
"--suffix PATH ':' ${lib.makeBinPath [ xdg-utils ]}"
];
postFixup = ''
# This mimics ../../../development/interpreters/python/wrap.sh
wrapPythonProgramsIn "$out/bin" "$out $pythonPath"
wrapPythonProgramsIn "$out/libexec" "$out $pythonPath"
'';
meta = with lib; {
homepage = "https://github.com/blueman-project/blueman";
description = "GTK-based Bluetooth Manager";
license = licenses.gpl3;
platforms = platforms.linux;
changelog = "https://github.com/blueman-project/blueman/releases/tag/${version}";
maintainers = with maintainers; [ abbradar ];
};
}