aboutsummaryrefslogtreecommitdiff
path: root/modules/apps
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2016-12-22 15:29:16 +0300
committerIgor Pashev <pashev.igor@gmail.com>2016-12-22 15:29:16 +0300
commitf88c4455c764f6a8fed20d2e8ac3dadd86a1ce8c (patch)
tree7d3cb3e943ed4c8c549b38085b974abd4611a2f7 /modules/apps
parentb5cccc9b8b5f896f61129e0416d70166e17c15eb (diff)
downloadnixsap-f88c4455c764f6a8fed20d2e8ac3dadd86a1ce8c.tar.gz
nginx: configure logrotate
Diffstat (limited to 'modules/apps')
-rw-r--r--modules/apps/nginx.nix18
1 files changed, 16 insertions, 2 deletions
diff --git a/modules/apps/nginx.nix b/modules/apps/nginx.nix
index d7b3c13..1b10145 100644
--- a/modules/apps/nginx.nix
+++ b/modules/apps/nginx.nix
@@ -6,8 +6,8 @@ let
elem filter isBool ;
inherit (lib)
- concatMapStrings concatStringsSep filterAttrs mapAttrsToList mkEnableOption
- mkIf mkOption ;
+ concatMapStrings concatStringsSep filterAttrs mapAttrsToList mkDefault
+ mkEnableOption mkIf mkOption ;
inherit (lib.types)
attrsOf bool either enum int lines nullOr path str submodule ;
@@ -149,6 +149,20 @@ in {
nixsap.system.users.daemons = mkIf enabled [ cfg.user ];
+ nixsap.apps.logrotate.conf.nginx = mkIf enabled {
+ files = "${cfg.logDir}/*.log";
+ directives = {
+ delaycompress = mkDefault true;
+ missingok = mkDefault true;
+ notifempty = mkDefault true;
+ rotate = mkDefault 14;
+ sharedscripts = true;
+ daily = mkDefault true;
+ create = mkDefault "0640 ${cfg.user} ${cfg.user}";
+ postrotate = pkgs.writeBashScript "logrotate-nginx-postrotate" "systemctl kill -s SIGUSR1 nginx.service";
+ };
+ };
+
systemd.services.nginx = mkIf enabled {
description = "web/proxy server";
wants = [ "keys.target" ];