Skip to content

Commit

Permalink
nginx: fix compatibility with zlib-ng
Browse files Browse the repository at this point in the history
Fix #357522.
  • Loading branch information
fpletz committed Nov 26, 2024
1 parent 3ecd1ba commit 5ae0b27
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
18 changes: 16 additions & 2 deletions pkgs/servers/http/nginx/generic.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
outer@{ lib, stdenv, fetchurl, fetchpatch, openssl, zlib, pcre2, libxml2, libxslt
outer@{ lib, stdenv, fetchurl, fetchpatch, openssl, zlib-ng, pcre2, libxml2, libxslt
, nginx-doc

, nixosTests
Expand Down Expand Up @@ -66,7 +66,7 @@ stdenv.mkDerivation {
removeReferencesTo
] ++ nativeBuildInputs;

buildInputs = [ openssl zlib pcre2 libxml2 libxslt perl ]
buildInputs = [ openssl zlib-ng pcre2 libxml2 libxslt perl ]
++ buildInputs
++ mapModules "inputs"
++ lib.optional withGeoIP geoip
Expand Down Expand Up @@ -126,6 +126,13 @@ stdenv.mkDerivation {
env.NIX_CFLAGS_COMPILE = toString ([
"-I${libxml2.dev}/include/libxml2"
"-Wno-error=implicit-fallthrough"
(
# zlig-ng patch needs this
if stdenv.cc.isGNU then
"-Wno-error=discarded-qualifiers"
else
"-Wno-error=incompatible-pointer-types-discards-qualifiers"
)
] ++ lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "11") [
# fix build vts module on gcc11
"-Wno-error=stringop-overread"
Expand Down Expand Up @@ -155,6 +162,13 @@ stdenv.mkDerivation {
'';
})
./nix-skip-check-logs-path.patch
] ++ lib.optionals (pname != "openresty") [
# https://github.com/NixOS/nixpkgs/issues/357522
# https://github.com/zlib-ng/patches/blob/5a036c0a00120c75ee573b27f4f44ade80d82ff2/nginx/README.md
(fetchpatch {
url = "https://raw.githubusercontent.com/zlib-ng/patches/38756e6325a5d2cc32709b8e9549984c63a78815/nginx/1.26.2-zlib-ng.patch";
hash = "sha256-LX5kP6jFiqgt4ApKw5eqOAFJNkc5QI6kX8ZRvBYTi9k=";
})
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
(fetchpatch {
url = "https://raw.githubusercontent.com/openwrt/packages/c057dfb09c7027287c7862afab965a4cd95293a3/net/nginx/patches/102-sizeof_test_fix.patch";
Expand Down
6 changes: 1 addition & 5 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1610,15 +1610,13 @@ with pkgs;
android-tools = lowPrio (darwin.apple_sdk_11_0.callPackage ../tools/misc/android-tools { });

angie = callPackage ../servers/http/angie {
zlib = zlib-ng.override { withZlibCompat = true; };
withPerl = false;
# We don't use `with` statement here on purpose!
# See https://github.com/NixOS/nixpkgs/pull/10474#discussion_r42369334
modules = [ nginxModules.rtmp nginxModules.dav nginxModules.moreheaders ];
};

angieQuic = callPackage ../servers/http/angie {
zlib = zlib-ng.override { withZlibCompat = true; };
withPerl = false;
withQuic = true;
# We don't use `with` statement here on purpose!
Expand Down Expand Up @@ -11843,7 +11841,6 @@ with pkgs;
nginx = nginxStable;

nginxQuic = callPackage ../servers/http/nginx/quic.nix {
zlib = zlib-ng.override { withZlibCompat = true; };
withPerl = false;
# We don't use `with` statement here on purpose!
# See https://github.com/NixOS/nixpkgs/pull/10474#discussion_r42369334
Expand All @@ -11853,15 +11850,13 @@ with pkgs;
};

nginxStable = callPackage ../servers/http/nginx/stable.nix {
zlib = zlib-ng.override { withZlibCompat = true; };
withPerl = false;
# We don't use `with` statement here on purpose!
# See https://github.com/NixOS/nixpkgs/pull/10474#discussion_r42369334
modules = [ nginxModules.rtmp nginxModules.dav nginxModules.moreheaders ];
};

nginxMainline = callPackage ../servers/http/nginx/mainline.nix {
zlib = zlib-ng.override { withZlibCompat = true; };
withKTLS = true;
withPerl = false;
# We don't use `with` statement here on purpose!
Expand Down Expand Up @@ -11890,6 +11885,7 @@ with pkgs;
openafs = callPackage ../servers/openafs/1.8 { };

openresty = callPackage ../servers/http/openresty {
zlib-ng = zlib;
withPerl = false;
modules = [];
};
Expand Down

0 comments on commit 5ae0b27

Please sign in to comment.