Latest changes
This commit is contained in:
1 parent
63d8298e17
commit
6195a9e93f
12 files changed
+201
-116
No files matched your search
@@ -1,11 +1,17 @@
|
||||
#!/bin/sh
|
||||
# Bootstrap
|
||||
set -e
|
||||
ROOT_FOLDER=$(realpath $0 | xargs dirname)
|
||||
. $ROOT_FOLDER/common.sh
|
||||
# Bootstrap
|
||||
|
||||
export NIX_SSHOPTS="-o RequestTTY=force"
|
||||
|
||||
target=${1}
|
||||
target_host=root@$target.lab.internal
|
||||
profile=hl-$target
|
||||
|
||||
valid_profiles=$(nix flake show --json | jq -r -c '.nixosConfigurations | keys[]' | grep "hl")
|
||||
valid_profiles=$(nix flake show --json 2> /dev/null | jq -r -c '.nixosConfigurations | keys[]' | grep "hl")
|
||||
|
||||
function print_valid_targets {
|
||||
echo "valid targets:"
|
||||
@@ -30,27 +36,15 @@ fi
|
||||
|
||||
function run {
|
||||
cmd=${1}
|
||||
echo "$cmd on $target_host with $profile through $build_host"
|
||||
nixos-rebuild \
|
||||
--target-host $target_host \
|
||||
--use-remote-sudo \
|
||||
$cmd \
|
||||
--flake \
|
||||
.#$profile
|
||||
echo -e "$BOLD$cmd$NC on $YELLOW$target_host with $profile through $build_host$NC"
|
||||
runcmd="nixos-rebuild --target-host $target_host --use-remote-sudo $cmd --flake .#$profile"
|
||||
echo -e "$BLUE$runcmd$NC"
|
||||
$runcmd
|
||||
}
|
||||
|
||||
valid_cmds=( build switch test dry-activate )
|
||||
|
||||
cmd=${2}
|
||||
case $cmd in
|
||||
"test" | "dry-activate" | "run" | "switch") run $cmd;;
|
||||
"build")
|
||||
output=$(run $cmd)
|
||||
echo $output
|
||||
echo "_"
|
||||
echo $output | grep "nixos"
|
||||
echo "_"
|
||||
;;
|
||||
"test" | "dry-activate" | "run" | "switch" | "build") run $cmd;;
|
||||
*)
|
||||
echo "invalid command"
|
||||
exit 1
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
## Colors
|
||||
YELLOW='\033[0;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m'
|
||||
BOLD='\033[1m'
|
||||
BLUE_BOLD='\033[1;34m'
|
||||
YELLOW_BOLD='\033[1;33m'
|
||||
Reference in new issue
Block a user