24 lines
546 B
Bash
24 lines
546 B
Bash
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
|
|
)
|
|
}
|