sombrero: Add restic module

This commit is contained in:
Alexander Heldt
2023-10-23 22:31:02 +02:00
parent 2bc7982c03
commit ad6d1970ad
2 changed files with 44 additions and 28 deletions

View File

@@ -72,33 +72,6 @@
};
};
services = {
restic.backups = {
"sync" = {
initialize = true;
user = "alex";
passwordFile = "/home/alex/backup/restic/password.file";
environmentFile = "/home/alex/backup/restic/aws.env";
repository = "s3:https://s3.eu-north-1.amazonaws.com/restic-sync-backup";
paths = ["/home/alex/backup/sync"];
timerConfig = {
OnCalendar = "daily";
Persistent = true;
};
pruneOpts = [
"--keep-daily 2"
"--keep-weekly 7"
"--keep-yearly 12"
];
};
};
};
users = {
mutableUsers = false;
@@ -124,7 +97,6 @@
git
tig
unar
restic
];
config-manager = {
@@ -140,6 +112,7 @@
plex.enable = true;
calibre-web.enable = true;
transmission.enable = true;
restic.enable = true;
};
# Copy the NixOS configuration file and link it from the resulting system

View File

@@ -0,0 +1,43 @@
{ pkgs, lib, config, ... }:
let
enabled = config.mod.restic.enable;
in
{
options = {
mod.restic = {
enable = lib.mkEnableOption "enable restic module";
};
};
config = lib.mkIf enabled {
services = {
restic.backups = {
"sync" = {
initialize = true;
user = "alex";
passwordFile = "/home/alex/backup/restic/password.file";
environmentFile = "/home/alex/backup/restic/aws.env";
repository = "s3:https://s3.eu-north-1.amazonaws.com/restic-sync-backup";
paths = ["/home/alex/backup/sync"];
timerConfig = {
OnCalendar = "daily";
Persistent = true;
};
pruneOpts = [
"--keep-daily 2"
"--keep-weekly 7"
"--keep-yearly 12"
];
};
};
};
environment.systemPackages = [ pkgs.restic ];
};
}