]>
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 | 12 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" |
11234d07 IB |
13 | source $(dirname $(dirname $DIR))/nix_path_env |
14 | # __noChroot: ssh-config-file requires relaxed | |
15 | export NIX_PATH="ssh-config-file=$(dirname $DIR)/ssh/config:$NIX_PATH" | |
16 | ||
78e25e2a IB |
17 | nixops="$(nix-build --no-out-link -A nixops "$(dirname $(dirname $DIR))")/bin/nixops" |
18 | ||
5f5efa6f | 19 | finish() { |
9690acd9 | 20 | rm -rf "$TEMP" |
78e25e2a | 21 | $nixops set-args --unset privateFiles |
5f5efa6f IB |
22 | } |
23 | ||
24 | trap finish EXIT | |
25 | ||
568d4240 IB |
26 | export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops" |
27 | export NIXOPS_DEPLOYMENT="$DeploymentUuid" | |
28 | ||
9690acd9 IB |
29 | # pass cannot "just" list files in a directory without showing a tree :( |
30 | files=$(pass ls $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/files | sed -e '1d' -e 's/^.* //') | |
31 | ||
32 | for file in $files; do | |
33 | pass show "$NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/files/$file" > $TEMP/$file | |
34 | done | |
78e25e2a | 35 | $nixops set-args --argstr privateFiles "$TEMP" |
5f5efa6f | 36 | |
78e25e2a | 37 | $nixops "$@" |