summaryrefslogtreecommitdiffstats
path: root/pkgs/populate
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2021-10-26 13:05:49 +0200
committertv <tv@krebsco.de>2021-10-26 13:52:25 +0200
commit6ef8900af4bca2901f00c718e3ac8ba457348451 (patch)
tree10040eadad68b8f8287473b1dd2c4ce67bed6853 /pkgs/populate
parent53eda9cafee46a506053099c6ced393aa5675f86 (diff)
populate file: admit derivations
Diffstat (limited to 'pkgs/populate')
-rw-r--r--pkgs/populate/default.nix19
1 files changed, 15 insertions, 4 deletions
diff --git a/pkgs/populate/default.nix b/pkgs/populate/default.nix
index d86d949..3be1932 100644
--- a/pkgs/populate/default.nix
+++ b/pkgs/populate/default.nix
@@ -45,10 +45,21 @@ let
'';
pop.file = target: source: let
- config = rsyncDefaultConfig // sourceConfig;
- sourceConfig = getAttrs (attrNames rsyncDefaultConfig) source;
+ config = rsyncDefaultConfig // derivedConfig // sourceConfig;
+ derivedConfig = {
+ useChecksum =
+ if isDerivation source.path
+ then true
+ else rsyncDefaultConfig.useChecksum;
+ };
+ sourceConfig =
+ filterAttrs (name: _: elem name (attrNames rsyncDefaultConfig)) source;
+ sourcePath =
+ if isDerivation source.path
+ then quote (toString source.path)
+ else quote source.path;
in
- rsync' target config (quote source.path);
+ rsync' target config sourcePath;
pop.git = target: source: runShell target /* sh */ ''
set -efu
@@ -198,7 +209,7 @@ let
useChecksum = false;
exclude = [];
filters = [];
- deleteExcluded = true
+ deleteExcluded = true;
};
runShell = target: command: