33 lines
No EOL
763 B
Nix
33 lines
No EOL
763 B
Nix
{ pkgs, lib, config, ... }:
|
|
|
|
let cfg = config.custom.backups;
|
|
in with lib; {
|
|
|
|
options.custom.backups = {
|
|
enable = mkEnableOption "Automatic backups to Backblaze";
|
|
bucket = mkOption {
|
|
type = types.str;
|
|
default = "ezri-${config.networking.hostName}-backups";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf (cfg.enable) {
|
|
services.duplicity = {
|
|
enable = true;
|
|
secretFile = config.age.secrets."backblaze".path;
|
|
include = [
|
|
"/home"
|
|
];
|
|
exclude = [
|
|
"/home/**/.config"
|
|
"/home/**/.cache"
|
|
"/home/**/.cargo"
|
|
"/home/**/.local"
|
|
# NixOS configuration, we keep that elsewhere.
|
|
"/home/**/os"
|
|
];
|
|
targetUrl = "b2://005c7170636d5ef0000000001@${cfg.bucket}";
|
|
};
|
|
};
|
|
|
|
} |