diff options
author | happysalada <raphael@megzari.com> | 2022-11-08 08:14:00 -0500 |
---|---|---|
committer | Yt <happysalada@proton.me> | 2022-11-08 10:30:10 -0500 |
commit | 2c5abd89c7e917acde9077fc4d12596e35b73e17 (patch) | |
tree | 2408545cd55c26fb6edf08dbea998d6305abc229 | |
parent | 0ea6f4c9749d9bc9c079b901279613b441103aa2 (diff) | |
download | nixpkgs-2c5abd89c7e917acde9077fc4d12596e35b73e17.tar nixpkgs-2c5abd89c7e917acde9077fc4d12596e35b73e17.tar.gz nixpkgs-2c5abd89c7e917acde9077fc4d12596e35b73e17.tar.bz2 nixpkgs-2c5abd89c7e917acde9077fc4d12596e35b73e17.tar.lz nixpkgs-2c5abd89c7e917acde9077fc4d12596e35b73e17.tar.xz nixpkgs-2c5abd89c7e917acde9077fc4d12596e35b73e17.tar.zst nixpkgs-2c5abd89c7e917acde9077fc4d12596e35b73e17.zip |
rmem_max: define merge function
-rw-r--r-- | nixos/doc/manual/from_md/release-notes/rl-2211.section.xml | 8 | ||||
-rw-r--r-- | nixos/doc/manual/release-notes/rl-2211.section.md | 2 | ||||
-rw-r--r-- | nixos/modules/config/sysctl.nix | 16 | ||||
-rw-r--r-- | nixos/modules/services/torrent/transmission.nix | 2 |
4 files changed, 26 insertions, 2 deletions
diff --git a/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml index 9600901537f..c53474144d2 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2211.section.xml @@ -1336,6 +1336,14 @@ 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> diff --git a/nixos/doc/manual/release-notes/rl-2211.section.md b/nixos/doc/manual/release-notes/rl-2211.section.md index b3495063f39..863bf95b55f 100644 --- a/nixos/doc/manual/release-notes/rl-2211.section.md +++ b/nixos/doc/manual/release-notes/rl-2211.section.md @@ -395,4 +395,6 @@ Available as [services.patroni](options.html#opt-services.patroni.enable). - 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. --> diff --git a/nixos/modules/config/sysctl.nix b/nixos/modules/config/sysctl.nix index b4b2d0452c4..4346c88f768 100644 --- a/nixos/modules/config/sysctl.nix +++ b/nixos/modules/config/sysctl.nix @@ -21,11 +21,24 @@ in 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; } ''; - type = types.attrsOf sysctlOption; description = lib.mdDoc '' Runtime parameters of the Linux kernel, as set by {manpage}`sysctl(8)`. Note that sysctl @@ -35,6 +48,7 @@ in parameter may be a string, integer, boolean, or null (signifying the option will not appear at all). ''; + }; }; diff --git a/nixos/modules/services/torrent/transmission.nix b/nixos/modules/services/torrent/transmission.nix index 5e0d13211bc..9b53f5de143 100644 --- a/nixos/modules/services/torrent/transmission.nix +++ b/nixos/modules/services/torrent/transmission.nix @@ -431,7 +431,7 @@ in # 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.rmem_max" = mkDefault 4194304; # 4MB "net.core.wmem_max" = mkDefault "1048576"; # 1MB }) (mkIf cfg.performanceNetParameters { |