From 716df0c611543f38c995b60174d51b856ae6b6c4 Mon Sep 17 00:00:00 2001 From: Trolli Schmittlauch Date: Tue, 21 May 2024 22:40:26 +0200 Subject: [PATCH] audio: move framenix to pipewire, keep thinknix at pulseaudio --- common/default.nix | 15 --------------- common/pipewire.nix | 26 ++++++++++++++++++++++++++ common/pulseaudio.nix | 15 +++++++++++++++ hosts/framenix/default.nix | 3 ++- hosts/thinknix/default.nix | 1 + 5 files changed, 44 insertions(+), 16 deletions(-) create mode 100644 common/pipewire.nix create mode 100644 common/pulseaudio.nix diff --git a/common/default.nix b/common/default.nix index 59b4765..4d9bb2b 100644 --- a/common/default.nix +++ b/common/default.nix @@ -131,26 +131,11 @@ in extraBackends = [ pkgs.hplip ]; }; - # Enable sound. - hardware.pulseaudio = { - enable = true; - # decouple pulseaudio application and sink volumes - daemon.config = { - flat-volumes = "no"; - }; - # C3D2 hq music - zeroconf.discovery.enable = true; - zeroconf.publish.enable = true; - }; - # Bluetooth hardware.bluetooth = { enable = true; settings.General.Disable = "Headset"; # disable headset profile }; - hardware.pulseaudio = { - package = pkgs.pulseaudioFull; - }; # FIXME: at some point, hide GUI and sound (desktop vs. server) behind an option # Enable the X11 windowing system. diff --git a/common/pipewire.nix b/common/pipewire.nix new file mode 100644 index 0000000..cf9a01f --- /dev/null +++ b/common/pipewire.nix @@ -0,0 +1,26 @@ +{ pkgs, ... }: +{ + # rtkit is optional but recommended + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + }; + environment.systemPackages = [ pkgs.easyeffects ]; + + # TODO: can be done in a simpler way in 24.05, see wiki.nixos.org + environment.etc = { + "wireplumber/bluetooth.lua.d/51-bluez-config.lua".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 ]" + } + ''; + }; +} diff --git a/common/pulseaudio.nix b/common/pulseaudio.nix new file mode 100644 index 0000000..6ca211a --- /dev/null +++ b/common/pulseaudio.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: +{ + # Enable sound. + hardware.pulseaudio = { + enable = true; + package = pkgs.pulseaudioFull; + # decouple pulseaudio application and sink volumes + daemon.config = { + flat-volumes = "no"; + }; + # C3D2 hq music + zeroconf.discovery.enable = true; + zeroconf.publish.enable = true; + }; +} diff --git a/hosts/framenix/default.nix b/hosts/framenix/default.nix index 13c526d..de8c815 100644 --- a/hosts/framenix/default.nix +++ b/hosts/framenix/default.nix @@ -11,6 +11,7 @@ in { imports = [ ../../common + ../../common/pipewire.nix ./hardware-configuration.nix ./storage.nix @@ -26,7 +27,7 @@ in systemd.services.nix-daemon.environment.TMPDIR = "/var/tmp"; # try newer kernels - boot.kernelPackages = pkgs.linuxPackages_6_8; # FIXME: virtualbox not yet compatible with 6.9 + boot.kernelPackages = pkgs.linuxPackages_6_8; # FIXME: virtualbox not yet compatible with 6.9 boot.kernelParams = [ # powersave diff --git a/hosts/thinknix/default.nix b/hosts/thinknix/default.nix index a7344b4..518f8ce 100644 --- a/hosts/thinknix/default.nix +++ b/hosts/thinknix/default.nix @@ -7,6 +7,7 @@ { imports = [ ../../common + ../../common/pulseaudio.nix ./hardware-configuration.nix ./storage.nix