From 4aa1b4eb5081d1f87f359c30db627efd839a681e Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:12:35 +0100 Subject: [PATCH] switch to nh Former-commit-id: 1ae412cf5b42d98f49f0c65b9c6d698bf690ea91 --- home/scripts/nixy/default.nix | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/home/scripts/nixy/default.nix b/home/scripts/nixy/default.nix index f982a1d..8de1099 100644 --- a/home/scripts/nixy/default.nix +++ b/home/scripts/nixy/default.nix @@ -25,9 +25,7 @@ let apps=( "󰑓;Rebuild;nixy rebuild" "󰦗;Upgrade;nixy upgrade" - "󰚰;Update;nixy update" - ";Collect Garbage;nixy gc" - "󰍜;Clean Boot Menu;nixy cb" + "󰍜;Clean;nixy clean" "󰌌;Hyprland Keybindings;nvim ${configDirectory}/docs/KEYBINDINGS-HYPRLAND.md" "󰋩;Wallpapers;nvim ${inputs.nixy-wallpapers}/docs/MOBILE-VIEW.md" ) @@ -50,26 +48,14 @@ let [[ $1 == "" ]] && ui if [[ $1 == "rebuild" ]];then - sudo nixos-rebuild switch --flake ${configDirectory}#${hostname} + ${pkgs.nh}/bin/nh os switch ${configDirectory} --hostname ${hostname} elif [[ $1 == "upgrade" ]];then - sudo nixos-rebuild switch --upgrade --flake ${configDirectory}#${hostname} - elif [[ $1 == "update" ]];then - cd ${configDirectory} && nix flake update - elif [[ $1 == "gc" ]];then - cd ${configDirectory} && sudo nix-collect-garbage -d - elif [[ $1 == "cb" ]];then - sudo /run/current-system/bin/switch-to-configuration boot + ${pkgs.nh}/bin/nh os switch ${configDirectory} --hostname ${hostname} --update + elif [[ $1 == "clean" ]];then + cd ${configDirectory} && ${pkgs.nh}/bin/nh clean all elif [[ $1 == "remote" ]];then cd ~/.config/nixos && git add . && git commit -m "update" && git push ssh jack -S -C "cd /home/hadi/.config/nixos && git pull && sudo -S nixos-rebuild switch --flake ~/.config/nixos#jack" - elif [[ $1 == "loop" ]];then - while true; do - nixy - echo "Press enter to continue, e to exit" - read -n 1 REPLY - clear - [[ $REPLY == "e" ]] && exit 0 - done else echo "Unknown argument" fi