tpwrules / nixos-apple-silicon

Resources to install NixOS bare metal on Apple Silicon Macs
MIT License
838 stars 80 forks source link

alsa-ucm-conf-asahi: Add support for audio confs #102

Closed IonAgorria closed 11 months ago

IonAgorria commented 1 year ago

This adds the package so that headphones volume work by overriding the upstream alsa-ucm-conf and copying the extra asahi ucm2 confs into destination folder

Not entirely sure how package should be added for default installation in modules

yusefnapora commented 11 months ago

Hey, just wanted to chime in that I ended up doing basically the same thing on my install, but the override causes everything that links to alsa-lib to be rebuilt from source, which ended up pulling in about 5GB of stuff on my machine and takes quite a while to build.

As an alternative to overriding the stock alsa-config-ucm package, you could set the ALSA_CONFIG_UCM2 environment variable to the ucm2 directory in your new combined package, using something like this:

environment.variables = {
  ALSA_CONFIG_UCM2 = "${new-ucm-conf-package-from-this-pr}/share/alsa/ucm2";
};

The ALSA_CONFIG_UCM2 variable isn't documented especially well; I only stumbled on it in this old nixos issue. But, I tried it out and can confirm that alsa will load UCM files from there if the var is set.

edit: I just noticed that I misread the diff and you're not overriding the stock alsa-config-ucm lib, just adding the new package to the overlay. Hopefully the env var trick is still helpful :)