From 025a7118790b980f3936cb2abae6d65bcda13dc2 Mon Sep 17 00:00:00 2001 From: Alexander Bantyev Date: Tue, 30 Mar 2021 23:35:59 +0300 Subject: [PATCH] Use pulseaudio with absolute volume patches --- flake.lock | 18 ++++++++++++++++++ flake.nix | 4 ++++ modules/hardware.nix | 38 ++++++++++++++++++++++++++++++++++++-- 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/flake.lock b/flake.lock index d7ad53a..16ea258 100644 --- a/flake.lock +++ b/flake.lock @@ -411,6 +411,23 @@ "type": "github" } }, + "pulseaudio": { + "flake": false, + "locked": { + "lastModified": 1616962871, + "narHash": "sha256-hUSMqLpFQgL8sv9fsc5E4WFZXsAHSuj/kqS9KxhghSk=", + "ref": "a2dp-avrcp-absolute-volume", + "rev": "7f58efcd7cc2e513c155f9504deda6d7a2e466ac", + "revCount": 9724, + "type": "git", + "url": "https://gitlab.freedesktop.org/MarijnS95/pulseaudio.git" + }, + "original": { + "ref": "a2dp-avrcp-absolute-volume", + "type": "git", + "url": "https://gitlab.freedesktop.org/MarijnS95/pulseaudio.git" + } + }, "root": { "inputs": { "NUR": "NUR", @@ -428,6 +445,7 @@ "nixpkgs": "nixpkgs_5", "nixpkgs-old": "nixpkgs-old", "nixpkgs-wayland": "nixpkgs-wayland", + "pulseaudio": "pulseaudio", "simple-nixos-mailserver": "simple-nixos-mailserver", "simple-osd-daemons": "simple-osd-daemons", "sonoff-lan": "sonoff-lan", diff --git a/flake.nix b/flake.nix index e5320e3..018753b 100644 --- a/flake.nix +++ b/flake.nix @@ -63,6 +63,10 @@ url = "git+https://code.librehq.com/qhong/crdt.el"; flake = false; }; + pulseaudio = { + url = "git+https://gitlab.freedesktop.org/MarijnS95/pulseaudio.git?ref=a2dp-avrcp-absolute-volume"; + flake = false; + }; }; outputs = { nixpkgs, nix, self, deploy-rs, ... }@inputs: { diff --git a/modules/hardware.nix b/modules/hardware.nix index 269142e..bf3c52c 100644 --- a/modules/hardware.nix +++ b/modules/hardware.nix @@ -1,4 +1,4 @@ -{ pkgs, config, lib, ... }: +{ pkgs, config, lib, inputs, ... }: with rec { inherit (config) device deviceSpecific; }; with deviceSpecific; { @@ -23,7 +23,41 @@ with deviceSpecific; { sound.enable = true; hardware.pulseaudio = { enable = true; - package = pkgs.pulseaudioFull; + package = pkgs.callPackage ({ ... }: + let orig = pkgs.pulseaudioFull; + in pkgs.stdenv.mkDerivation rec { + pname = "pulseaudio"; + version = "1.1.1"; # For compatibility + outputs = [ "out" "dev" ]; + src = inputs.pulseaudio; + nativeBuildInputs = with pkgs; [ + pkg-config + makeWrapper + perlPackages.perl + perlPackages.XMLParser + + meson + ninja + ]; + inherit (orig) + propagatedBuildInputs configureFlags installFlags postInstall + preFixup; + buildInputs = orig.buildInputs + ++ (with pkgs; [ libexecinfo tdb orc check ]); + preConfigure = '' + echo "$version" > .tarball-version + ''; + mesonFlags = [ + "-Dgtk=disabled" + "-Delogind=disabled" + "-Dvalgrind=disabled" + "-Dtcpwrap=disabled" + "-Dbluez5-gstreamer=disabled" + "-Dgstreamer=disabled" + "-Dsystemduserunitdir=lib/systemd/user" + "-Dudevrulesdir=lib/udev/rules.d" + ]; + }) { }; support32Bit = true; extraConfig = '' load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1