nixos-config/services/restic/home-server.nix

34 lines
932 B
Nix
Raw Normal View History

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;
let resticLib = import ./lib.nix { inherit config lib pkgs; };
in {
imports = [ ./common.nix ];
2021-05-12 23:22:52 +02:00
environment.systemPackages = with pkgs; [ restic ];
services.restic.backups.full = resticLib.resticConfig {
name = "home-server";
2021-10-23 00:37:30 +02:00
paths = [ "/etc/nixos" "/var/lib" "/home" ];
ignorePatterns = [
"/var/lib/systemd"
"/var/lib/containers"
"/var/lib/lxcfs"
"/var/lib/docker"
"/var/lib/flatpak"
2022-07-04 17:11:44 +02:00
"/home/*/ignore"
"/home/*/.cache"
"/home/*/.local/share/containers"
"/home/*/.local/share/Trash"
"/var/lib/jellyfin/transcodes"
];
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
};
}