mirror of
https://cgit.krebsco.de/krops
synced 2024-11-27 05:29: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
|
whether a file has changed. This is useful when `path` points at files
|
||||||
with mangled timestamps, e.g. the Nix store.
|
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`
|
### `git`
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,11 @@
|
||||||
default = false;
|
default = false;
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
};
|
};
|
||||||
|
exclude = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = [];
|
||||||
|
example = [".git"];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
git = lib.types.submodule {
|
git = lib.types.submodule {
|
||||||
|
|
|
@ -45,7 +45,7 @@ let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
pop.file = target: source: let
|
pop.file = target: source: let
|
||||||
configAttrs = ["useChecksum"];
|
configAttrs = ["useChecksum" "exclude"];
|
||||||
config = filterAttrs (name: _: elem name configAttrs) source;
|
config = filterAttrs (name: _: elem name configAttrs) source;
|
||||||
in
|
in
|
||||||
rsync' target config (quote source.path);
|
rsync' target config (quote source.path);
|
||||||
|
@ -156,8 +156,11 @@ let
|
||||||
source_path=$source_path/
|
source_path=$source_path/
|
||||||
fi
|
fi
|
||||||
${rsync}/bin/rsync \
|
${rsync}/bin/rsync \
|
||||||
${optionalString (config.useChecksum or false) /* sh */ "--checksum"} \
|
${optionalString config.useChecksum /* sh */ "--checksum"} \
|
||||||
${optionalString target.sudo /* sh */ "--rsync-path=\"sudo rsync\""} \
|
${optionalString target.sudo /* sh */ "--rsync-path=\"sudo rsync\""} \
|
||||||
|
${concatMapStringsSep " "
|
||||||
|
(pattern: /* sh */ "--exclude ${quote pattern}")
|
||||||
|
config.exclude} \
|
||||||
-e ${quote (ssh' target)} \
|
-e ${quote (ssh' target)} \
|
||||||
-vFrlptD \
|
-vFrlptD \
|
||||||
--delete-excluded \
|
--delete-excluded \
|
||||||
|
|
Loading…
Reference in a new issue