diff options
Diffstat (limited to 'bin/make-rsync-filter')
-rwxr-xr-x | bin/make-rsync-filter | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/bin/make-rsync-filter b/bin/make-rsync-filter new file mode 100755 index 000000000..26e070adb --- /dev/null +++ b/bin/make-rsync-filter @@ -0,0 +1,33 @@ +#! /bin/sh +# make-rsync-filter : nixos-config -> rsync-filter +set -euf + +main=$1 + +hosts=$(list-hosts) +module_imports=$(list-module-imports "$main") +other_imports=$( + echo "$module_imports" \ + | xargs grep -H . \ + | import-statements \ + | slash-path-relpath \ + | undot-paths \ + | sort \ + | uniq \ + | sed '/\.nix$/!s:$:/default.nix:' \ + ) +secrets=$(echo "$module_imports" | xargs cat | quoted-strings | filter-secrets) + +# TODO collect all other paths from *_imports + +abs_deps=$( + echo "$hosts" + echo "$module_imports" + echo "$other_imports" + echo "$secrets" +) + +rel_deps=$(echo "$abs_deps" | make-relative-to "$PWD") +filter=$(echo "$rel_deps" | make-rsync-whitelist) + +echo "$filter" |