diff --git a/bin/nixos-update-script b/bin/nixos-update-script new file mode 100755 index 0000000..e41318c --- /dev/null +++ b/bin/nixos-update-script @@ -0,0 +1,27 @@ +#!/bin/sh + +REPO_PATH="$HOME/dotfiles" +NIXOS_FOLDER="$REPO_PATH/nixos" + +# Show git diff +cd $NIXOS_FOLDER +git diff + +echo -e "\033[1mLast Commit Name:\033[0m $(git log -1 --pretty=format:'%s')" + + +# Ask user if they want to continue +if [[ $1 == "-sw" ]]; then + read -p "Do you want to continue? (y/n): " choice + if [[ $choice == "y" ]]; then + echo -e "\033[1m>>> sudo nixos-rebuild switch\033[0m" + sudo nixos-rebuild switch + else + echo "Operation cancelled." + fi +else + + echo -e "\033[1m>>> sudo nixos-rebuild dry-run\033[0m" + sudo nixos-rebuild dry-run +fi + diff --git a/bin/safer-nixos-rebuild.sh b/bin/safer-nixos-rebuild.sh new file mode 100644 index 0000000..a9bf588 --- /dev/null +++ b/bin/safer-nixos-rebuild.sh @@ -0,0 +1 @@ +#!/bin/bash diff --git a/symlinks.sh b/symlinks.sh index bf22f8a..d48db6e 100755 --- a/symlinks.sh +++ b/symlinks.sh @@ -12,6 +12,8 @@ DIRS["qtile"]="$HOME/.config/qtile" DIRS["xmobar"]="$HOME/.config/xmobar" DIRS["xmonad"]="$HOME/.config/xmonad" +DIRS["bin/nixos-update-script"]="$HOME/.local/bin/nixos-update-script" + for DIR in "${!DIRS[@]}"; do TARGET="${DIRS[$DIR]}"