Hi all, I have a chromebook, which I run nixos on. Due to the many quirks of running linux on a chomebook, alsa needs some further configuration, see chromebook-ucm-conf.
For a while, overriding alsa-ucm-conf like this worked just fine, however, since alsa-ucm-conf updated from version 1.2.9, I’ve had a hard time adjusting the override in a way that makes it, so I don’t have to rebuild a million packages.
Chrultrabook(the community that works to get traditional linux distros running on chromebooks) has some instructions to fix audio on nixos, which I tried implementing as follows:
environment = {
systemPackages = with pkgs; [ alsa-ucm-conf maliit-keyboard ];
sessionVariables = {
ALSA_CONFIG_UCM2 = "${pkgs.alsa-ucm-conf}/share/alsa/ucm2";
};
};
nixpkgs.overlays = with pkgs;
[
(final: prev: {
alsa-ucm-conf = prev.alsa-ucm-conf.overrideAttrs (old: {
wttsrc = (fetchFromGitHub {
owner = "WeirdTreeThing";
repo = "chromebook-ucm-conf";
rev = "792a6d5ef0d70ac1f0b4861f3d29da4fe9acaed1";
hash = "sha256-Ae/k9vA5lWiomSa6WCfp+ROqEij11FPwlHAIG6L19JI=";
});
installPhase = ''
runHook preInstall
mkdir -p $out/share/alsa
cp -r ucm ucm2 $out/share/alsa
mkdir -p $out/share/alsa/ucm2/conf.d
cp -r $wttsrc/{hdmi,dmic}-common $wttsrc/cml/* $out/share/alsa/ucm2/conf.d
runHook postInstall
'';
});
})
];
The problem is that when I rebuild my system with these changes, nix wants to rebuild a lot of packages, totalling to nearly 50 gigs worth. So I attempted instead to create and install the following package, exporting the correct sessionVariable:
{ lib, stdenv, fetchurl, alsa-ucm-conf }:
stdenv.mkDerivation {
pname = "alsa-ucm-cml-conf";
version = "2024-03-07";
src = fetchurl {
url =
"https://github.com/WeirdTreeThing/chromebook-ucm-conf/archive/792a6d5ef0d70ac1f0b4861f3d29da4fe9acaed1.tar.gz";
hash = "sha256-Ae/k9vA5lWiomSa6WCfp+ROqEij11FPwlHAIG6L19JI=";
};
dontBuild = true;
preInstall = ''
mkdir -p $out/share/alsa/ucm2/conf.d
find ${alsa-ucm-conf}/share/alsa/ucm2 -mindepth 1 -maxdepth 1 \( -type f -o -type d \) -exec ln -s {} "$out/share/alsa/ucm2/" \;
find ${alsa-ucm-conf}/share/alsa/ucm2/conf.d -mindepth 1 -maxdepth 1 \( -type f -o -type d \) -exec ln -s {} "$out/share/alsa/ucm2/conf.d/" \;
'';
installPhase = ''
runHook preInstall
cp -r hdmi-common dmic-common cml $out/share/alsa/ucm2/conf.d
runHook postInstall
'';
meta = with lib; {
homepage = "https://github.com/WeirdTreeThing/chromebook-ucm-conf";
description = "Alsa UCM configuration for cml chromebook devices";
license = licenses.bsd3;
platforms = platforms.linux;
};
}
But that didn’t seem to work, I think I need to override alsa-ucm-conf instead. Is there a way I can override it without having to rebuild all these packages, or am I out of luck?
Any help would be greatly appreciated.