Latest changes

This commit is contained in:
ari committed 2024-10-01 15:02:36 -04:00
1 parent 63d8298e17
commit 6195a9e93f
12 files changed
+201 -116

No files matched your search

+12 -18
View File
@@ -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
+9
View File
@@ -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'
+1 -8
View File
@@ -3,16 +3,9 @@ set -e
# Bootstrap
## Folder handlings
set -e
ROOT_FOLDER=$(realpath $0 | xargs dirname | xargs dirname)
## 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'
. $ROOT_FOLDER/bin/extra/common.sh
# Bootstrap
MENAME=$(basename $0)