run: extract rsync_filter from deploy

This commit is contained in:
tv 2015-03-19 22:48:22 +01:00
parent 6495611cd4
commit 61fc66a2d2

14
run
View File

@ -17,6 +17,16 @@ deploy() {(
main=$1 main=$1
target=$2 target=$2
rsync_filter "$main" \
| rsync -f '. -' -zvrlptD --delete-excluded ./ "$target":/etc/nixos/
ssh "$target" nixos-rebuild switch -I nixos-config=/etc/nixos/"$main"
)}
# rsync_filter : nix-file -> rsync-filter
rsync_filter() {(
main=$1
hosts=$(list_hosts) hosts=$(list_hosts)
module_imports=$(set -euf; list_module_imports "$main") module_imports=$(set -euf; list_module_imports "$main")
other_imports=$( other_imports=$(
@ -43,9 +53,7 @@ deploy() {(
rel_deps=$(echo "$abs_deps" | make_relative_to "$PWD") rel_deps=$(echo "$abs_deps" | make_relative_to "$PWD")
filter=$(echo "$rel_deps" | make_rsync_whitelist) filter=$(echo "$rel_deps" | make_rsync_whitelist)
echo "$filter" \ echo "$filter"
| rsync -f '. -' -zvrlptD --delete-excluded ./ "$target":/etc/nixos/
ssh "$target" nixos-rebuild switch -I nixos-config=/etc/nixos/"$main"
)} )}
# list_module_imports : nix-file -> lines nix-file # list_module_imports : nix-file -> lines nix-file