diff options
author | Naïm Favier <n@monade.li> | 2022-12-14 12:36:30 +0100 |
---|---|---|
committer | Sandro Jäckel <sandro.jaeckel@gmail.com> | 2022-12-16 01:57:14 +0100 |
commit | 6c61c436cf8f9e5f03fc40facbbdb0bf16034b78 (patch) | |
tree | 8df1179666e0c7f0116104b5ecccc7ec60ee9d96 /pkgs/servers/http/nginx/generic.nix | |
parent | 84575b0bd882be979516f4fecfe4d7c8de8f6a92 (diff) |
nginx: detect duplicate modules
Nginx breaks at runtime when duplicate modules are added. To detect this, add a `name` key to all modules. Also remove the outdated modsecurity v2 module and unify `modsecurity` and `modsecurity-nginx`.
Diffstat (limited to 'pkgs/servers/http/nginx/generic.nix')
-rw-r--r-- | pkgs/servers/http/nginx/generic.nix | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pkgs/servers/http/nginx/generic.nix b/pkgs/servers/http/nginx/generic.nix index c4fe7f8920512..a18b771aa1c37 100644 --- a/pkgs/servers/http/nginx/generic.nix +++ b/pkgs/servers/http/nginx/generic.nix @@ -32,6 +32,9 @@ with lib; let + moduleNames = map (mod: mod.name or (throw "The nginx module with source ${toString mod.src} does not have a `name` attribute. This prevents duplicate module detection and is no longer supported.")) + modules; + mapModules = attrPath: flip concatMap modules (mod: let supports = mod.supports or (_: true); @@ -41,6 +44,9 @@ let in +assert assertMsg (unique moduleNames == moduleNames) + "nginx: duplicate modules: ${concatStringsSep ", " moduleNames}. A common cause for this is that services.nginx.additionalModules adds a module which the nixos module itself already adds."; + stdenv.mkDerivation { inherit pname; inherit version; |