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