Merge pull request #213874 from SuperSandro2000/nginx-zstd

nixos/nginx: add recommendedZstdSettings

Sandro 995f9d1c 5a544b5b

Changed files
+35 -2
nixos
modules
services
web-servers
nginx
pkgs
servers
http
nginx
+21 -2
nixos/modules/services/web-servers/nginx/default.nix
···
brotli_types ${lib.concatStringsSep " " compressMimeTypes};
''}
-
# https://docs.nginx.com/nginx/admin-guide/web-server/compression/
${optionalString cfg.recommendedGzipSettings ''
+
# https://docs.nginx.com/nginx/admin-guide/web-server/compression/
gzip on;
gzip_static on;
gzip_vary on;
···
gzip_min_length 256;
gzip_proxied expired no-cache no-store private auth;
gzip_types ${lib.concatStringsSep " " compressMimeTypes};
+
''}
+
+
${optionalString cfg.recommendedZstdSettings ''
+
zstd on;
+
zstd_comp_level 9;
+
zstd_min_length 256;
+
zstd_static on;
+
zstd_types ${lib.concatStringsSep " " compressMimeTypes};
''}
${optionalString cfg.recommendedProxySettings ''
···
type = types.bool;
description = lib.mdDoc ''
Whether to enable recommended proxy settings if a vhost does not specify the option manually.
+
'';
+
};
+
+
recommendedZstdSettings = mkOption {
+
default = false;
+
type = types.bool;
+
description = lib.mdDoc ''
+
Enable recommended zstd settings. Learn more about compression in Zstd format [here](https://github.com/tokers/zstd-nginx-module).
+
+
This adds `pkgs.nginxModules.zstd` to `services.nginx.additionalModules`.
'';
};
···
groups = config.users.groups;
}) dependentCertNames;
-
services.nginx.additionalModules = optional cfg.recommendedBrotliSettings pkgs.nginxModules.brotli;
+
services.nginx.additionalModules = optional cfg.recommendedBrotliSettings pkgs.nginxModules.brotli
+
++ lib.optional cfg.recommendedZstdSettings pkgs.nginxModules.zstd;
systemd.services.nginx = {
description = "Nginx Web Server";
+14
pkgs/servers/http/nginx/modules.nix
···
, which
, yajl
, zlib
+
, zstd
}:
let
···
rev = "v0.2.1";
sha256 = "sha256-x4ry5ljPeJQY+7Mp04/xYIGf22d6Nee7CSqHezdK4gQ=";
};
+
};
+
+
zstd = {
+
name = "zstd";
+
src = fetchFromGitHub {
+
name = "zstd";
+
owner = "tokers";
+
repo = "zstd-nginx-module";
+
rev = "25d88c262be47462cf90015ee7ebf6317b6848f9";
+
sha256 = "sha256-YRluKekhx1tb6e5IL1FPK05jPtzfQPaHI47cdada928=";
+
};
+
+
inputs = [ zstd ];
};
}; in self // lib.optionalAttrs config.allowAliases {
# deprecated or renamed packages