mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2025-09-05 18:36:22 +02:00
kommode/gitea: only keep 3 backups
This commit is contained in:
parent
736dc44008
commit
54434b7f93
@ -1,4 +1,4 @@
|
|||||||
{ config, values, lib, unstablePkgs, ... }:
|
{ config, values, lib, pkgs, unstablePkgs, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.services.gitea;
|
cfg = config.services.gitea;
|
||||||
domain = "git.pvv.ntnu.no";
|
domain = "git.pvv.ntnu.no";
|
||||||
@ -184,4 +184,14 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ sshPort ];
|
networking.firewall.allowedTCPPorts = [ sshPort ];
|
||||||
|
|
||||||
|
# Only keep n backup files at a time
|
||||||
|
systemd.services.gitea-dump.postStop = let
|
||||||
|
cu = prog: "'${lib.getExe' pkgs.coreutils prog}'";
|
||||||
|
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
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user