nixos/alsa: Do not make sound.enable conditional on stateVersion.

Eelco Dolstra wrote:

Hm, this is not really the intended use of stateVersion. From the description:

Every once in a while, a new NixOS release may change
configuration defaults in a way incompatible with stateful
data. For instance, if the default version of PostgreSQL
changes, the new version will probably be unable to read your
existing databases. To prevent such breakage, you can set the
value of this option to the NixOS release with which you want
to be compatible. The effect is that NixOS will option
defaults corresponding to the specified release (such as using
an older version of PostgreSQL).

So this is only intended for options that have some corresponding on-disk state. AFAICT this is not the case for sound. In any case stateVersion is a necessary evil that only exists because we can't just upgrade Postgres databases or change SSH host keys. It's not necessary for things like whether sound is enabled. (If the user discovers that sound is suddenly disabled, they can just enable it.)

I had some vague recollection that we also had a configVersion option setting to control the defaults for non-state-related options, but I can't find it so maybe it was only discussed.

+8 -12
+5 -5
nixos/doc/manual/release-notes/rl-1803.xml
··· 82 <itemizedlist> 83 <listitem> 84 <para> 85 Dollar signs in options under <option>services.postfix</option> are 86 passed verbatim to Postfix, which will interpret them as the beginning of 87 a parameter expression. This was already true for string-valued options ··· 209 For <literal>stateVersion = "17.09"</literal> or lower the old behavior is preserved. 210 </para> 211 <itemizedlist> 212 - <listitem> 213 - <para> 214 - <literal>sound.enable</literal> now defaults to false. 215 - </para> 216 - </listitem> 217 <listitem> 218 <para> 219 <literal>matrix-synapse</literal> uses postgresql by default instead of sqlite.
··· 82 <itemizedlist> 83 <listitem> 84 <para> 85 + <literal>sound.enable</literal> now defaults to false. 86 + </para> 87 + </listitem> 88 + <listitem> 89 + <para> 90 Dollar signs in options under <option>services.postfix</option> are 91 passed verbatim to Postfix, which will interpret them as the beginning of 92 a parameter expression. This was already true for string-valued options ··· 214 For <literal>stateVersion = "17.09"</literal> or lower the old behavior is preserved. 215 </para> 216 <itemizedlist> 217 <listitem> 218 <para> 219 <literal>matrix-synapse</literal> uses postgresql by default instead of sqlite.
+3 -7
nixos/modules/services/audio/alsa.nix
··· 21 22 enable = mkOption { 23 type = types.bool; 24 - defaultText = "!versionAtLeast system.stateVersion \"18.03\""; 25 description = '' 26 Whether to enable ALSA sound. 27 ''; ··· 78 79 ###### implementation 80 81 - config = mkMerge [ 82 - ({ 83 - sound.enable = mkDefault (!versionAtLeast config.system.stateVersion "18.03"); 84 - }) 85 - (mkIf config.sound.enable { 86 87 environment.systemPackages = [ alsaUtils ]; 88 ··· 128 ]; 129 }; 130 131 - })]; 132 133 }
··· 21 22 enable = mkOption { 23 type = types.bool; 24 + default = false; 25 description = '' 26 Whether to enable ALSA sound. 27 ''; ··· 78 79 ###### implementation 80 81 + config = mkIf config.sound.enable { 82 83 environment.systemPackages = [ alsaUtils ]; 84 ··· 124 ]; 125 }; 126 127 + }; 128 129 }