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:
parent
3e2ae4a579
commit
c989fbe2c7
2 changed files with 7 additions and 7 deletions
10
deploy
10
deploy
|
@ -2,12 +2,10 @@
|
||||||
#! nix-shell ./shell.nix -i bash
|
#! nix-shell ./shell.nix -i bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
DEPLOYMENT_NAME="nix-community-infra"
|
|
||||||
STATE_FILE="./state/deployment-state.nixops"
|
|
||||||
|
|
||||||
mkdir -p state
|
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
|
fi
|
||||||
|
|
||||||
nixops deploy -d $DEPLOYMENT_NAME --state $STATE_FILE "$@"
|
nixops deploy "$@"
|
||||||
|
|
|
@ -10,9 +10,11 @@ in pkgs.mkShell {
|
||||||
|
|
||||||
NIX_PATH="nixpkgs=${toString pkgs.path}";
|
NIX_PATH="nixpkgs=${toString pkgs.path}";
|
||||||
|
|
||||||
|
NIXOPS_DEPLOYMENT="nix-community-infra";
|
||||||
|
NIXOPS_STATE="./state/deployment-state.nixops";
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
pkgs.git-crypt
|
pkgs.git-crypt
|
||||||
pkgs.nixops
|
pkgs.nixops
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue