Skip to content

Instantly share code, notes, and snippets.

@Roger
Created September 7, 2023 08:42
Show Gist options
  • Save Roger/0b711a605c949ca9d68def51fdab739f to your computer and use it in GitHub Desktop.
Save Roger/0b711a605c949ca9d68def51fdab739f to your computer and use it in GitHub Desktop.
fix mic's priority
diff --git a/configuration.nix b/configuration.nix
index fdd9a99..9475b5c 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -22,6 +22,18 @@ let
fi
'';
lib = pkgs.lib;
+
+ # the default priorities put the internal mic above headphones one
+ acp-paths = pkgs.runCommand "acp-paths" { } ''
+ mkdir -p $out
+ for f in ${pkgs.pipewire.lib}/share/alsa-card-profile/mixer/paths/*; do
+ ln -s $f $out/
+ done
+ cp --remove-destination "$(readlink "$out/analog-input-internal-mic.conf")" "$out/analog-input-internal-mic.conf"
+ cp --remove-destination "$(readlink "$out/analog-input-internal-mic-always.conf")" "$out/analog-input-internal-mic-always.conf"
+ sed -i 's/^priority = [0-9]*/priority = 79/' "$out/analog-input-internal-mic.conf"
+ sed -i 's/^priority = [0-9]*/priority = 79/' "$out/analog-input-internal-mic-always.conf"
+ '';
in
{
imports =
@@ -102,6 +114,7 @@ in
setSocketVariable = true;
};
};
+
# Declarative containers
programs.extra-container.enable = true;
@@ -273,6 +286,17 @@ in
# Enable CUPS to print documents.
services.printing.enable = true;
+ # Override paths for alsa-card-paths with one with my own priorities
+ systemd.user.services = {
+ pipewire-media-session.environment = {
+ ACP_PATHS_DIR = "${acp-paths}";
+ };
+
+ wireplumber.environment = {
+ ACP_PATHS_DIR = "${acp-paths}";
+ };
+ };
+
hardware.bluetooth.enable = true;
# Enable sound with pipewire.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment