aboutsummaryrefslogtreecommitdiff
path: root/nixops/scripts/setup
diff options
context:
space:
mode:
Diffstat (limited to 'nixops/scripts/setup')
-rwxr-xr-xnixops/scripts/setup20
1 files changed, 6 insertions, 14 deletions
diff --git a/nixops/scripts/setup b/nixops/scripts/setup
index 793b7c3..3b364ac 100755
--- a/nixops/scripts/setup
+++ b/nixops/scripts/setup
@@ -3,7 +3,7 @@
3set -euo pipefail 3set -euo pipefail
4 4
5RemoteRepo="gitolite@git.immae.eu:perso/Immae/Prive/Password_store/Sites" 5RemoteRepo="gitolite@git.immae.eu:perso/Immae/Prive/Password_store/Sites"
6DeploymentUuid="cef694f3-081d-11e9-b31f-0242ec186adf" 6MAKEFILE_DIR="$( cd "$( dirname $( dirname "${BASH_SOURCE[0]}" ))" >/dev/null 2>&1 && pwd )"
7 7
8if ! which nix 2>/dev/null >/dev/null; then 8if ! which nix 2>/dev/null >/dev/null; then
9 cat <<-EOF 9 cat <<-EOF
@@ -52,8 +52,8 @@ if ! pass $NIXOPS_CONFIG_PASS_SUBTREE_PATH > /dev/null 2>/dev/null; then
52 fi 52 fi
53fi 53fi
54 54
55# Repull it before using it, just in case 55# Repull it before adding keys, just in case
56pass git subtree pull --prefix=$NIXOPS_CONFIG_PASS_SUBTREE_PATH $NIXOPS_CONFIG_PASS_SUBTREE_REMOTE master 56make -C $MAKEFILE_DIR pull_environment
57 57
58gpg_keys=$(pass ls $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/GPGKeys | sed -e "1d" | cut -d" " -f2) 58gpg_keys=$(pass ls $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/GPGKeys | sed -e "1d" | cut -d" " -f2)
59for key in $gpg_keys; do 59for key in $gpg_keys; do
@@ -97,29 +97,21 @@ if nix show-config --json | jq -e '.sandbox.value == "true"' >/dev/null; then
97 read y 97 read y
98fi 98fi
99 99
100DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 100if ! make -C $MAKEFILE_DIR deployment_is_set 2>/dev/null >/dev/null; then
101export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops"
102export NIXOPS_DEPLOYMENT="$DeploymentUuid"
103source $(dirname $(dirname $DIR))/scripts/nix_env
104
105if ! nixops_custom info 2>/dev/null >/dev/null; then
106 cat <<-EOF 101 cat <<-EOF
107 Importing deployment file into nixops: 102 Importing deployment file into nixops:
108 Continue? [y/N] 103 Continue? [y/N]
109 EOF 104 EOF
110 read y 105 read y
111 if [ "$y" = "y" -o "$y" = "Y" ]; then 106 if [ "$y" = "y" -o "$y" = "Y" ]; then
112 deployment=$(pass show $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/Deployment) 107 make -C $MAKEFILE_DIR pull_deployment
113 echo "$deployment" | nixops_custom import
114 else 108 else
115 echo "Aborting" 109 echo "Aborting"
116 exit 1 110 exit 1
117 fi 111 fi
118fi 112fi
119 113
120nixops_custom modify "$(dirname $DIR)/default.nix"
121
122cat <<-EOF 114cat <<-EOF
123 All set up. 115 All set up.
124 Please make sure you’re using scripts/nixops_wrap when deploying 116 Please make sure you’re using make commands when deploying
125 EOF 117 EOF