summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorworldofpeace <worldofpeace@users.noreply.github.com>2019-01-27 14:24:12 -0500
committerworldofpeace <worldofpeace@users.noreply.github.com>2019-01-27 19:51:26 +0000
commitdc923b6ad15dd60f4d18e5a8e3f7f211bc0246ff (patch)
treec85f03c384e4ea07615a9039b6be3d381ddb3caa /nixos
parent022c0165c293fd74d908ce1355edf9e23de3fad3 (diff)
downloadnixpkgs-dc923b6ad15dd60f4d18e5a8e3f7f211bc0246ff.tar
nixpkgs-dc923b6ad15dd60f4d18e5a8e3f7f211bc0246ff.tar.gz
nixpkgs-dc923b6ad15dd60f4d18e5a8e3f7f211bc0246ff.tar.bz2
nixpkgs-dc923b6ad15dd60f4d18e5a8e3f7f211bc0246ff.tar.lz
nixpkgs-dc923b6ad15dd60f4d18e5a8e3f7f211bc0246ff.tar.xz
nixpkgs-dc923b6ad15dd60f4d18e5a8e3f7f211bc0246ff.tar.zst
nixpkgs-dc923b6ad15dd60f4d18e5a8e3f7f211bc0246ff.zip
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
Diffstat (limited to 'nixos')
-rw-r--r--nixos/doc/manual/release-notes/rl-1903.xml14
-rw-r--r--nixos/modules/config/pulseaudio.nix5
2 files changed, 18 insertions, 1 deletions
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 <literal>nixos-rebuild boot; reboot</literal>.
      </para>
    </listitem>
+   <listitem>
+    <para>
+      Flat volumes are now disabled by default in <literal>hardware.pulseaudio</literal>.
+      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.
+    </para>
+    <note>
+     <para>
+      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.
+     </para>
+    </note>
+   </listitem>
   </itemizedlist>
  </section>
 </section>
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 <literal>man pulse-daemon.conf</literal>.'';
-          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;