]>
Commit | Line | Data |
---|---|---|
5f5efa6f IB |
1 | #!/bin/bash |
2 | ||
568d4240 | 3 | DeploymentUuid="cef694f3-081d-11e9-b31f-0242ec186adf" |
9f5da6d7 IB |
4 | if [ -z "$NIXOPS_CONFIG_PASS_SUBTREE_PATH" ]; then |
5 | echo "Please set NIXOPS_CONFIG_PASS_SUBTREE_PATH to the password-store subtree path" | |
5f5efa6f IB |
6 | exit 1; |
7 | fi | |
8 | ||
9690acd9 | 9 | TEMP=$(mktemp -d /tmp/XXXXXX-nixops-files) |
5f5efa6f IB |
10 | chmod go-rwx $TEMP |
11 | ||
78e25e2a IB |
12 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" |
13 | nixops="$(nix-build --no-out-link -A nixops "$(dirname $(dirname $DIR))")/bin/nixops" | |
14 | ||
5f5efa6f | 15 | finish() { |
9690acd9 | 16 | rm -rf "$TEMP" |
78e25e2a | 17 | $nixops set-args --unset privateFiles |
5f5efa6f IB |
18 | } |
19 | ||
20 | trap finish EXIT | |
21 | ||
568d4240 IB |
22 | export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops" |
23 | export NIXOPS_DEPLOYMENT="$DeploymentUuid" | |
24 | ||
9690acd9 IB |
25 | # pass cannot "just" list files in a directory without showing a tree :( |
26 | files=$(pass ls $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/files | sed -e '1d' -e 's/^.* //') | |
27 | ||
28 | for file in $files; do | |
29 | pass show "$NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/files/$file" > $TEMP/$file | |
30 | done | |
78e25e2a | 31 | $nixops set-args --argstr privateFiles "$TEMP" |
5f5efa6f | 32 | |
431759ea | 33 | source $(dirname $(dirname $DIR))/nix_path_env |
08822d6f | 34 | # __noChroot: ssh-config-file requires relaxed |
431759ea | 35 | export NIX_PATH="ssh-config-file=$(dirname $DIR)/ssh/config:$NIX_PATH" |
78e25e2a | 36 | $nixops "$@" |