@@ -4,6 +4,7 @@ with lib;
44
55let
66 cfg = config.services.logrotate;
7+ inherit (config.users) groups;
78
89 pathOpts = { name, ... }: {
910 options = {
@@ -23,6 +24,8 @@ let
2324
2425 path = mkOption {
2526 type = with types; either str (listOf str);
27+ default = name;
28+ defaultText = "attribute name";
2629 description = ''
2730 The path to log files to be rotated.
2831 Spaces are allowed and normal shell quoting rules apply,
@@ -160,6 +163,25 @@ in
160163 }
161164 ) cfg.paths;
162165
166+ services.logrotate = {
167+ paths = {
168+ "/var/log/btmp" = {
169+ frequency = mkDefault "monthly";
170+ keep = mkDefault 1;
171+ extraConfig = ''
172+ create 0660 root ${groups.utmp.name}
173+ '';
174+ };
175+ "/var/log/wtmp" = {
176+ frequency = mkDefault "monthly";
177+ keep = mkDefault 1;
178+ extraConfig = ''
179+ create 0664 root ${groups.utmp.name}
180+ '';
181+ };
182+ };
183+ };
184+
163185 systemd.services.logrotate = {
164186 description = "Logrotate Service";
165187 wantedBy = [ "multi-user.target" ];