Merge pull request #2976 from bluescreen303/nginx

nginx: fix group, statedir permissions, add echo module, fix aio

lethalman 219e9925 6025caa9

+24 -13
+2 -3
nixos/modules/services/web-servers/nginx/default.nix
··· 84 84 }; 85 85 86 86 config = mkIf cfg.enable { 87 - environment.systemPackages = [ nginx ]; 88 - 89 87 # TODO: test user supplied config file pases syntax test 90 88 91 89 systemd.services.nginx = { ··· 96 94 preStart = 97 95 '' 98 96 mkdir -p ${cfg.stateDir}/logs 97 + chmod 700 ${cfg.stateDir} 99 98 chown -R ${cfg.user}:${cfg.group} ${cfg.stateDir} 100 99 ''; 101 100 serviceConfig = { ··· 105 104 106 105 users.extraUsers = optionalAttrs (cfg.user == "nginx") (singleton 107 106 { name = "nginx"; 108 - group = "nginx"; 107 + group = cfg.group; 109 108 uid = config.ids.uids.nginx; 110 109 }); 111 110
+22 -10
pkgs/servers/http/nginx/default.nix
··· 3 3 , rtmp ? false 4 4 , fullWebDAV ? false 5 5 , syslog ? false 6 - , moreheaders ? false}: 6 + , moreheaders ? false 7 + , echo ? false }: 8 + 9 + with stdenv.lib; 7 10 8 11 let 9 12 version = "1.6.0"; ··· 35 38 rev = "0c6e05d3125a97892a250e9ba8b7674163ba500b"; 36 39 sha256 = "e121d97fd3c81c64e6cbf6902bbcbdb01be9ac985c6832d40434379d5e998eaf"; 37 40 }; 41 + 42 + echo-ext = fetchgit { 43 + url = https://github.com/openresty/echo-nginx-module.git; 44 + rev = "refs/tags/v0.53"; 45 + sha256 = "90d4e3a49c678019f4f335bc18529aa108fcc9cfe0747ea4e2f6084a70da2868"; 46 + }; 38 47 in 39 48 40 49 stdenv.mkDerivation rec { ··· 43 52 44 53 buildInputs = 45 54 [ openssl zlib pcre libxml2 libxslt gd geoip 46 - ] ++ stdenv.lib.optional fullWebDAV expat; 55 + ] ++ optional fullWebDAV expat; 47 56 48 57 patches = if syslog then [ "${syslog-ext}/syslog-1.5.6.patch" ] else []; 49 58 ··· 69 78 "--with-ipv6" 70 79 # Install destination problems 71 80 # "--with-http_perl_module" 72 - ] ++ stdenv.lib.optional rtmp "--add-module=${rtmp-ext}" 73 - ++ stdenv.lib.optional fullWebDAV "--add-module=${dav-ext}" 74 - ++ stdenv.lib.optional syslog "--add-module=${syslog-ext}" 75 - ++ stdenv.lib.optional moreheaders "--add-module=${moreheaders-ext}"; 81 + ] ++ optional rtmp "--add-module=${rtmp-ext}" 82 + ++ optional fullWebDAV "--add-module=${dav-ext}" 83 + ++ optional syslog "--add-module=${syslog-ext}" 84 + ++ optional moreheaders "--add-module=${moreheaders-ext}" 85 + ++ optional echo "--add-module=${echo-ext}" 86 + ++ optional (elem stdenv.system (with platforms; linux ++ freebsd)) "--with-file-aio"; 87 + 76 88 77 - additionalFlags = stdenv.lib.optionalString stdenv.isDarwin "-Wno-error=deprecated-declarations"; 89 + additionalFlags = optionalString stdenv.isDarwin "-Wno-error=deprecated-declarations"; 78 90 79 91 preConfigure = '' 80 92 export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${libxml2}/include/libxml2 $additionalFlags" ··· 87 99 meta = { 88 100 description = "A reverse proxy and lightweight webserver"; 89 101 homepage = http://nginx.org; 90 - license = stdenv.lib.licenses.bsd2; 91 - platforms = stdenv.lib.platforms.all; 92 - maintainers = with stdenv.lib.maintainers; [ thoughtpolice raskin ]; 102 + license = licenses.bsd2; 103 + platforms = platforms.all; 104 + maintainers = with maintainers; [ thoughtpolice raskin ]; 93 105 }; 94 106 }