Added two new commands to ncli.

'home-backups' to list the backup files of homemanager and 'switch' to help switch specialisations.
This commit is contained in:
2025-11-26 16:07:22 +01:00
parent a8a718a5ce
commit a547950e45
3 changed files with 38 additions and 1 deletions

View File

@ -10,6 +10,7 @@
[ [
./hardware-configuration.nix ./hardware-configuration.nix
./zsh.nix ./zsh.nix
#./ncli.nix
#./neovim.nix #./neovim.nix
./packages.nix ./packages.nix
]; ];

View File

@ -181,7 +181,7 @@ in
echo " Update and rebuild finished successfully for $HOST" echo " Update and rebuild finished successfully for $HOST"
if [ -n "$current" ]; then if [ -n "$current" ]; then
sudo /run/current-system/specialisation/$current/bin/switch-to-configuration switch sudo /run/current-system/specialisation/$current/bin/switch-to-configuration test
else else
echo "No specialization tag found, staying on default system." echo "No specialization tag found, staying on default system."
fi fi
@ -210,6 +210,41 @@ in
git add -A && git commit -m "$commit_msg" git add -A && git commit -m "$commit_msg"
;; ;;
home-backups)
ls -a ~ | grep backup
;;
switch)
current=""
if [ -f /etc/nixos-tags ]; then
current=$(cat /etc/nixos-tags)
fi
if [ "$#" -ge 2 ]; then
spec_name="$2"
if [ -n "$current" ]; then
echo "Already on specialization: $current. Cannot switch directly to '$spec_name'. Please reboot or return to default first."
else
if [ -d "/run/current-system/specialisation/$spec_name" ]; then
echo "Switching to specialization: $spec_name"
sudo /run/current-system/specialisation/$spec_name/bin/switch-to-configuration test
else
echo "Error: Specialization '$spec_name' not found."
echo "Available specializations:"
ls /run/current-system/specialisation/
fi
fi
else
if [ -n "$current" ]; then
echo "Already on a specialization: $current. To switch, please reboot, or use 'sudo nixos-rebuild switch --flake .' to get back to default, and then switch after."
else
specs=$(ls /run/current-system/specialisation/)
echo "Specializations available:"
echo "$specs"
echo ""
echo "To switch to a specialization, run: 'ncli switch <tag>'"
fi
fi
;;
push) push)
cd "$HOME/$PROJECT" || { echo "Error: Could not change to $HOME/$PROJECT"; exit 1; } cd "$HOME/$PROJECT" || { echo "Error: Could not change to $HOME/$PROJECT"; exit 1; }
git push origin $(git branch --show-current) git push origin $(git branch --show-current)

View File

@ -54,6 +54,7 @@
sqlite sqlite
#Desktop Applications #Desktop Applications
jetbrains.datagrip
ryubing ryubing
vlc vlc
#steam #steam