aboutsummaryrefslogtreecommitdiff
path: root/nixops/scripts/setup
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-05-25 15:11:11 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-05-27 01:42:18 +0200
commit4506dbe51901f66406a02042b2097b3b3856e8a6 (patch)
tree70f877fb285fd3df5a32cd01336bb142f8317e77 /nixops/scripts/setup
parent2232653330cedd11ac2aa64bdac994137cb26e80 (diff)
downloadNix-4506dbe51901f66406a02042b2097b3b3856e8a6.tar.gz
Nix-4506dbe51901f66406a02042b2097b3b3856e8a6.tar.zst
Nix-4506dbe51901f66406a02042b2097b3b3856e8a6.zip
Use Makefile for some env/deploy scripts
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