nix-infra/common/fragments/restic.nix

57 lines
1.7 KiB
Nix

{ config, pkgs, ... }: {
nixpkgs.overlays = [ (final: prev: { restic = pkgs.unstable.restic; }) ];
environment.systemPackages = [ pkgs.restic ];
services.restic.backups.${config.networking.hostName} = {
initialize = true;
repository = "rest:http://10.20.1.2:8000/${config.networking.hostName}/";
passwordFile = "/var/lib/secrets/restic-password";
environmentFile = "/var/lib/secrets/restic-env";
timerConfig = {
OnCalendar = "*-*-* 20:00"; # Daily at 20:00
Persistent = true;
};
paths = [ "/home/agatha" "/mnt/hdd" ];
exclude = [
".Trash*"
".gradle"
"/home/agatha/.XCompose"
"/home/agatha/.Xresources"
"/home/agatha/.cache"
"/home/agatha/.cargo"
"/home/agatha/.config"
"!/home/agatha/.config/gzdoom"
"/home/agatha/.gnupg"
"/home/agatha/.gtkrc-2.0"
"/home/agatha/.java"
"/home/agatha/.local"
"!/home/agatha/.local/share/PrismLauncher"
"/home/agatha/.manpath"
"/home/agatha/.minecraft"
"/home/agatha/.nix-defexpr"
"/home/agatha/.nix-profile"
"/home/agatha/.themes"
"/home/agatha/Desktop"
"/home/agatha/etc/deadname destruction"
"/home/agatha/go"
"/home/agatha/mount"
"/home/agatha/projects/java/**/build"
"/home/agatha/projects/mastodon"
"/home/agatha/projects/rust/**/target"
"/home/agatha/projects/rust/helix/runtime"
"/home/agatha/projects/snek/**/venv"
"__pycache__"
"lost+found"
];
pruneOpts = [ "--keep-daily 7" "--keep-weekly 5" "--keep-yearly 12" ];
};
systemd.timers."restic-backups-${config.networking.hostName}".after =
[ "network-online.target" ];
}