rmem_max: define merge function

Changed files
+26 -2
nixos
doc
manual
from_md
release-notes
release-notes
modules
config
services
+8
nixos/doc/manual/from_md/release-notes/rl-2211.section.xml
···
the npm install step prunes dev dependencies.
</para>
</listitem>
</itemizedlist>
</section>
</section>
···
the npm install step prunes dev dependencies.
</para>
</listitem>
+
<listitem>
+
<para>
+
boot.kernel.sysctl is defined as a freeformType and adds a
+
custom merge option for <quote>net.core.rmem_max</quote>
+
(taking the highest value defined to avoid conflicts between 2
+
services trying to set that value)
+
</para>
+
</listitem>
</itemizedlist>
</section>
</section>
+2
nixos/doc/manual/release-notes/rl-2211.section.md
···
- The `nodePackages` package set now defaults to the LTS release in the `nodejs` package again, instead of being pinned to `nodejs-14_x`. Several updates to node2nix have been made for compatibility with newer Node.js and npm versions and a new `postRebuild` hook has been added for packages to perform extra build steps before the npm install step prunes dev dependencies.
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
···
- The `nodePackages` package set now defaults to the LTS release in the `nodejs` package again, instead of being pinned to `nodejs-14_x`. Several updates to node2nix have been made for compatibility with newer Node.js and npm versions and a new `postRebuild` hook has been added for packages to perform extra build steps before the npm install step prunes dev dependencies.
+
- boot.kernel.sysctl is defined as a freeformType and adds a custom merge option for "net.core.rmem_max" (taking the highest value defined to avoid conflicts between 2 services trying to set that value)
+
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
+15 -1
nixos/modules/config/sysctl.nix
···
options = {
boot.kernel.sysctl = mkOption {
default = {};
example = literalExpression ''
{ "net.ipv4.tcp_syncookies" = false; "vm.swappiness" = 60; }
'';
-
type = types.attrsOf sysctlOption;
description = lib.mdDoc ''
Runtime parameters of the Linux kernel, as set by
{manpage}`sysctl(8)`. Note that sysctl
···
parameter may be a string, integer, boolean, or null
(signifying the option will not appear at all).
'';
};
};
···
options = {
boot.kernel.sysctl = mkOption {
+
type = types.submodule {
+
freeformType = types.attrsOf sysctlOption;
+
options."net.core.rmem_max" = mkOption {
+
type = types.nullOr types.ints.unsigned // {
+
merge = loc: defs:
+
foldl
+
(a: b: if b.value == null then null else lib.max a b.value)
+
0
+
(filterOverrides defs);
+
};
+
default = null;
+
description = lib.mdDoc "The maximum socket receive buffer size. In case of conflicting values, the highest will be used.";
+
};
+
};
default = {};
example = literalExpression ''
{ "net.ipv4.tcp_syncookies" = false; "vm.swappiness" = 60; }
'';
description = lib.mdDoc ''
Runtime parameters of the Linux kernel, as set by
{manpage}`sysctl(8)`. Note that sysctl
···
parameter may be a string, integer, boolean, or null
(signifying the option will not appear at all).
'';
+
};
};
+1 -1
nixos/modules/services/torrent/transmission.nix
···
# https://trac.transmissionbt.com/browser/trunk/libtransmission/tr-udp.c?rev=11956.
# at least up to the values hardcoded here:
(mkIf cfg.settings.utp-enabled {
-
"net.core.rmem_max" = mkDefault "4194304"; # 4MB
"net.core.wmem_max" = mkDefault "1048576"; # 1MB
})
(mkIf cfg.performanceNetParameters {
···
# https://trac.transmissionbt.com/browser/trunk/libtransmission/tr-udp.c?rev=11956.
# at least up to the values hardcoded here:
(mkIf cfg.settings.utp-enabled {
+
"net.core.rmem_max" = mkDefault 4194304; # 4MB
"net.core.wmem_max" = mkDefault "1048576"; # 1MB
})
(mkIf cfg.performanceNetParameters {