aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md7
-rw-r--r--lib/types/populate.nix5
-rw-r--r--pkgs/populate/default.nix7
3 files changed, 17 insertions, 2 deletions
diff --git a/README.md b/README.md
index 1191a2f..323d08b 100644
--- a/README.md
+++ b/README.md
@@ -114,6 +114,13 @@ Supported attributes:
boolean that controls whether file contents should be checked to decide
whether a file has changed. This is useful when `path` points at files
with mangled timestamps, e.g. the Nix store.
+
+* `exclude` (optional)
+ List of patterns that should excluded from being synced. The list will be
+ passed to the `--exclude` option of [`rsync`](https://rsync.samba.org/).
+ Checkout the filter rules section in the [rsync
+ manual](https://download.samba.org/pub/rsync/rsync.html) for further
+ information.
### `git`
diff --git a/lib/types/populate.nix b/lib/types/populate.nix
index bf90ace..e23ddb0 100644
--- a/lib/types/populate.nix
+++ b/lib/types/populate.nix
@@ -71,6 +71,11 @@
default = false;
type = lib.types.bool;
};
+ exclude = lib.mkOption {
+ type = lib.types.listOf lib.types.str;
+ default = [];
+ example = [".git"];
+ };
};
};
git = lib.types.submodule {
diff --git a/pkgs/populate/default.nix b/pkgs/populate/default.nix
index 2b283a8..3e02aea 100644
--- a/pkgs/populate/default.nix
+++ b/pkgs/populate/default.nix
@@ -45,7 +45,7 @@ let
'';
pop.file = target: source: let
- configAttrs = ["useChecksum"];
+ configAttrs = ["useChecksum" "exclude"];
config = filterAttrs (name: _: elem name configAttrs) source;
in
rsync' target config (quote source.path);
@@ -156,8 +156,11 @@ 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} \
-e ${quote (ssh' target)} \
-vFrlptD \
--delete-excluded \