40 lines
892 B
Nix
40 lines
892 B
Nix
{
|
|
pkgs,
|
|
config,
|
|
...
|
|
}: let
|
|
secrets = config.services.secrets.secrets;
|
|
in {
|
|
environment.systemPackages = with pkgs; [
|
|
restic
|
|
(pkgs.writeShellScriptBin "restic-forgejo" ''
|
|
env \
|
|
RESTIC_PASSWORD_FILE=${secrets.restic_password.path} \
|
|
$(cat ${secrets.restic_env.path}) \
|
|
${pkgs.restic}/bin/restic $@
|
|
'')
|
|
];
|
|
|
|
services.restic.backups.forgejo = {
|
|
user = "root";
|
|
paths = [
|
|
"/var/lib/forgejo"
|
|
];
|
|
|
|
# repository is overrided in environmentFile to contain auth
|
|
# make sure to keep up to date when changing repository
|
|
repository = "rest:https://storage-restic.owo.monster/Forgejo";
|
|
passwordFile = "${secrets.restic_password.path}";
|
|
environmentFile = "${secrets.restic_env.path}";
|
|
|
|
pruneOpts = [
|
|
"--keep-last 50"
|
|
];
|
|
|
|
timerConfig = {
|
|
OnBootSec = "1m";
|
|
OnCalendar = "4h";
|
|
};
|
|
};
|
|
}
|