colors & hermetic :)
This commit is contained in:
parent
361dd6dc67
commit
3ef331d57e
1 changed files with 7 additions and 3 deletions
10
switch.sh
10
switch.sh
|
@ -1,20 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
bold=$(tput bold)
|
||||
reset=$(tput sgr0)
|
||||
|
||||
script_path=$(readlink -f "${BASH_SOURCE[0]}")
|
||||
flake=$(dirname "$script_path")
|
||||
|
||||
echo "${bold}Building configuration...$reset"
|
||||
configuration=$(sudo nixos-rebuild dry-activate --flake "$flake" --keep-going "$@")
|
||||
echo "$configuration"
|
||||
|
||||
nix run --inputs-from "$flake" nixpkgs#nvd -- diff /run/current-system "$configuration"
|
||||
nix run "$flake#nixosConfigurations.$(hostname).pkgs.nvd" -- diff /run/current-system "$configuration"
|
||||
|
||||
read -n1 -rp "Activate new configuration? [y/N] " answer
|
||||
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 "Not activating :("
|
||||
echo "${bold}Not activating :($reset"
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue