2023-08-01 20:53:25 +01:00
|
|
|
{
|
2024-03-09 22:18:26 +00:00
|
|
|
self,
|
2023-08-01 20:53:25 +01:00
|
|
|
pkgs,
|
2023-09-21 05:06:27 +01:00
|
|
|
config,
|
2023-08-01 20:53:25 +01:00
|
|
|
...
|
|
|
|
}: let
|
2024-03-09 22:18:26 +00:00
|
|
|
backupSchedules = import "${self}/data/backupSchedules.nix";
|
2024-03-10 17:26:18 +00:00
|
|
|
inherit (config.services.secrets) secrets;
|
2023-08-01 20:53:25 +01:00
|
|
|
in {
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
restic
|
|
|
|
(pkgs.writeShellScriptBin "restic-quassel" ''
|
|
|
|
env \
|
2023-09-21 05:06:27 +01:00
|
|
|
RESTIC_PASSWORD_FILE=${secrets.restic_password.path} \
|
|
|
|
$(cat ${secrets.restic_env.path}) \
|
2023-08-01 20:53:25 +01:00
|
|
|
${pkgs.restic}/bin/restic $@
|
|
|
|
'')
|
|
|
|
];
|
|
|
|
|
|
|
|
services.restic.backups.quassel = {
|
|
|
|
user = "root";
|
|
|
|
paths = [
|
2024-03-09 22:18:26 +00:00
|
|
|
# it's only backing up initial setup / credentials
|
|
|
|
# so no matter what DB is restored to it should work
|
2023-08-01 20:53:25 +01:00
|
|
|
"/home/quassel/.config/quassel-irc.org"
|
|
|
|
];
|
|
|
|
|
|
|
|
# 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/Quassel";
|
2023-09-21 05:06:27 +01:00
|
|
|
passwordFile = "${secrets.restic_password.path}";
|
|
|
|
environmentFile = "${secrets.restic_env.path}";
|
2023-08-01 20:53:25 +01:00
|
|
|
|
2024-03-09 22:18:26 +00:00
|
|
|
pruneOpts = ["--keep-last 5"];
|
|
|
|
timerConfig = backupSchedules.restic.low;
|
2023-08-01 20:53:25 +01:00
|
|
|
};
|
|
|
|
}
|