diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-05-25 15:11:11 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-05-27 01:42:18 +0200 |
commit | 4506dbe51901f66406a02042b2097b3b3856e8a6 (patch) | |
tree | 70f877fb285fd3df5a32cd01336bb142f8317e77 /nixops/scripts/setup | |
parent | 2232653330cedd11ac2aa64bdac994137cb26e80 (diff) | |
download | Nix-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-x | nixops/scripts/setup | 20 |
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 @@ | |||
3 | set -euo pipefail | 3 | set -euo pipefail |
4 | 4 | ||
5 | RemoteRepo="gitolite@git.immae.eu:perso/Immae/Prive/Password_store/Sites" | 5 | RemoteRepo="gitolite@git.immae.eu:perso/Immae/Prive/Password_store/Sites" |
6 | DeploymentUuid="cef694f3-081d-11e9-b31f-0242ec186adf" | 6 | MAKEFILE_DIR="$( cd "$( dirname $( dirname "${BASH_SOURCE[0]}" ))" >/dev/null 2>&1 && pwd )" |
7 | 7 | ||
8 | if ! which nix 2>/dev/null >/dev/null; then | 8 | if ! 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 |
53 | fi | 53 | fi |
54 | 54 | ||
55 | # Repull it before using it, just in case | 55 | # Repull it before adding keys, just in case |
56 | pass git subtree pull --prefix=$NIXOPS_CONFIG_PASS_SUBTREE_PATH $NIXOPS_CONFIG_PASS_SUBTREE_REMOTE master | 56 | make -C $MAKEFILE_DIR pull_environment |
57 | 57 | ||
58 | gpg_keys=$(pass ls $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/GPGKeys | sed -e "1d" | cut -d" " -f2) | 58 | gpg_keys=$(pass ls $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/GPGKeys | sed -e "1d" | cut -d" " -f2) |
59 | for key in $gpg_keys; do | 59 | for 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 |
98 | fi | 98 | fi |
99 | 99 | ||
100 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | 100 | if ! make -C $MAKEFILE_DIR deployment_is_set 2>/dev/null >/dev/null; then |
101 | export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops" | ||
102 | export NIXOPS_DEPLOYMENT="$DeploymentUuid" | ||
103 | source $(dirname $(dirname $DIR))/scripts/nix_env | ||
104 | |||
105 | if ! 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 |
118 | fi | 112 | fi |
119 | 113 | ||
120 | nixops_custom modify "$(dirname $DIR)/default.nix" | ||
121 | |||
122 | cat <<-EOF | 114 | cat <<-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 |