ship pine64-alsa-ucm, more likely to work with PinePhonePro

This commit is contained in:
2024-10-10 01:58:39 +00:00
parent f43cdcbe32
commit 966a29dff3
5 changed files with 38 additions and 38 deletions

View File

@@ -4,44 +4,7 @@ let
in
{
sane.programs.alsa-ucm-conf = {
configOption = with lib; mkOption {
default = {};
type = types.submodule {
options.preferEarpiece = mkOption {
type = types.bool;
default = true;
};
};
};
# upstream alsa ships with PinePhone audio configs, but they don't actually produce sound.
# - still true as of 2024-08-20
# - see: <https://github.com/alsa-project/alsa-ucm-conf/pull/134>
# - see: <https://gitlab.com/postmarketOS/pmaports/-/issues/2115>
#
# we can substitute working UCM conf in two ways:
# 1. nixpkgs' override for the `alsa-ucm-conf` package
# - that forces a rebuild of ~500 packages (including webkitgtk).
# 2. set ALSA_CONFIG_UCM2 = /path/to/ucm2 in the relevant places
# - e.g. pulsewire service.
# - easy to miss places, though.
#
# alsa-ucm-pinephone-manjaro (2024-05-26):
# - headphones work
# - "internal earpiece" works
# - "internal speaker" is silent (maybe hardware issue)
# - 3.5mm connection is flapping when playing to my car, which eventually breaks audio and requires restarting wireplumber
# packageUnwrapped = pkgs.alsa-ucm-pinephone-manjaro.override {
# inherit (cfg.config) preferEarpiece;
# };
# alsa-ucm-pinephone-pmos (2024-05-26):
# - headphones work
# - "internal earpiece" works
# - "internal speaker" is silent (maybe hardware issue)
packageUnwrapped = pkgs.alsa-ucm-pinephone-pmos.override {
inherit (cfg.config) preferEarpiece;
};
packageUnwrapped = pkgs.alsa-ucm-conf;
sandbox.enable = false; #< only provides $out/share/alsa
# alsa-lib package only looks in its $out/share/alsa to find runtime config data, by default.
@@ -49,6 +12,8 @@ in
# this is particularly needed by wireplumber;
# also *maybe* pipewire and pipewire-pulse.
# taken from <repo:nixos/mobile-nixos:modules/quirks/audio.nix>
# the other option is to `override` pkgs.alsa-ucm-conf,
# but that triggers 500+ rebuilds
env.ALSA_CONFIG_UCM2 = "/run/current-system/sw/share/alsa/ucm2";
enableFor.system = lib.mkIf (builtins.any (en: en) (builtins.attrValues cfg.enableFor.user)) true;

View File

@@ -132,6 +132,7 @@
./pactl.nix
./papers.nix
./pidof.nix
./pine64-alsa-ucm.nix
./pipewire
./pkill.nix
./planify.nix

View File

@@ -0,0 +1,26 @@
# upstream alsa ships with PinePhone audio configs, but they don't actually produce sound.
# - still true as of 2024-08-20
# - see: <https://github.com/alsa-project/alsa-ucm-conf/pull/134>
# - see: <https://gitlab.com/postmarketOS/pmaports/-/issues/2115>
#
# alsa-ucm-pinephone-manjaro (2024-05-26):
# - headphones work
# - "internal earpiece" works
# - "internal speaker" is silent (maybe hardware issue)
# - 3.5mm connection is flapping when playing to my car, which eventually breaks audio and requires restarting wireplumber
# packageUnwrapped = pkgs.alsa-ucm-pinephone-manjaro.override {
# inherit (cfg.config) preferEarpiece;
# };
# alsa-ucm-pinephone-pmos (2024-05-26):
# - headphones work
# - "internal earpiece" works
# - "internal speaker" is silent (maybe hardware issue)
# packageUnwrapped = pkgs.alsa-ucm-pinephone-pmos.override {
# inherit (cfg.config) preferEarpiece;
# };
{ ... }:
{
sane.programs.pine64-alsa-ucm = {
sandbox.enable = false; #< only provides /share/alsa
};
}

View File

@@ -32,6 +32,10 @@ in
# boot.kernelPackages = pkgs.linuxPackagesFor myCustomKernel;
# boot.initrd.extraFiles."/lib".source = "${config.system.modulesTree}/lib";
sane.programs.alsa-ucm-conf.suggestedPrograms = [
"pine64-alsa-ucm" # upstreaming: https://github.com/alsa-project/alsa-ucm-conf/pull/375
];
boot.kernelPatches = [
{
# TODO: upstream into nixpkgs. <repo:nixos/nixpkgs:pkgs/os-specific/linux/kernel/common-config.nix>

View File

@@ -110,6 +110,10 @@ in
dd if=${pkgs.u-boot-pinephone}/u-boot-sunxi-with-spl.bin of=$out bs=1024 seek=8 conv=notrunc
'';
sane.programs.alsa-ucm-conf.suggestedPrograms = [
"pine64-alsa-ucm" # upstreaming: <https://github.com/alsa-project/alsa-ucm-conf/issues/399>
];
sane.programs.geoclue2.suggestedPrograms = [
"gps-share"
];