diff --git a/modules/audio/default.nix b/modules/audio/default.nix index 8ff6f2e6..ae6e7459 100644 --- a/modules/audio/default.nix +++ b/modules/audio/default.nix @@ -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" + } + } + } + ] + } + ''; + }; + }; + } diff --git a/profiles/full-install/default.nix b/profiles/full-install/default.nix index d9b07733..908b4996 100644 --- a/profiles/full-install/default.nix +++ b/profiles/full-install/default.nix @@ -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; diff --git a/users/ben/home.nix b/users/ben/home.nix index e2c82f4d..ea15fa1c 100644 --- a/users/ben/home.nix +++ b/users/ben/home.nix @@ -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"];