2021-03-21 15:55:57 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
2021-08-04 22:27:47 +02:00
|
|
|
# using the restic cli:
|
2022-05-09 12:26:12 +02:00
|
|
|
# load credentials into shell by adding B2 secrets to .env (see .env.example).
|
2021-08-04 22:27:47 +02:00
|
|
|
# useful commands for analysing restic stats [snapshot-id], restic diff [s1] [s2],
|
|
|
|
|
2021-03-21 15:55:57 +01:00
|
|
|
with lib;
|
|
|
|
with builtins;
|
2022-05-06 03:16:17 +02:00
|
|
|
let resticLib = import ./lib.nix { inherit config lib pkgs; };
|
2021-03-21 15:39:11 +01:00
|
|
|
in {
|
2022-05-06 03:16:17 +02:00
|
|
|
imports = [ ./common.nix ];
|
|
|
|
|
2021-05-12 23:22:52 +02:00
|
|
|
environment.systemPackages = with pkgs; [ restic ];
|
|
|
|
|
2022-05-06 03:16:17 +02:00
|
|
|
services.restic.backups.full = resticLib.resticConfig {
|
2022-05-15 15:39:12 +02:00
|
|
|
name = "home-server";
|
2022-05-01 16:44:29 +02:00
|
|
|
ripgrep = true;
|
2021-10-23 00:37:30 +02:00
|
|
|
paths = [ "/etc/nixos" "/var/lib" "/home" ];
|
2022-05-01 16:44:29 +02:00
|
|
|
ignorePatterns = [
|
2022-05-15 15:38:12 +02:00
|
|
|
"/var/lib/systemd"
|
|
|
|
"/var/lib/containers"
|
2022-05-01 16:44:29 +02:00
|
|
|
"/var/lib/lxcfs"
|
|
|
|
"/var/lib/docker"
|
|
|
|
"/var/lib/flatpak"
|
|
|
|
"/var/lib/systemd"
|
2022-05-27 17:44:56 +02:00
|
|
|
"/home/ignore"
|
2022-05-01 16:44:29 +02:00
|
|
|
"/home/*/.local/share/Trash"
|
|
|
|
"/home/*/.cache"
|
|
|
|
"/var/lib/jellyfin/transcodes"
|
2022-05-15 19:37:53 +02:00
|
|
|
"**/.git"
|
2022-05-01 16:44:29 +02:00
|
|
|
];
|
2021-10-23 00:37:30 +02:00
|
|
|
timerConfig.OnCalendar = "0/4:00:00";
|
|
|
|
extraPruneOpts = [ "--keep-last 6" ];
|
2021-03-21 14:24:35 +01:00
|
|
|
};
|
|
|
|
}
|