kommode/gitea/dump: only keep a single dump at a time

This commit is contained in:
h7x4
2026-05-22 18:27:54 +09:00
parent 82ab97fb45
commit 9a6fdecb03

View File

@@ -228,14 +228,9 @@ in {
}; };
in lib.mkForce "${lib.getExe cfg.package} dump ${args}"; in lib.mkForce "${lib.getExe cfg.package} dump ${args}";
# Only keep n backup files at a time # Only keep a single backup file at a time.
postStop = let postStop = ''
cu = prog: "'${lib.getExe' pkgs.coreutils prog}'"; ${lib.getExe' pkgs.coreutils "mv"} '${cfg.dump.backupDir}'/gitea-dump-*.tar.gz gitea-dump.tar.gz
backupCount = 3; '';
in ''
for file in $(${cu "ls"} -t1 '${cfg.dump.backupDir}' | ${cu "sort"} --reverse | ${cu "tail"} -n+${toString (backupCount + 1)}); do
${cu "rm"} "$file"
done
'';
}; };
} }