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/core.nix | 1 + user-profiles/feeds/module.nix | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/user-profiles/core.nix b/user-profiles/core.nix index fb80343d..ff8cb9f9 100644 --- a/user-profiles/core.nix +++ b/user-profiles/core.nix @@ -8,6 +8,7 @@ config = { manual.manpages.enable = true; home.stateVersion = "20.09"; + systemd.user.startServices = "sd-switch"; }; }; } 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