build scripts
This commit is contained in:
1 parent
2d1dc6a721
commit
1fed6c2cbd
4 files changed
+103
No files matched your search
Executable
+22
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
mkdir -p results
|
||||||
|
|
||||||
|
nix flake show --json | jq -r -c '.nixosConfigurations | keys[]' | while read i; do
|
||||||
|
echo "[[SKYG]] Building current $i"
|
||||||
|
sudo nixos-rebuild build --flake .#$i
|
||||||
|
rm -f results/$i-result
|
||||||
|
mv result results/$i-result
|
||||||
|
done
|
||||||
|
|
||||||
|
nix flake update
|
||||||
|
|
||||||
|
rm -f diffs
|
||||||
|
mkdir diffs
|
||||||
|
nix flake show --json | jq -r -c '.nixosConfigurations | keys[]' | while read i; do
|
||||||
|
echo "[[SKYG]] Building new $i"
|
||||||
|
sudo nixos-rebuild build --flake .#$i
|
||||||
|
rm -f results/$i-result-post
|
||||||
|
mv result results/$i-result-post
|
||||||
|
nvd diff results/$i-result results/$i-result-post > diffs/$i
|
||||||
|
done
|
||||||
|
|
||||||
Executable
+6
@@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
rm -f .built_via_skg
|
||||||
|
sudo nixos-rebuild build --flake .
|
||||||
|
touch .built_via_skg
|
||||||
|
nvd diff /run/current-system result
|
||||||
Executable
+58
@@ -0,0 +1,58 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
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")
|
||||||
|
|
||||||
|
function print_valid_targets {
|
||||||
|
echo "valid targets:"
|
||||||
|
while IFS= read -r line; do
|
||||||
|
echo $line | sed -r 's/.*hl-/ - /g'
|
||||||
|
done <<< "$valid_profiles"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z $target ]; then
|
||||||
|
echo "must specify a target!"
|
||||||
|
print_valid_targets
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if echo "$valid_profiles" | grep -qFx "$profile"; then
|
||||||
|
echo "Using [$profile]"
|
||||||
|
else
|
||||||
|
echo "Invalid target! '$profile'"
|
||||||
|
print_valid_targets
|
||||||
|
exit 1
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
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 "_"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "invalid command"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
Executable
+17
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ ! -f .built_via_skg ]; then
|
||||||
|
./build-nixos.sh
|
||||||
|
echo "Do you want to continue? (y/N)"
|
||||||
|
read -r answer
|
||||||
|
if [[ $answer =~ ^[yY]$ ]]; then
|
||||||
|
echo "Continuing..."
|
||||||
|
else
|
||||||
|
echo "Exiting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo nixos-rebuild switch --flake .
|
||||||
|
git cap
|
||||||
|
rm -f .built_via_skg
|
||||||
Reference in new issue
Block a user