move restic to nixosModules

This commit is contained in:
xinyangli 2023-12-02 01:33:20 +08:00
parent 9bec6270ef
commit 9986100945
4 changed files with 10 additions and 5 deletions

View file

@ -7,7 +7,6 @@
./hardware-configuration.nix
./network.nix
../sops.nix
../restic.nix
];
# Bootloader.
@ -247,6 +246,7 @@
sopsFile = ./secrets.yaml;
};
};
custom.restic.enable = true;
custom.restic.repositoryFile = config.sops.secrets.restic_repo_calcite.path;
custom.restic.passwordFile = config.sops.secrets.restic_repo_calcite_password.path;

View file

@ -1,47 +0,0 @@
{ config, pkgs, lib, ... }:
let
cfg = config.custom.restic;
in
{
options = {
custom.restic = {
repositoryFile = lib.mkOption {
type = lib.types.str;
default = "";
};
passwordFile = lib.mkOption {
type = lib.types.str;
default = "";
};
};
};
config = {
services.restic.backups = {
remotebackup = {
repositoryFile = cfg.repositoryFile;
passwordFile = cfg.passwordFile;
paths = [
"/home"
"/var/lib"
];
exclude = [
"/home/*/.cache"
"/home/*/.cargo"
"/home/*/.local/share/Steam"
"/home/*/.local/share/flatpak"
];
timerConfig = {
OnCalendar = "00:05";
RandomizedDelaySec = "5h";
};
pruneOpts = [
"--keep-daily 7"
"--keep-weekly 5"
"--keep-monthly 12"
"--keep-yearly 75"
];
};
};
};
}