]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/scripts/pull_deployment
Move node-env file to a generic location
[perso/Immae/Config/Nix.git] / nixops / scripts / pull_deployment
CommitLineData
568d4240
IB
1#!/bin/bash
2
3DeploymentUuid="cef694f3-081d-11e9-b31f-0242ec186adf"
568d4240
IB
4if [ -z "$NIXOPS_CONFIG_PASS_SUBTREE_PATH" ]; then
5 echo "Please set NIXOPS_CONFIG_PASS_SUBTREE_PATH to the password-store subtree path"
6 exit 1;
7fi
568d4240 8DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
95d4a7a0
IB
9export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops"
10export NIXOPS_DEPLOYMENT="$DeploymentUuid"
11234d07 11source $(dirname $(dirname $DIR))/nix_path_env
fdf6f74d 12nixops="$(nix-build --no-out-link "$(dirname $DIR)/custom_nixops.nix")/bin/nixops"
95d4a7a0 13
568d4240
IB
14export NIXOPS_STATE="$(dirname $DIR)/state/eldiron.nixops"
15
c79bb682 16if $nixops info -d $DeploymentUuid 2>/dev/null >/dev/null; then
568d4240
IB
17 cat <<EOF
18This will remove your current deployment file and recreate it!
19Continue? [y/N]
20EOF
21 read y
22 if [ "$y" = "y" -o "$y" = "Y" ]; then
c79bb682 23 $nixops delete --force -d $DeploymentUuid
568d4240
IB
24 else
25 echo "Aborting"
26 exit 1
27 fi
28fi
29
9690acd9 30deployment=$(pass show $NIXOPS_CONFIG_PASS_SUBTREE_PATH/Nixops/Deployment)
568d4240 31
c79bb682 32echo "$deployment" | $nixops import
568d4240 33
c79bb682 34$nixops modify -d "$DeploymentUuid" "$(dirname $DIR)/eldiron.nix"