From e2ea5476d7c06a7afd552618c1cdd02e2db96ee1 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 6 Sep 2021 11:55:48 +0200 Subject: feeds: rotate logs --- user-profiles/feeds/module.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'user-profiles/feeds') diff --git a/user-profiles/feeds/module.nix b/user-profiles/feeds/module.nix index 1face90e..ffde87b8 100644 --- a/user-profiles/feeds/module.nix +++ b/user-profiles/feeds/module.nix @@ -156,5 +156,31 @@ in { NOTMUCH_CONFIG=${configPath} $DRY_RUN_CMD ${pkgs.notmuch}/bin/notmuch new $NOTMUCH_VERBOSE_ARG fi ''; + + systemd.user.services."logrotate-imm" = { + Unit = { + Description = "Rotate imm logfile"; + }; + Service = { + Type = "oneshot"; + ExecStart = '' + ${pkgs.logrotate}/bin/logrotate --state ${config.xdg.configHome}/imm/imm.logrotate ${pkgs.writeText "logrotate.conf" '' + ${config.xdg.configHome}/imm/imm.log { + rotate 5 + size 1m + } + ''} + ''; + }; + }; + systemd.user.timers."logrotate-imm" = { + Timer = { + OnActiveSec = "6h"; + OnUnitActiveSec = "6h"; + }; + Install = { + WantedBy = ["default.target"]; + }; + }; }; } -- cgit v1.2.3