Merge pull request #215150 from SuperSandro2000/nginx-with-lib

nginx: remove with lib over entire file

authored by Sandro and committed by GitHub a68a8869 86ab9718

+19 -21
+19 -21
pkgs/servers/http/nginx/generic.nix
··· 31 , passthru ? { tests = {}; } 32 }: 33 34 - with lib; 35 - 36 let 37 38 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.")) 39 modules; 40 41 - mapModules = attrPath: flip concatMap modules 42 (mod: 43 let supports = mod.supports or (_: true); 44 in ··· 47 48 in 49 50 - assert assertMsg (unique moduleNames == moduleNames) 51 - "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."; 52 53 stdenv.mkDerivation { 54 inherit pname version nginxVersion; ··· 94 "--http-fastcgi-temp-path=/tmp/nginx_fastcgi" 95 "--http-uwsgi-temp-path=/tmp/nginx_uwsgi" 96 "--http-scgi-temp-path=/tmp/nginx_scgi" 97 - ] ++ optionals withDebug [ 98 "--with-debug" 99 - ] ++ optionals withKTLS [ 100 "--with-openssl-opt=enable-ktls" 101 - ] ++ optionals withStream [ 102 "--with-stream" 103 "--with-stream_realip_module" 104 "--with-stream_ssl_module" 105 "--with-stream_ssl_preread_module" 106 - ] ++ optionals withMail [ 107 "--with-mail" 108 "--with-mail_ssl_module" 109 - ] ++ optionals withPerl [ 110 "--with-http_perl_module" 111 "--with-perl=${perl}/bin/perl" 112 "--with-perl_modules_path=lib/perl5" 113 - ] ++ optional withSlice "--with-http_slice_module" 114 - ++ optional (gd != null) "--with-http_image_filter_module" 115 - ++ optional (geoip != null) "--with-http_geoip_module" 116 - ++ optional (withStream && geoip != null) "--with-stream_geoip_module" 117 - ++ optional (with stdenv.hostPlatform; isLinux || isFreeBSD) "--with-file-aio" 118 ++ configureFlags 119 ++ map (mod: "--add-module=${mod.src}") modules; 120 121 NIX_CFLAGS_COMPILE = toString ([ 122 "-I${libxml2.dev}/include/libxml2" 123 "-Wno-error=implicit-fallthrough" 124 - ] ++ optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "11") [ 125 # fix build vts module on gcc11 126 "-Wno-error=stringop-overread" 127 - ] ++ optional stdenv.isDarwin "-Wno-error=deprecated-declarations"); 128 129 configurePlatforms = []; 130 ··· 133 preConfigure = '' 134 setOutputFlags= 135 '' + preConfigure 136 - + concatMapStringsSep "\n" (mod: mod.preConfigure or "") modules; 137 138 patches = map fixPatch ([ 139 (substituteAll { ··· 143 ''; 144 }) 145 ./nix-skip-check-logs-path.patch 146 - ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 147 (fetchpatch { 148 url = "https://raw.githubusercontent.com/openwrt/packages/c057dfb09c7027287c7862afab965a4cd95293a3/net/nginx/patches/102-sizeof_test_fix.patch"; 149 sha256 = "0i2k30ac8d7inj9l6bl0684kjglam2f68z8lf3xggcc2i5wzhh8a"; ··· 161 162 inherit postPatch; 163 164 - hardeningEnable = optional (!stdenv.isDarwin) "pie"; 165 166 enableParallelBuilding = true; 167 ··· 186 } // passthru.tests; 187 }; 188 189 - meta = if meta != null then meta else { 190 description = "A reverse proxy and lightweight webserver"; 191 homepage = "http://nginx.org"; 192 license = licenses.bsd2;
··· 31 , passthru ? { tests = {}; } 32 }: 33 34 let 35 36 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.")) 37 modules; 38 39 + mapModules = attrPath: lib.flip lib.concatMap modules 40 (mod: 41 let supports = mod.supports or (_: true); 42 in ··· 45 46 in 47 48 + assert lib.assertMsg (lib.unique moduleNames == moduleNames) 49 + "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."; 50 51 stdenv.mkDerivation { 52 inherit pname version nginxVersion; ··· 92 "--http-fastcgi-temp-path=/tmp/nginx_fastcgi" 93 "--http-uwsgi-temp-path=/tmp/nginx_uwsgi" 94 "--http-scgi-temp-path=/tmp/nginx_scgi" 95 + ] ++ lib.optionals withDebug [ 96 "--with-debug" 97 + ] ++ lib.optionals withKTLS [ 98 "--with-openssl-opt=enable-ktls" 99 + ] ++ lib.optionals withStream [ 100 "--with-stream" 101 "--with-stream_realip_module" 102 "--with-stream_ssl_module" 103 "--with-stream_ssl_preread_module" 104 + ] ++ lib.optionals withMail [ 105 "--with-mail" 106 "--with-mail_ssl_module" 107 + ] ++ lib.optionals withPerl [ 108 "--with-http_perl_module" 109 "--with-perl=${perl}/bin/perl" 110 "--with-perl_modules_path=lib/perl5" 111 + ] ++ lib.optional withSlice "--with-http_slice_module" 112 + ++ lib.optional (gd != null) "--with-http_image_filter_module" 113 + ++ lib.optional (geoip != null) "--with-http_geoip_module" 114 + ++ lib.optional (withStream && geoip != null) "--with-stream_geoip_module" 115 + ++ lib.optional (with stdenv.hostPlatform; isLinux || isFreeBSD) "--with-file-aio" 116 ++ configureFlags 117 ++ map (mod: "--add-module=${mod.src}") modules; 118 119 NIX_CFLAGS_COMPILE = toString ([ 120 "-I${libxml2.dev}/include/libxml2" 121 "-Wno-error=implicit-fallthrough" 122 + ] ++ lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "11") [ 123 # fix build vts module on gcc11 124 "-Wno-error=stringop-overread" 125 + ] ++ lib.optional stdenv.isDarwin "-Wno-error=deprecated-declarations"); 126 127 configurePlatforms = []; 128 ··· 131 preConfigure = '' 132 setOutputFlags= 133 '' + preConfigure 134 + + lib.concatMapStringsSep "\n" (mod: mod.preConfigure or "") modules; 135 136 patches = map fixPatch ([ 137 (substituteAll { ··· 141 ''; 142 }) 143 ./nix-skip-check-logs-path.patch 144 + ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ 145 (fetchpatch { 146 url = "https://raw.githubusercontent.com/openwrt/packages/c057dfb09c7027287c7862afab965a4cd95293a3/net/nginx/patches/102-sizeof_test_fix.patch"; 147 sha256 = "0i2k30ac8d7inj9l6bl0684kjglam2f68z8lf3xggcc2i5wzhh8a"; ··· 159 160 inherit postPatch; 161 162 + hardeningEnable = lib.optional (!stdenv.isDarwin) "pie"; 163 164 enableParallelBuilding = true; 165 ··· 184 } // passthru.tests; 185 }; 186 187 + meta = if meta != null then meta else with lib; { 188 description = "A reverse proxy and lightweight webserver"; 189 homepage = "http://nginx.org"; 190 license = licenses.bsd2;