From dcfc878774bba2777725f5bfad266db6f3e6b3d3 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Sat, 13 Jan 2024 19:27:28 -0300 Subject: [PATCH 1/2] bluez-alsa: migrate to by-name --- .../default.nix => by-name/bl/bluez-alsa/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 2 files changed, 2 deletions(-) rename pkgs/{tools/bluetooth/bluez-alsa/default.nix => by-name/bl/bluez-alsa/package.nix} (100%) diff --git a/pkgs/tools/bluetooth/bluez-alsa/default.nix b/pkgs/by-name/bl/bluez-alsa/package.nix similarity index 100% rename from pkgs/tools/bluetooth/bluez-alsa/default.nix rename to pkgs/by-name/bl/bluez-alsa/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bd4d17b5427b..da6c9d6bfd9f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4446,8 +4446,6 @@ with pkgs; blockdiag = with python3Packages; toPythonApplication blockdiag; - bluez-alsa = callPackage ../tools/bluetooth/bluez-alsa { }; - bmon = callPackage ../tools/misc/bmon { }; boca = callPackage ../development/libraries/boca { }; From 55b99696bffc385c23e5b0b8b006b3b5f3396538 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Wed, 27 Dec 2023 13:19:53 -0300 Subject: [PATCH 2/2] 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