nixpkgs/pkgs/servers/http/nginx
Christoph Heiss b3eca67865
nixos/openresty: fix build with nginx modules (#362348)
When adding modules to openresty, by either

- using `.override { modules = [ ..]; }` directly
- adding them to `services.nginx.additionalModules` or
- enabling e.g. something like `services.nginx.recommendedZstdSettings`

the build will then fail, as the actual `nginx` binary lands in
`nginx/bin/nginx` for openresty, and is only symlinked to `bin/nginx`
(and `bin/openresty`, for that matter).

This breaks the post-install script for nginx when removing references
to the aforementioned modules, since `remove-references-to` skips
symlinks. Thus, just read the symlink before in this case.

`readlink -fn` will read the symlink if it is one, otherwise just
returns the path itself.

The phase is also moved after the package-specific postInstall phase, at
that might move binaries around or create symlinks - as is the case for
openresty.

Can be easily reproduced using e.g.:

$ nix build --impure -E 'with import ./. {}; openresty.override { modules = [ nginxModules.zstd ]; }' -L

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
2024-12-06 20:15:26 +02:00
..
generic.nix nixos/openresty: fix build with nginx modules (#362348) 2024-12-06 20:15:26 +02:00
mainline.nix nginxMainline: 1.27.1 -> 1.27.2 2024-10-09 06:42:21 +01:00
modules.nix nginxModules.subsFilter: 2022-01-24 (#359905) 2024-11-29 06:45:48 +01:00
nix-etag-1.15.4.patch
nix-skip-check-logs-path.patch
quic.nix
stable.nix nginx: 1.26.1 -> 1.26.2 2024-08-15 19:53:39 +02:00