initial commit
This commit is contained in:
commit
2ca4b5440a
13 changed files with 584 additions and 0 deletions
27
deploy.sh
Executable file
27
deploy.sh
Executable file
|
@ -0,0 +1,27 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p jq nixos-anywhere
|
||||
set -ex
|
||||
|
||||
USERNAME="root"
|
||||
IP="gerd.fricloud.dk"
|
||||
NIXPKGS=$(jq -r '.nixpkgs.url' ./shared/sources/sources.json)
|
||||
|
||||
export NIX_PATH="nixpkgs=$NIXPKGS"
|
||||
|
||||
if [ "$1" == "initial-deploy" ]; then
|
||||
echo "Initial deployment..."
|
||||
NIX_TOP_LEVEL_PATH=$(nix build --impure -I nixos-config=./machines/gerd.nix --json --expr "(import <nixpkgs/nixos> {}).config.system.build.toplevel" | jq -r '.[].outputs.out')
|
||||
NIX_DISKO_SCRIPT=$(nix build --impure -I nixos-config=./machines/gerd.nix --json --expr "(import <nixpkgs/nixos> {}).config.system.build.diskoScript" | jq -r '.[].outputs.out')
|
||||
|
||||
nixos-anywhere --store-paths "$NIX_DISKO_SCRIPT" "$NIX_TOP_LEVEL_PATH" "$USERNAME@$IP"
|
||||
else
|
||||
echo "Deploying..."
|
||||
REBUILD_ACTION="switch"
|
||||
if [ -n "$1" ]; then
|
||||
REBUILD_ACTION="$1"
|
||||
fi
|
||||
nixos-rebuild \
|
||||
-I nixos-config=./machines/gerd.nix \
|
||||
"$REBUILD_ACTION" --target-host "$USERNAME@$IP"
|
||||
# -I "nixpkgs=$(jq -r '.nixpkgs.url' ./shared/sources/sources.json)" \
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue