rmem_max: define merge function

authored by happysalada and committed by Yt 2c5abd89 0ea6f4c9

+26 -2
+8
nixos/doc/manual/from_md/release-notes/rl-2211.section.xml
··· 1336 1336 the npm install step prunes dev dependencies. 1337 1337 </para> 1338 1338 </listitem> 1339 + <listitem> 1340 + <para> 1341 + boot.kernel.sysctl is defined as a freeformType and adds a 1342 + custom merge option for <quote>net.core.rmem_max</quote> 1343 + (taking the highest value defined to avoid conflicts between 2 1344 + services trying to set that value) 1345 + </para> 1346 + </listitem> 1339 1347 </itemizedlist> 1340 1348 </section> 1341 1349 </section>
+2
nixos/doc/manual/release-notes/rl-2211.section.md
··· 395 395 396 396 - 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. 397 397 398 + - 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) 399 + 398 400 <!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
+15 -1
nixos/modules/config/sysctl.nix
··· 21 21 options = { 22 22 23 23 boot.kernel.sysctl = mkOption { 24 + type = types.submodule { 25 + freeformType = types.attrsOf sysctlOption; 26 + options."net.core.rmem_max" = mkOption { 27 + type = types.nullOr types.ints.unsigned // { 28 + merge = loc: defs: 29 + foldl 30 + (a: b: if b.value == null then null else lib.max a b.value) 31 + 0 32 + (filterOverrides defs); 33 + }; 34 + default = null; 35 + description = lib.mdDoc "The maximum socket receive buffer size. In case of conflicting values, the highest will be used."; 36 + }; 37 + }; 24 38 default = {}; 25 39 example = literalExpression '' 26 40 { "net.ipv4.tcp_syncookies" = false; "vm.swappiness" = 60; } 27 41 ''; 28 - type = types.attrsOf sysctlOption; 29 42 description = lib.mdDoc '' 30 43 Runtime parameters of the Linux kernel, as set by 31 44 {manpage}`sysctl(8)`. Note that sysctl ··· 35 48 parameter may be a string, integer, boolean, or null 36 49 (signifying the option will not appear at all). 37 50 ''; 51 + 38 52 }; 39 53 40 54 };
+1 -1
nixos/modules/services/torrent/transmission.nix
··· 431 431 # https://trac.transmissionbt.com/browser/trunk/libtransmission/tr-udp.c?rev=11956. 432 432 # at least up to the values hardcoded here: 433 433 (mkIf cfg.settings.utp-enabled { 434 - "net.core.rmem_max" = mkDefault "4194304"; # 4MB 434 + "net.core.rmem_max" = mkDefault 4194304; # 4MB 435 435 "net.core.wmem_max" = mkDefault "1048576"; # 1MB 436 436 }) 437 437 (mkIf cfg.performanceNetParameters {