From dc923b6ad15dd60f4d18e5a8e3f7f211bc0246ff Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Sun, 27 Jan 2019 14:24:12 -0500 Subject: [PATCH] nixos/pulseaudio: disable flat-volumes by default The motivation for this is that some applications are unaware of this feature and can set their volume to 100% on startup harming people ears and possiblly blowing someone's audio setup. I noticed this in #54594 and by extension epiphany[0]. Please also note that many other distros have this default for the reason outlined above. Closes #5632 #54594 [0]: https://bugzilla.gnome.org/show_bug.cgi?id=675217 --- nixos/doc/manual/release-notes/rl-1903.xml | 14 ++++++++++++++ nixos/modules/config/pulseaudio.nix | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/nixos/doc/manual/release-notes/rl-1903.xml b/nixos/doc/manual/release-notes/rl-1903.xml index da3b75cf614..e9f031054c7 100644 --- a/nixos/doc/manual/release-notes/rl-1903.xml +++ b/nixos/doc/manual/release-notes/rl-1903.xml @@ -423,6 +423,20 @@ use nixos-rebuild boot; reboot. + + + Flat volumes are now disabled by default in hardware.pulseaudio. + This has been done to prevent applications, which are unaware of this feature, setting + their volumes to 100% on startup causing harm to your audio hardware and potentially your ears. + + + + With this change application specific volumes are relative to the master volume which can be + adjusted independently, whereas before they were absolute; meaning that in effect, it scaled the + device-volume with the volume of the loudest application. + + + diff --git a/nixos/modules/config/pulseaudio.nix b/nixos/modules/config/pulseaudio.nix index 67f7105fe2f..e61a3a73120 100644 --- a/nixos/modules/config/pulseaudio.nix +++ b/nixos/modules/config/pulseaudio.nix @@ -180,7 +180,7 @@ in { type = types.attrsOf types.unspecified; default = {}; description = ''Config of the pulse daemon. See man pulse-daemon.conf.''; - example = literalExample ''{ flat-volumes = "no"; }''; + example = literalExample ''{ realtime-scheduling = "yes"; }''; }; }; @@ -242,6 +242,9 @@ in { source = writeText "libao.conf" "default_driver=pulse"; } ]; + # Disable flat volumes to enable relative ones + hardware.pulseaudio.daemon.config.flat-volumes = mkDefault "no"; + # Allow PulseAudio to get realtime priority using rtkit. security.rtkit.enable = true;