fix: audio stack; disable mopidy by default, enable jack and wireplumber

This commit is contained in:
Benjamin Bädorf 2023-08-09 14:19:55 +02:00
parent cb902a6016
commit edddd9dc80
No known key found for this signature in database
GPG key ID: 4406E80E13CD656C
3 changed files with 38 additions and 26 deletions

View file

@ -66,33 +66,14 @@ in {
# rtkit is optional but recommended
security.rtkit.enable = true;
# Enable sound using pipewire-pulse, default config:
# https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/daemon/pipewire.conf.in
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
# Make pulseaudio listen on port 4713 for mopidy, extending the default
# config: https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/daemon/pipewire-pulse.conf.in
environment.etc = mkIf cfg.mopidy.enable {
"pipewire/pipewire-pulse.conf.d/99-custom.conf".text = ''
{
"context.modules": [
{
"name": "libpipewire-module-protocol-pulse",
"args": {
"server.address": ["unix:native", "tcp:4713"],
"vm.overrides": {
"pulse.min.quantum": "1024/48000"
}
}
}
]
}
'';
wireplumber.enable = true;
# If you want to use JACK applications, uncomment this
jack.enable = true;
};
# Enable bluetooth
@ -113,8 +94,38 @@ in {
};
};
services.blueman.enable = mkIf cfg.bluetooth.enable true;
environment.etc."wireplumber/bluetooth.lua.d/51-bluez-config.lua" = mkIf cfg.bluetooth.enable {
text = ''
bluez_monitor.properties = {
["bluez5.enable-sbc-xq"] = true,
["bluez5.enable-msbc"] = true,
["bluez5.enable-hw-volume"] = true,
["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
}
'';
};
# Enable audio server & client
services.mopidy = mkIf cfg.mopidy.enable ((import ./mopidy.nix) pkgs);
# Make pulseaudio listen on port 4713 for mopidy, extending the default
# config: https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/daemon/pipewire-pulse.conf.in
environment.etc."pipewire/pipewire-pulse.conf.d/99-custom.conf" = mkIf cfg.mopidy.enable {
text = ''
{
"context.modules": [
{
"name": "libpipewire-module-protocol-pulse",
"args": {
"server.address": ["unix:native", "tcp:4713"],
"vm.overrides": {
"pulse.min.quantum": "1024/48000"
}
}
}
]
}
'';
};
}
};
}

View file

@ -8,7 +8,6 @@
inherit (lib) fileContents;
in {
config = {
pub-solar.audio.mopidy.enable = true;
pub-solar.audio.bluetooth.enable = true;
pub-solar.docker.enable = true;
pub-solar.nextcloud.enable = true;

View file

@ -14,6 +14,8 @@ in {
./concepts-and-training.nix
];
pub-solar.audio.mopidy.enable = false;
home-manager = pkgs.lib.setAttrByPath ["users" psCfg.user.name] {
home.packages = with pkgs; [
present-md
@ -119,7 +121,7 @@ in {
age.secrets."mopidy.conf" = {
file = "${self}/secrets/mopidy.conf";
mode = "700";
owner = "mopidy";
owner = "ben";
};
services.mopidy.extraConfigFiles = ["/run/agenix/mopidy.conf"];