mirror of
https://cgit.krebsco.de/krops
synced 2024-11-26 21:19:47 +01:00
populate file: add exclude option
This commit is contained in:
parent
f2f8cbf1af
commit
fff9b24ec9
3 changed files with 17 additions and 2 deletions
|
@ -115,6 +115,13 @@ Supported attributes:
|
|||
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`
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 \
|
||||
|
|
Loading…
Reference in a new issue