nixos-switch-to-specialization
This commit is contained in:
@ -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
|
||||||
|
)
|
||||||
|
}
|
Reference in New Issue
Block a user