nixos/forgejo: add age setting to automatic dump

Currently dump are added to the directory but not cleaned up.
This setting allows the user to customize the cleanup age of dumps.
This commit is contained in:
Luca A.
2025-10-20 15:42:18 +02:00
parent 3300e505b3
commit 7bf1b4d04a
2 changed files with 16 additions and 1 deletions
+2
View File
@@ -121,6 +121,8 @@
- Zig 0.12 has been removed.
- `services.forgejo.dump.age` now defaults to `4w`, which deletes dumps older than 4 weeks. This new behaviour could result in older backups being deleted.
- `ansible-later` has been removed because it was discontinued by the author.
- `k3s` airgap images passthru attributes have changed:
+14 -1
View File
@@ -285,6 +285,19 @@ in
description = "Filename to be used for the dump. If `null` a default name is chosen by forgejo.";
example = "forgejo-dump";
};
age = mkOption {
type = types.str;
default = "4w";
example = "5d";
description = ''
Age of backup used to decide what files to delete when cleaning.
If a file or directory is older than the current time minus the age field, it is deleted.
The format is described in
{manpage}`tmpfiles.d(5)`.
'';
};
};
lfs = {
@@ -596,7 +609,7 @@ in
};
systemd.tmpfiles.rules = [
"d '${cfg.dump.backupDir}' 0750 ${cfg.user} ${cfg.group} - -"
"d '${cfg.dump.backupDir}' 0750 ${cfg.user} ${cfg.group} ${cfg.dump.age} -"
"z '${cfg.dump.backupDir}' 0750 ${cfg.user} ${cfg.group} - -"
"d '${cfg.repositoryRoot}' 0750 ${cfg.user} ${cfg.group} - -"
"z '${cfg.repositoryRoot}' 0750 ${cfg.user} ${cfg.group} - -"