diff --git a/pkgs/servers/http/nginx/generic.nix b/pkgs/servers/http/nginx/generic.nix index fa7864886dc..12b873df6a4 100644 --- a/pkgs/servers/http/nginx/generic.nix +++ b/pkgs/servers/http/nginx/generic.nix @@ -1,5 +1,5 @@ { stdenv, fetchurl, fetchpatch, openssl, zlib, pcre, libxml2, libxslt -, gd, geoip +, substituteAll, gd, geoip , withDebug ? false , withStream ? true , withMail ? false @@ -75,9 +75,12 @@ stdenv.mkDerivation { preConfigure = (concatMapStringsSep "\n" (mod: mod.preConfigure or "") modules); - patches = [ - ./nix-etag-1.15.4.patch - ] ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + patches = stdenv.lib.singleton (substituteAll { + src = ./nix-etag-1.15.4.patch; + preInstall = '' + export nixStoreDir="$NIX_STORE" nixStoreDirLen="''${#NIX_STORE}" + ''; + }) ++ stdenv.lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ (fetchpatch { url = "https://raw.githubusercontent.com/openwrt/packages/master/net/nginx/patches/102-sizeof_test_fix.patch"; sha256 = "0i2k30ac8d7inj9l6bl0684kjglam2f68z8lf3xggcc2i5wzhh8a"; diff --git a/pkgs/servers/http/nginx/nix-etag-1.15.4.patch b/pkgs/servers/http/nginx/nix-etag-1.15.4.patch index 1a8dcb4303a..9dec715bf6c 100644 --- a/pkgs/servers/http/nginx/nix-etag-1.15.4.patch +++ b/pkgs/servers/http/nginx/nix-etag-1.15.4.patch @@ -36,8 +36,8 @@ index c57ec00c..b7992de2 100644 - r->headers_out.last_modified_time, - r->headers_out.content_length_n) - - etag->value.data; -+ #define NIX_STORE_DIR "/nix/store" -+ #define NIX_STORE_LEN ngx_strlen(NIX_STORE_DIR) ++ #define NIX_STORE_DIR "@nixStoreDir@" ++ #define NIX_STORE_LEN @nixStoreDirLen@ + + if (r->headers_out.last_modified_time == 1 + && !ngx_strncmp(real, NIX_STORE_DIR, NIX_STORE_LEN)