diff options
Diffstat (limited to 'nixops/scripts/setup')
-rwxr-xr-x | nixops/scripts/setup | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/nixops/scripts/setup b/nixops/scripts/setup index 4a76d35..cfa8d64 100755 --- a/nixops/scripts/setup +++ b/nixops/scripts/setup | |||
@@ -134,31 +134,12 @@ if nix show-config --json | jq -e '.sandbox.value == "true"' >/dev/null; then | |||
134 | exit 1 | 134 | exit 1 |
135 | fi | 135 | fi |
136 | 136 | ||
137 | if ! which nixops 2>/dev/null >/dev/null; then | ||
138 | cat <<-EOF | ||
139 | nixops is needed: | ||
140 | > nix-env -i nixops | ||
141 | If it fails, please check that $HOME/.nix-profile/bin is in your PATH. | ||
142 | Continue? [y/N] | ||
143 | EOF | ||
144 | read y | ||
145 | if [ "$y" = "y" -o "$y" = "Y" ]; then | ||
146 | nix-env -i nixops | ||
147 | if ! which nixops 2>/dev/null >/dev/null; then | ||
148 | echo "Installation failed, please check that $HOME/.nix-profile/bin is in your path." | ||
149 | exit 1 | ||
150 | fi | ||
151 | else | ||
152 | echo "Aborting" | ||
153 | exit 1 | ||
154 | fi | ||
155 | fi | ||
156 | |||
157 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | 137 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" |
138 | nixops="$(nix-build --no-out-link -A nixops "$(dirname $(dirname $DIR))")/bin/nixops" | ||
158 | export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops" | 139 | export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops" |
159 | export NIXOPS_DEPLOYMENT="$DeploymentUuid" | 140 | export NIXOPS_DEPLOYMENT="$DeploymentUuid" |
160 | 141 | ||
161 | if ! nixops info 2>/dev/null >/dev/null; then | 142 | if ! $nixops info 2>/dev/null >/dev/null; then |
162 | cat <<-EOF | 143 | cat <<-EOF |
163 | Importing deployment file into nixops: | 144 | Importing deployment file into nixops: |
164 | Continue? [y/N] | 145 | Continue? [y/N] |
@@ -166,9 +147,9 @@ if ! nixops info 2>/dev/null >/dev/null; then | |||
166 | read y | 147 | read y |
167 | if [ "$y" = "y" -o "$y" = "Y" ]; then | 148 | if [ "$y" = "y" -o "$y" = "Y" ]; then |
168 | deployment=$(pass show $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/Deployment) | 149 | deployment=$(pass show $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/Deployment) |
169 | echo "$deployment" | nixops import | 150 | echo "$deployment" | $nixops import |
170 | 151 | ||
171 | nixops modify "$(dirname $DIR)/eldiron.nix" | 152 | $nixops modify "$(dirname $DIR)/eldiron.nix" |
172 | else | 153 | else |
173 | echo "Aborting" | 154 | echo "Aborting" |
174 | exit 1 | 155 | exit 1 |