From 3dcd5629a735d2fd58d270bac3da284d924844a6 Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 1 Jun 2023 21:13:44 +0000 Subject: [PATCH] moby: set ALSA_CONFIG_UCM2 in all the places it's needed --- hosts/by-name/moby/default.nix | 24 +++++++++++++++++++++--- pkgs/patched/alsa-ucm-conf/default.nix | 2 +- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/hosts/by-name/moby/default.nix b/hosts/by-name/moby/default.nix index 8ece4031..5c68ad94 100644 --- a/hosts/by-name/moby/default.nix +++ b/hosts/by-name/moby/default.nix @@ -80,9 +80,27 @@ # inject specialized alsa configs via the environment. # specifically, this gets the pinephone headphones & internal earpiece working. # see pkgs/patched/alsa-ucm-conf for more info. - # older code had me also setting `systemd.services.pulseaudio.environment.ALSA_CONFIG_UCM2`, - # but it seems safe to set this only globally, and not per-service. - environment.variables.ALSA_CONFIG_UCM2 = "${pkgs.alsa-ucm-conf-sane}/share/alsa/ucm2"; + environment.variables.ALSA_CONFIG_UCM2 = "/run/current-system/sw/share/alsa/ucm2"; + environment.pathsToLink = [ "/share/alsa/ucm2" ]; + environment.systemPackages = [ pkgs.alsa-ucm-conf-sane ]; + systemd = + let ucm-env = config.environment.variables.ALSA_CONFIG_UCM2; + in { + # cribbed from + + # pulseaudio + user.services.pulseaudio.environment.ALSA_CONFIG_UCM2 = ucm-env; + services.pulseaudio.environment.ALSA_CONFIG_UCM2 = ucm-env; + + # pipewire + user.services.pipewire.environment.ALSA_CONFIG_UCM2 = ucm-env; + user.services.pipewire-pulse.environment.ALSA_CONFIG_UCM2 = ucm-env; + user.services.wireplumber.environment.ALSA_CONFIG_UCM2 = ucm-env; + services.pipewire.environment.ALSA_CONFIG_UCM2 = ucm-env; + services.pipewire-pulse.environment.ALSA_CONFIG_UCM2 = ucm-env; + services.wireplumber.environment.ALSA_CONFIG_UCM2 = ucm-env; + }; + hardware.opengl.driSupport = true; } diff --git a/pkgs/patched/alsa-ucm-conf/default.nix b/pkgs/patched/alsa-ucm-conf/default.nix index ac74a04b..b7ea4efd 100644 --- a/pkgs/patched/alsa-ucm-conf/default.nix +++ b/pkgs/patched/alsa-ucm-conf/default.nix @@ -8,7 +8,7 @@ alsa-ucm-conf.overrideAttrs (upstream: { # alternative to patching is to plumb `ALSA_CONFIG_UCM2 = "${./ucm2}"` environment variable into the relevant places # e.g. `systemd.services.pulseaudio.environment`. # that leaves more opportunity for gaps (i.e. missing a service), - # on the other hand thie method causes about 500 packages to be rebuilt + # on the other hand this method causes about 500 packages to be rebuilt (including qt5 and webkitgtk). # # note that with these files, the following audio device support: # - headphones work.