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