From dba22fdb390e2ecaf16e238015657c3da581b6ba Mon Sep 17 00:00:00 2001 From: Colin Date: Sat, 19 Oct 2024 05:45:18 +0000 Subject: [PATCH] moby: ship alsa w/o the "voice call" configs, since they dont produce any audio --- hosts/common/programs/calls.nix | 2 +- .../hal/pine64-pinephone-pro/default.nix | 3 +++ pkgs/by-name/pine64-alsa-ucm/package.nix | 19 ++++++++++++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/hosts/common/programs/calls.nix b/hosts/common/programs/calls.nix index f7527125a..a768e7ab8 100644 --- a/hosts/common/programs/calls.nix +++ b/hosts/common/programs/calls.nix @@ -110,7 +110,7 @@ in # this is only the username/endpoint: the actual password appears to be stored in gnome-keyring secrets.".config/calls/sip-account.cfg" = ../../../secrets/common/gnome_calls_sip-account.cfg.bin; suggestedPrograms = [ - "callaudiod" # runtime dependency (optional, but probably needed for mic muting?) + "callaudiod" # runtime dependency (optional; without this the mute and speaker buttons do not work (ordinarily they function by changing the GLOBAL audio config)) "feedbackd" # needs `phone-incoming-call`, in particular "gnome-keyring" # to remember the password ]; diff --git a/hosts/modules/hal/pine64-pinephone-pro/default.nix b/hosts/modules/hal/pine64-pinephone-pro/default.nix index 7d092d0db..fdcef4cc9 100644 --- a/hosts/modules/hal/pine64-pinephone-pro/default.nix +++ b/hosts/modules/hal/pine64-pinephone-pro/default.nix @@ -40,6 +40,9 @@ in sane.programs.swaynotificationcenter.config = { backlight = "backlight"; # /sys/class/backlight/*backlight*/brightness }; + # XXX(2024/10/18): callaudiod changes the global audio config; this requires alsa configs to be 100% right, + # else it'll change to something which produces no sound (like the "Voice Call" use case) + # sane.programs.callaudiod.enableFor.user.colin = lib.mkForce false; boot.kernelPatches = [ { diff --git a/pkgs/by-name/pine64-alsa-ucm/package.nix b/pkgs/by-name/pine64-alsa-ucm/package.nix index 24aa620c5..216f95522 100644 --- a/pkgs/by-name/pine64-alsa-ucm/package.nix +++ b/pkgs/by-name/pine64-alsa-ucm/package.nix @@ -1,6 +1,9 @@ { fetchFromGitLab, + gnused, + lib, stdenv, + withVoiceCall ? false, #< enable the "Voice Call" audio variants, which frequently don't work and idk what they're *supposed* to do }: stdenv.mkDerivation { pname = "pine64-alsa-ucm"; @@ -13,7 +16,17 @@ stdenv.mkDerivation { hash = "sha256-nsZXBB5VpF0YpfIS+/SSHMlPXSyIGLZSOkovjag8ifU="; }; - dontBuild = true; + nativeBuildInputs = lib.optionals (!withVoiceCall) [ + gnused + ]; + + buildPhase = lib.optionalString (!withVoiceCall) '' + sed -e '/SectionUseCase."Voice Call"/,+3d' -i ucm2/PinePhone/PinePhone.conf + rm ucm2/PinePhone/VoiceCall.conf + + sed -e '/SectionUseCase."Voice Call"/,+3d' -i ucm2/PinePhonePro/PinePhonePro.conf + rm ucm2/PinePhonePro/VoiceCall.conf + ''; installPhase = '' runHook preInstall @@ -36,11 +49,11 @@ stdenv.mkDerivation { substituteInPlace $out/share/alsa/ucm2/Allwinner/A64/PinePhone/PinePhone.conf \ --replace-fail '"HiFi.conf"' '"/Allwinner/A64/PinePhone/HiFi.conf"' \ - --replace-fail '"VoiceCall.conf"' '"/Allwinner/A64/PinePhone/VoiceCall.conf"' + ${lib.optionalString withVoiceCall ''--replace-fail '"VoiceCall.conf"' '"/Allwinner/A64/PinePhone/VoiceCall.conf"' ''} substituteInPlace $out/share/alsa/ucm2/Rockchip/rk3399/PinePhonePro/PinePhonePro.conf \ --replace-fail '"HiFi.conf"' '"/Rockchip/rk3399/PinePhonePro/HiFi.conf"' \ - --replace-fail '"VoiceCall.conf"' '"/Rockchip/rk3399/PinePhonePro/VoiceCall.conf"' + ${lib.optionalString withVoiceCall ''--replace-fail '"VoiceCall.conf"' '"/Rockchip/rk3399/PinePhonePro/VoiceCall.conf"' ''} runHook postFixup '';