nixos: set default deployment and state in the shell

This makes it easier to play with nixops. Eg: `nixops ssh build01`
This commit is contained in:
zimbatm 2020-01-12 14:03:14 +01:00
parent 3e2ae4a579
commit c989fbe2c7
No known key found for this signature in database
GPG key ID: 71BAF6D40C1D63D7
2 changed files with 7 additions and 7 deletions

10
deploy
View file

@ -2,12 +2,10 @@
#! nix-shell ./shell.nix -i bash
set -euo pipefail
DEPLOYMENT_NAME="nix-community-infra"
STATE_FILE="./state/deployment-state.nixops"
mkdir -p state
if [ $(nixops list --state $STATE_FILE | grep -c $DEPLOYMENT_NAME) -eq 0 ]; then
nixops create ./deployment.nix --deployment $DEPLOYMENT_NAME --state $STATE_FILE
if [ $(nixops list --state "$NIXOPS_STATE" | grep -c "$NIXOPS_DEPLOYMENT") -eq 0 ]; then
nixops create ./deployment.nix --deployment "$NIXOPS_DEPLOYMENT" --state "$NIXOPS_STATE"
fi
nixops deploy -d $DEPLOYMENT_NAME --state $STATE_FILE "$@"
nixops deploy "$@"

View file

@ -10,9 +10,11 @@ in pkgs.mkShell {
NIX_PATH="nixpkgs=${toString pkgs.path}";
NIXOPS_DEPLOYMENT="nix-community-infra";
NIXOPS_STATE="./state/deployment-state.nixops";
buildInputs = [
pkgs.git-crypt
pkgs.nixops
];
}