From 315b3cde54ae09e66c46a0c645bcf1a5cc1acfcd Mon Sep 17 00:00:00 2001 From: Ilan Joselevich Date: Mon, 21 Sep 2026 14:49:16 +0200 Subject: [PATCH] nginx: let modules override the nginx derivation A module that brings cmake needs dontUseCmakeConfigure set on nginx, which the existing per-module attributes can't express. Assisted-by: Claude:claude-fable-5-1 --- pkgs/servers/http/nginx/generic.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/servers/http/nginx/generic.nix b/pkgs/servers/http/nginx/generic.nix index 91617bc154f5..5e95c49d927e 100644 --- a/pkgs/servers/http/nginx/generic.nix +++ b/pkgs/servers/http/nginx/generic.nix @@ -68,12 +68,19 @@ let throw "Module ${mod.name} does not support nginx version ${nginxVersion}!" ); + # Modules can adjust the nginx derivation through passthru.forNginx. + mkDerivation = + args: + lib.foldl (drv: mod: drv.overrideAttrs mod.forNginx) (stdenv.mkDerivation args) ( + lib.filter (mod: mod ? forNginx) modules + ); + in assert lib.assertMsg (lib.unique moduleNames == moduleNames) "nginx: duplicate modules: ${lib.concatStringsSep ", " moduleNames}. A common cause for this is that services.nginx.additionalModules adds a module which the nixos module itself already adds."; -stdenv.mkDerivation { +mkDerivation { inherit pname version nginxVersion; outputs = [