feat(scripts): add rebuild scripts, check sops script

This commit is contained in:
madmin 2024-08-07 12:15:39 +02:00
parent 25be2b18a0
commit 8cee6c464c
4 changed files with 43 additions and 0 deletions

16
scripts/check-sops.sh Normal file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail
# FIXME: Make this better
sops_result=$(journalctl --no-pager --no-hostname --since "10 minutes ago" |
tac |
awk '!flag; /Starting sops-nix activation/{flag = 1};' |
tac |
grep sops)
# If we don't have "Finished sops-nix activation." in the logs, then we failed
if [[ ! $sops_result =~ "Finished sops-nix activation" ]]; then
echo "sops-nix failed to activate"
echo "$sops_result"
exit 1
fi

View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
if [ ! -z $1 ]; then
export HOST=$1
else
export HOST=$(hostname)
fi
sudo nixos-rebuild --show-trace --impure --flake .#$HOST switch

View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
if [ ! -z $1 ]; then
export HOST=$1
else
export HOST=$(hostname)
fi
sudo nixos-rebuild --impure --flake .#$HOST switch

View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
if [ ! -z $1 ]; then
export HOST=$1
else
export HOST=$(hostname)
fi
sudo nixos-rebuild --impure --flake .#$HOST test