nixos-switch-to-specialization

This commit is contained in:
Peder Bergebakken Sundt 2025-03-19 17:22:36 +01:00
parent 69e2622dc6
commit 36a6779fc0

@ -0,0 +1,23 @@
nixos-switch-to-specialization() {
if [[ -z "$(ls /run/current-system/specialisation)" ]]; then
printf >&2 "%s\n" "No specializations found!"
return 1
fi
if ! command -v gum >/dev/null; then
printf >&2 "%s\n" "ERROR: 'gum' not found in PATH"
return 1
fi
specialization=$(
ls /run/current-system/specialisation | gum choose --height=15
)
if [[ -z "$specialization" ]]; then
return 1
fi
(
set -x
sudo /run/current-system/specialisation/"$specialization"/bin/switch-to-configuration switch
)
}