aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2021-10-26 12:48:22 +0200
committertv <tv@krebsco.de>2021-10-26 13:52:25 +0200
commit0fc8f1b2a64c61fed3c71ef7edbe57a9f3e2af64 (patch)
tree39f36146d461954b4be9662bfe6119706a5a2a88 /pkgs
parentd80cb74c7400962b08e77ff06153ace419693505 (diff)
populate: add rsyncDefaultConfig
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/populate/default.nix21
1 files changed, 14 insertions, 7 deletions
diff --git a/pkgs/populate/default.nix b/pkgs/populate/default.nix
index 517b12e..d86d949 100644
--- a/pkgs/populate/default.nix
+++ b/pkgs/populate/default.nix
@@ -45,8 +45,8 @@ let
'';
pop.file = target: source: let
- configAttrs = ["useChecksum" "exclude" "filters" "deleteExcluded"];
- config = filterAttrs (name: _: elem name configAttrs) source;
+ config = rsyncDefaultConfig // sourceConfig;
+ sourceConfig = getAttrs (attrNames rsyncDefaultConfig) source;
in
rsync' target config (quote source.path);
@@ -144,7 +144,7 @@ let
echo "$local_pass_info" > "$tmp_dir"/.pass_info
fi
- ${rsync' target {} /* sh */ "$tmp_dir"}
+ ${rsync' target rsyncDefaultConfig /* sh */ "$tmp_dir"}
'';
pop.pipe = target: source: /* sh */ ''
@@ -172,17 +172,17 @@ let
source_path=$source_path/
fi
${rsync}/bin/rsync \
- ${optionalString (config.useChecksum or false) /* sh */ "--checksum"} \
+ ${optionalString config.useChecksum /* sh */ "--checksum"} \
${optionalString target.sudo /* sh */ "--rsync-path=\"sudo rsync\""} \
${concatMapStringsSep " "
(pattern: /* sh */ "--exclude ${quote pattern}")
- (config.exclude or [])} \
+ config.exclude} \
${concatMapStringsSep " "
(filter: /* sh */ "--${filter.type} ${quote filter.pattern}")
- (config.filters or [])} \
+ config.filters} \
-e ${quote (ssh' target)} \
-vFrlptD \
- ${optionalString (config.deleteExcluded or true) /* sh */ "--delete-excluded"} \
+ ${optionalString config.deleteExcluded /* sh */ "--delete-excluded"} \
"$source_path" \
${quote (
optionalString (!isLocalTarget target) (
@@ -194,6 +194,13 @@ let
>&2
'';
+ rsyncDefaultConfig = {
+ useChecksum = false;
+ exclude = [];
+ filters = [];
+ deleteExcluded = true
+ };
+
runShell = target: command:
if isLocalTarget target
then command