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:
@ -10,6 +10,7 @@
|
||||
[
|
||||
./hardware-configuration.nix
|
||||
./zsh.nix
|
||||
#./ncli.nix
|
||||
#./neovim.nix
|
||||
./packages.nix
|
||||
];
|
||||
|
||||
@ -181,7 +181,7 @@ in
|
||||
echo "✓ Update and rebuild finished successfully for $HOST"
|
||||
|
||||
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
|
||||
echo "No specialization tag found, staying on default system."
|
||||
fi
|
||||
@ -210,6 +210,41 @@ in
|
||||
|
||||
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)
|
||||
cd "$HOME/$PROJECT" || { echo "Error: Could not change to $HOME/$PROJECT"; exit 1; }
|
||||
git push origin $(git branch --show-current)
|
||||
|
||||
@ -54,6 +54,7 @@
|
||||
sqlite
|
||||
|
||||
#Desktop Applications
|
||||
jetbrains.datagrip
|
||||
ryubing
|
||||
vlc
|
||||
#steam
|
||||
|
||||
Reference in New Issue
Block a user