Skip to content

Commit fce41e5

Browse files
Merge pull request #278 from NuschtOS/nginx-commonServerConfig
nginx: fix commonServerConfig
2 parents 457cb20 + 89c7fc6 commit fce41e5

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

modules/nginx.nix

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ in
77
options.services.nginx = {
88
allRecommendOptions = libS.mkOpinionatedOption "set all upstream options starting with `recommended`";
99

10+
commonServerConfig = lib.mkOption {
11+
type = lib.types.lines;
12+
default = "";
13+
description = "Shared configuration snipped added to every virtualHosts' extraConfig.";
14+
};
15+
1016
configureQuic = lib.mkEnableOption "quic support in nginx";
1117

1218
default404Server = {
@@ -66,16 +72,19 @@ in
6672
options.extraConfig = lib.mkOption { };
6773
config.extraConfig = lib.optionalString cfg.hstsHeader.enable /* nginx */ ''
6874
more_set_headers "Strict-Transport-Security: max-age=63072000; ${lib.optionalString cfg.hstsHeader.includeSubDomains "includeSubDomains; "}preload";
69-
'' + cfgv.commonLocationsConfig;
75+
'' + cfg.commonServerConfig + cfgv.commonLocationsConfig;
7076
});
7177
};
7278
};
79+
80+
config = {
81+
extraConfig = cfg.commonServerConfig;
82+
};
7383
}));
7484
};
7585
};
7686

7787
imports = [
78-
(lib.mkRemovedOptionModule [ "services" "nginx" "commonServerConfig" ] "commonServerConfig has been broken for almost 2 years and wasn't noticed. It was functional equal to commonLocationsConfig, so that option should probably be used instead.")
7988
(lib.mkRemovedOptionModule [ "services" "nginx" "compileWithAWSlc" ] "aws-lc support has been removed as recommendedTlsSettings on NixOS 25.11 is not compatible with it.")
8089
(lib.mkRemovedOptionModule [ "services" "nginx" "generateDhparams" ] "Self generating dhparams is not recommended and no longer necessary since TLS 1.2.")
8190
(lib.mkRenamedOptionModule [ "services" "nginx" "allCompression" ] [ "services" "nginx" "allRecommendOptions" ])

0 commit comments

Comments
 (0)