From ae37f7b55f5a6b8c5fef7236530e58e45613d4a6 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Tue, 20 Dec 2016 14:30:05 +0300 Subject: nginx: refactored config events -> conf.events http -> conf.http main -> conf --- modules/apps/icingaweb2.nix | 2 +- modules/apps/mediawiki/default.nix | 2 +- modules/apps/nginx.nix | 32 ++++++++++++++++---------------- 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'modules/apps') diff --git a/modules/apps/icingaweb2.nix b/modules/apps/icingaweb2.nix index d8397ec..852c546 100644 --- a/modules/apps/icingaweb2.nix +++ b/modules/apps/icingaweb2.nix @@ -370,7 +370,7 @@ in { pool = recursiveUpdate defaultPool (cfg.php-fpm.pool // { user = cfg.user ;}); }; - nixsap.apps.nginx.http.servers.icingaweb2 = '' + nixsap.apps.nginx.conf.http.servers.icingaweb2 = '' ${cfg.nginxServer} root ${pkgs.icingaweb2}/public; diff --git a/modules/apps/mediawiki/default.nix b/modules/apps/mediawiki/default.nix index 681b76e..2988f07 100644 --- a/modules/apps/mediawiki/default.nix +++ b/modules/apps/mediawiki/default.nix @@ -304,7 +304,7 @@ in { pool = recursiveUpdate defaultPool (cfg.php-fpm.pool // { user = cfg.user ;}); }; - nixsap.apps.nginx.http.servers.mediawiki = nginx; + nixsap.apps.nginx.conf.http.servers.mediawiki = nginx; systemd.services.mediawiki-db = { description = "configure Mediawiki database"; diff --git a/modules/apps/nginx.nix b/modules/apps/nginx.nix index ce1695a..3490a4b 100644 --- a/modules/apps/nginx.nix +++ b/modules/apps/nginx.nix @@ -40,10 +40,10 @@ let user ${cfg.user} ${cfg.user}; pid ${cfg.runDir}/nginx.pid; - ${format "" cfg.main} + ${format "" (filterAttrs (n: _: ! elem n ["events" "http"]) cfg.conf)} events { - ${format " " cfg.events} + ${format " " cfg.conf.events} } http { @@ -66,7 +66,7 @@ let fastcgi_param HTTP_PROXY ""; proxy_set_header Proxy ""; - ${concatMapStrings (s: "include ${s};\n") (mapAttrsToList mkServer cfg.http.servers)} + ${concatMapStrings (s: "include ${s};\n") (mapAttrsToList mkServer cfg.conf.http.servers)} } ''; @@ -97,7 +97,7 @@ in { default = "/run/nginx"; }; - main = default {} (attrs { + conf = default {} (attrs { pcre_jit = optional bool; timer_resolution = optional int; worker_cpu_affinity = optional str; @@ -105,22 +105,22 @@ in { worker_processes = default "auto" (either int (enum ["auto"])); worker_rlimit_core = optional int; worker_rlimit_nofile = optional int; - }); - - events = default {} (attrs { - accept_mutex = optional bool; - accept_mutex_delay = optional int; - multi_accept = optional bool; - worker_aio_requests = optional int; - worker_connections = optional int; - }); - http = default {} (attrs { - servers = default {} (attrsOf lines); + events = default {} (attrs { + accept_mutex = optional bool; + accept_mutex_delay = optional int; + multi_accept = optional bool; + worker_aio_requests = optional int; + worker_connections = optional int; + }); + + http = default {} (attrs { + servers = default {} (attrsOf lines); + }); }); }; - config = mkIf ({} != explicit cfg.http.servers) { + config = mkIf ({} != explicit cfg.conf.http.servers) { nixsap.system.users.daemons = [ cfg.user ]; systemd.services.nginx = { description = "web/proxy server"; -- cgit v1.2.3