From 55b99696bffc385c23e5b0b8b006b3b5f3396538 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Wed, 27 Dec 2023 13:19:53 -0300 Subject: [PATCH] bluez-alsa: refactor - lists in ASCIIbetical ordering - finalAttrs design pattern - add updater script - remove nested with - set meta.mainProgram - add AndersonTorres as maintainer --- pkgs/by-name/bl/bluez-alsa/package.nix | 80 ++++++++++++++++---------- 1 file changed, 50 insertions(+), 30 deletions(-) diff --git a/pkgs/by-name/bl/bluez-alsa/package.nix b/pkgs/by-name/bl/bluez-alsa/package.nix index 30ef73228b31..911efe4a5644 100644 --- a/pkgs/by-name/bl/bluez-alsa/package.nix +++ b/pkgs/by-name/bl/bluez-alsa/package.nix @@ -1,42 +1,62 @@ -{ lib, stdenv, fetchFromGitHub, pkg-config, autoreconfHook -, alsa-lib, bluez, glib, sbc, dbus - -# optional, but useful utils -, readline, libbsd, ncurses - -# optional codecs -, aacSupport ? true, fdk_aac -# TODO: aptxSupport +{ lib +, stdenv +, aacSupport ? true +, alsa-lib +, autoreconfHook +, bluez +, dbus +, fdk_aac +, fetchFromGitHub +, gitUpdater +, glib +, libbsd +, ncurses +, pkg-config +, readline +, sbc }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "bluez-alsa"; version = "4.1.1"; src = fetchFromGitHub { owner = "Arkq"; repo = "bluez-alsa"; - rev = "v${version}"; - sha256 = "sha256-oGaYiSkOhqfjUl+mHTs3gqFcxli3cgkRtT6tbjy3ht0="; + rev = "v${finalAttrs.version}"; + hash = "sha256-oGaYiSkOhqfjUl+mHTs3gqFcxli3cgkRtT6tbjy3ht0="; }; - nativeBuildInputs = [ pkg-config autoreconfHook ]; + nativeBuildInputs = [ + autoreconfHook + pkg-config + ]; buildInputs = [ - alsa-lib bluez glib sbc dbus - readline libbsd ncurses - ] - ++ lib.optional aacSupport fdk_aac; + alsa-lib + bluez + glib + sbc + dbus + readline + libbsd + ncurses + ] ++ lib.optionals aacSupport [ + fdk_aac + ]; configureFlags = [ - "--with-alsaplugindir=${placeholder "out"}/lib/alsa-lib" - "--with-dbusconfdir=${placeholder "out"}/share/dbus-1/system.d" - "--enable-rfcomm" - "--enable-hcitop" - ] - ++ lib.optional aacSupport "--enable-aac"; + (lib.enableFeature aacSupport "aac") + (lib.enableFeature true "hcitop") + (lib.enableFeature true "rfcomm") + (lib.withFeatureAs true "alsaplugindir" "${placeholder "out"}/lib/alsa-lib") + (lib.withFeatureAs true "dbusconfdir" "${placeholder "out"}/share/dbus-1/system.d") + ]; - meta = with lib; { + passthru.updateScript = gitUpdater { }; + + meta = { + homepage = "https://github.com/Arkq/bluez-alsa"; description = "Bluez 5 Bluetooth Audio ALSA Backend"; longDescription = '' Bluez-ALSA (BlueALSA) is an ALSA backend for Bluez 5 audio interface. @@ -57,10 +77,10 @@ stdenv.mkDerivation rec { BluezALSA if you disable `bluetooth-discover` and `bluez5-discover` modules in PA and configure it to play/capture sound over `bluealsa` PCM. ''; - homepage = src.meta.homepage; - license = licenses.mit; - platforms = platforms.linux; - maintainers = [ maintainers.oxij ]; + license = with lib.licenses; [ mit ]; + mainProgram = "bluealsa"; + maintainers = with lib.maintainers; [ AndersonTorres oxij ]; + platforms = lib.platforms.linux; }; - -} +}) +# TODO: aptxSupport