summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2021-09-06 11:55:48 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2021-09-06 11:55:48 +0200
commite2ea5476d7c06a7afd552618c1cdd02e2db96ee1 (patch)
tree4fceae5d5dfa2414bd2992a9f9034f1df5159a48
parentbde8d615a722b4b8b3b19367e83953c9f9928588 (diff)
downloadnixos-e2ea5476d7c06a7afd552618c1cdd02e2db96ee1.tar
nixos-e2ea5476d7c06a7afd552618c1cdd02e2db96ee1.tar.gz
nixos-e2ea5476d7c06a7afd552618c1cdd02e2db96ee1.tar.bz2
nixos-e2ea5476d7c06a7afd552618c1cdd02e2db96ee1.tar.xz
nixos-e2ea5476d7c06a7afd552618c1cdd02e2db96ee1.zip
feeds: rotate logs
-rw-r--r--user-profiles/core.nix1
-rw-r--r--user-profiles/feeds/module.nix26
2 files changed, 27 insertions, 0 deletions
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 @@
8 config = { 8 config = {
9 manual.manpages.enable = true; 9 manual.manpages.enable = true;
10 home.stateVersion = "20.09"; 10 home.stateVersion = "20.09";
11 systemd.user.startServices = "sd-switch";
11 }; 12 };
12 }; 13 };
13} 14}
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 {
156 NOTMUCH_CONFIG=${configPath} $DRY_RUN_CMD ${pkgs.notmuch}/bin/notmuch new $NOTMUCH_VERBOSE_ARG 156 NOTMUCH_CONFIG=${configPath} $DRY_RUN_CMD ${pkgs.notmuch}/bin/notmuch new $NOTMUCH_VERBOSE_ARG
157 fi 157 fi
158 ''; 158 '';
159
160 systemd.user.services."logrotate-imm" = {
161 Unit = {
162 Description = "Rotate imm logfile";
163 };
164 Service = {
165 Type = "oneshot";
166 ExecStart = ''
167 ${pkgs.logrotate}/bin/logrotate --state ${config.xdg.configHome}/imm/imm.logrotate ${pkgs.writeText "logrotate.conf" ''
168 ${config.xdg.configHome}/imm/imm.log {
169 rotate 5
170 size 1m
171 }
172 ''}
173 '';
174 };
175 };
176 systemd.user.timers."logrotate-imm" = {
177 Timer = {
178 OnActiveSec = "6h";
179 OnUnitActiveSec = "6h";
180 };
181 Install = {
182 WantedBy = ["default.target"];
183 };
184 };
159 }; 185 };
160} 186}