aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2025-12-09 13:12:55 +0100
committertv <tv@krebsco.de>2025-12-09 13:12:55 +0100
commit4594fe83e6f58110385799726adfc955889bca38 (patch)
tree1b86a6ebe2bc479a9c00c547e1dd0f5c5ece58ba
parenta28c25668a6d0f83f80e821b63cab80e4f7b05ad (diff)
populate pipe: use rsync
Generate a reproducible output to transmit it only if it has changed.
-rw-r--r--pkgs/populate/default.nix12
1 files changed, 10 insertions, 2 deletions
diff --git a/pkgs/populate/default.nix b/pkgs/populate/default.nix
index c12507b..32909a9 100644
--- a/pkgs/populate/default.nix
+++ b/pkgs/populate/default.nix
@@ -204,9 +204,17 @@ let
'';
pop.pipe = target: source: /* sh */ ''
- ${quote source.command} | {
- ${runShell target /* sh */ "cat > ${quote target.path}"}
+ tmp_dir=$(${coreutils}/bin/mktemp -dt populate-pipe.XXXXXXXX)
+ trap cleanup EXIT
+ cleanup() {
+ rm -fR "$tmp_dir"
}
+ out=$tmp_dir/out
+
+ ${quote source.command} > "$out"
+ ${coreutils}/bin/touch -t 300001010000 "$out"
+
+ ${rsync' target rsyncDefaultConfig /* sh */ "$out"}
'';
# TODO rm -fR instead of ln -f?