make rsync work
This commit is contained in:
@@ -43,7 +43,7 @@ in {
|
|||||||
};
|
};
|
||||||
offsite_dir = lib.mkOption {
|
offsite_dir = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "blake/archives/homelab";
|
default = "lifeboat";
|
||||||
description = "path to rsync offsite backups to";
|
description = "path to rsync offsite backups to";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -64,10 +64,10 @@ in {
|
|||||||
systemctl start $(systemctl list-unit-files 'postgresqlBackup-*.service' --no-legend --no-pager | cut -d' ' -f1)
|
systemctl start $(systemctl list-unit-files 'postgresqlBackup-*.service' --no-legend --no-pager | cut -d' ' -f1)
|
||||||
'';
|
'';
|
||||||
postHook = ''
|
postHook = ''
|
||||||
sshpass -f ${sec."lifeboat_rsync".path} \
|
${pkgs.sshpass}/bin/sshpass -f ${sec."lifeboat_rsync".path} \
|
||||||
rsync -aHAX --partial --numeric-ids --info=progress2,name1,stats2 \
|
${pkgs.rsync}/bin/rsync -aHAX --partial --numeric-ids --info=progress2,name1,stats2 --delete \
|
||||||
-e ssh \
|
-e "ssh -o StrictHostKeyChecking=no" \
|
||||||
${cfg.backup_repo} \
|
${toString cfg.backup_repo} \
|
||||||
${cfg.offsite_user}@${cfg.offsite_target}::${cfg.offsite_dir}
|
${cfg.offsite_user}@${cfg.offsite_target}::${cfg.offsite_dir}
|
||||||
'';
|
'';
|
||||||
extraArgs = ["--verbose" "--show-rc" "--umask" "0007"];
|
extraArgs = ["--verbose" "--show-rc" "--umask" "0007"];
|
||||||
@@ -99,7 +99,7 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
# helpful and for scripts
|
# helpful and for scripts
|
||||||
environment.systemPackages = with pkgs; [borgbackup sshpass tree];
|
environment.systemPackages = with pkgs; [borgbackup sshpass tree rsync];
|
||||||
|
|
||||||
sops.secrets = {
|
sops.secrets = {
|
||||||
"borg_passwd" = {
|
"borg_passwd" = {
|
||||||
@@ -109,6 +109,7 @@ in {
|
|||||||
"lifeboat_rsync" = {
|
"lifeboat_rsync" = {
|
||||||
owner = "root";
|
owner = "root";
|
||||||
group = "archives";
|
group = "archives";
|
||||||
|
mode = "0440";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user