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