feat(justfile): switch away from nh

replaces nh with a super cool and awesome bash script that basically
does the exact same thing except i am the one who wrote it so it's
cooler true and real
This commit is contained in:
uku 2025-03-04 09:48:06 +01:00
parent 840718e863
commit ba4b27b664
Signed by: uku
SSH key fingerprint: SHA256:4P0aN6M8ajKukNi6aPOaX0LacanGYtlfjmN+m/sHY/o
3 changed files with 27 additions and 10 deletions

23
switch.sh Normal file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -euo pipefail
bold=$(tput bold)
reset=$(tput sgr0)
flake="$1"
echo "${bold}Building configuration...$reset"
configuration=$(sudo nixos-rebuild dry-activate --flake "$flake" --keep-going "${@:2}")
echo "$configuration"
nix run "$flake#nixosConfigurations.$(hostname).pkgs.nvd" -- diff /run/current-system "$configuration"
read -n1 -rp "${bold}Activate new configuration? [y/N]$reset " answer
echo
if [[ $answer =~ ^[Yy]$ ]]; then
sudo "$configuration/bin/switch-to-configuration" switch
else
echo "${bold}Not activating :($reset"
exit 1
fi