Skip to content

Commit 73b3a14

Browse files
authored
Merge pull request #274110 from networkException/sysctl-net.core.wmem_max
nixos/{sysctl,caddy}: improvements for net.core.wmem_max
2 parents 9c33df0 + 968905a commit 73b3a14

File tree

4 files changed

+21
-10
lines changed

4 files changed

+21
-10
lines changed

nixos/doc/manual/release-notes/rl-2405.section.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m
7171
`globalRedirect` can now have redirect codes other than 301 through
7272
`redirectCode`.
7373

74+
- [](#opt-boot.kernel.sysctl._net.core.wmem_max_) changed from a string to an integer because of the addition of a custom merge option (taking the highest value defined to avoid conflicts between 2 services trying to set that value), just as [](#opt-boot.kernel.sysctl._net.core.rmem_max_) since 22.11.
75+
7476
- Gitea 1.21 upgrade has several breaking changes, including:
7577
- Custom themes and other assets that were previously stored in `custom/public/*` now belong in `custom/public/assets/*`
7678
- New instances of Gitea using MySQL now ignore the `[database].CHARSET` config option and always use the `utf8mb4` charset, existing instances should migrate via the `gitea doctor convert` CLI command.

nixos/modules/config/sysctl.nix

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,27 @@ in
2121
options = {
2222

2323
boot.kernel.sysctl = mkOption {
24-
type = types.submodule {
24+
type = let
25+
highestValueType = types.ints.unsigned // {
26+
merge = loc: defs:
27+
foldl
28+
(a: b: if b.value == null then null else lib.max a b.value)
29+
0
30+
(filterOverrides defs);
31+
};
32+
in types.submodule {
2533
freeformType = types.attrsOf sysctlOption;
2634
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-
};
35+
type = types.nullOr highestValueType;
3436
default = null;
3537
description = lib.mdDoc "The maximum socket receive buffer size. In case of conflicting values, the highest will be used.";
3638
};
39+
40+
options."net.core.wmem_max" = mkOption {
41+
type = types.nullOr highestValueType;
42+
default = null;
43+
description = lib.mdDoc "The maximum socket send buffer size. In case of conflicting values, the highest will be used.";
44+
};
3745
};
3846
default = {};
3947
example = literalExpression ''

nixos/modules/services/torrent/transmission.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ in
434434
# at least up to the values hardcoded here:
435435
(mkIf cfg.settings.utp-enabled {
436436
"net.core.rmem_max" = mkDefault 4194304; # 4MB
437-
"net.core.wmem_max" = mkDefault "1048576"; # 1MB
437+
"net.core.wmem_max" = mkDefault 1048576; # 1MB
438438
})
439439
(mkIf cfg.performanceNetParameters {
440440
# Increase the number of available source (local) TCP and UDP ports to 49151.

nixos/modules/services/web-servers/caddy/default.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,9 @@ in
342342
}
343343
'';
344344

345-
# https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size
345+
# https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes
346346
boot.kernel.sysctl."net.core.rmem_max" = mkDefault 2500000;
347+
boot.kernel.sysctl."net.core.wmem_max" = mkDefault 2500000;
347348

348349
systemd.packages = [ cfg.package ];
349350
systemd.services.caddy = {

0 commit comments

Comments
 (0)