finallyy?

This commit is contained in:
2025-10-12 20:11:00 -05:00
parent 3acd59d938
commit c1e56790c5
2 changed files with 18 additions and 17 deletions

View File

@@ -1,12 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
echo "searching generations" #echo "searching generations"
# your hostname (flake target) # your hostname (flake target)
hostname="$(hostname)" hostname="$(hostname)"
old_gen=$(nixos-rebuild list-generations | grep current | awk '{print $1}') #old_gen=$(nixos-rebuild list-generations | grep current | awk '{print $1}')
gen=$((old_gen + 1)) #gen=$((old_gen + 1))
echo "gen $old_gen --> gen $gen" #echo "gen $old_gen --> gen $gen"
timestamp=$(date '+%Y-%m-%d %H:%M:%S') timestamp=$(date '+%Y-%m-%d %H:%M:%S')
nix_dir="$HOME/.nix" nix_dir="$HOME/.nix"
logfile="$nix_dir/.nixos-switch-log" logfile="$nix_dir/.nixos-switch-log"
@@ -15,9 +15,9 @@ logfile="$nix_dir/.nixos-switch-log"
pushd "$nix_dir" >/dev/null pushd "$nix_dir" >/dev/null
# function to get current nixos generation # function to get current nixos generation
get_current_generation() { #get_current_generation() {
nixos-rebuild list-generations # nixos-rebuild list-generations
} #}
echo "diffs:" echo "diffs:"
git diff git diff
@@ -30,13 +30,13 @@ if ! sudo nixos-rebuild switch --flake .#"$hostname" 2>&1 | tee "$logfile"; then
echo "rebuild failed; exited with no commit" echo "rebuild failed; exited with no commit"
exit 1 exit 1
fi fi
if sed -n '3p' flake.nix | grep -q '^# generation:'; then #if sed -n '3p' flake.nix | grep -q '^# generation:'; then
# replace the comment on line 3 # # replace the comment on line 3
sed -i "3s|^# generation:.*|# generation: $gen, timestamp: $timestamp|" flake.nix # sed -i "3s|^# generation:.*|# generation: $gen, timestamp: $timestamp|" flake.nix
else #else
# insert comment on line 3 # # insert comment on line 3
sed -i "3i# generation: $gen, timestamp: $timestamp" flake.nix # sed -i "3i# generation: $gen, timestamp: $timestamp" flake.nix
fi #fi
echo "committing..." echo "committing..."
git add $nix_dir git add $nix_dir
git commit -m "$commit_msg" git commit -m "$commit_msg"

View File

@@ -80,9 +80,10 @@ in
serverAliases = [ "abs.${homelab.public_domain}" ]; serverAliases = [ "abs.${homelab.public_domain}" ];
extraConfig = '' extraConfig = ''
# tls ${sec."ssl_blakedheld_crt".path} ${sec."ssl_blakedheld_key".path} # tls ${sec."ssl_blakedheld_crt".path} ${sec."ssl_blakedheld_key".path}
reverse_proxy http://127.0.0.1:${toString cfg.port} reverse_proxy http://127.0.0.1:${toString cfg.port} {
stream_timeout 24h stream_timeout 24h
stream_close_delay 5m stream_close_delay 5m
}
''; '';
}; };