zfs autosnapshots
This commit is contained in:
@@ -4,15 +4,17 @@
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
service = "holocron_offsite";
|
||||
service = "offsite";
|
||||
cfg = config.holocron.${service};
|
||||
sec = config.sops.secrets;
|
||||
in {
|
||||
options.holocron.ensure_perms = {
|
||||
options.holocron.offsite = {
|
||||
enable = lib.mkEnableOption "enables backup script for holocron fileshare";
|
||||
paths = lib.mkOption {
|
||||
type = with lib.types; listOf str;
|
||||
default = [
|
||||
"/holocron/srv"
|
||||
"/holocron/users"
|
||||
];
|
||||
description = "list of paths to backup";
|
||||
};
|
||||
@@ -39,12 +41,14 @@ in {
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "root";
|
||||
Group = "archives";
|
||||
};
|
||||
|
||||
script = ''
|
||||
${pkgs.sshpass}/bin/sshpass -f ${sec."lifeboat_rsync".path} \
|
||||
${pkgs.rsync}/bin/rsync -aHAX --partial --numeric-ids --info=progress2,name1,stats2 --delete \
|
||||
-e "ssh -o StrictHostKeyChecking=no" \
|
||||
-e "${pkgs.openssh}/bin/ssh -o StrictHostKeyChecking=no" \
|
||||
${builtins.concatStringsSep " " cfg.paths} \
|
||||
${cfg.offsite_user}@${cfg.offsite_target}::${cfg.offsite_dir}
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user