mirror of
https://github.com/anotherhadi/nixy.git
synced 2026-04-02 11:12:09 +02:00
8
home/programs/nh/default.nix
Normal file
8
home/programs/nh/default.nix
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{ config, ... }: {
|
||||||
|
programs.nh = {
|
||||||
|
enable = true;
|
||||||
|
flake = config.var.configDirectory;
|
||||||
|
clean.enable = config.var.autoGarbageCollector;
|
||||||
|
clean.extraArgs = "--keep-since 4d --keep 3";
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -25,7 +25,9 @@ let
|
|||||||
apps=(
|
apps=(
|
||||||
";Rebuild;nixy rebuild"
|
";Rebuild;nixy rebuild"
|
||||||
";Upgrade;nixy upgrade"
|
";Upgrade;nixy upgrade"
|
||||||
";Clean;nixy clean"
|
";Update;nixy update"
|
||||||
|
";Collect Garbage;nixy gc"
|
||||||
|
";Clean Boot Menu;nixy cb"
|
||||||
";Hyprland Keybindings;nvim ${configDirectory}/docs/KEYBINDINGS-HYPRLAND.md"
|
";Hyprland Keybindings;nvim ${configDirectory}/docs/KEYBINDINGS-HYPRLAND.md"
|
||||||
";Wallpapers;nvim ${inputs.nixy-wallpapers}/docs/MOBILE-VIEW.md"
|
";Wallpapers;nvim ${inputs.nixy-wallpapers}/docs/MOBILE-VIEW.md"
|
||||||
)
|
)
|
||||||
@@ -48,14 +50,26 @@ let
|
|||||||
[[ $1 == "" ]] && ui
|
[[ $1 == "" ]] && ui
|
||||||
|
|
||||||
if [[ $1 == "rebuild" ]];then
|
if [[ $1 == "rebuild" ]];then
|
||||||
${pkgs.nh}/bin/nh os switch ${configDirectory} --hostname ${hostname}
|
sudo nixos-rebuild switch --flake ${configDirectory}#${hostname}
|
||||||
elif [[ $1 == "upgrade" ]];then
|
elif [[ $1 == "upgrade" ]];then
|
||||||
${pkgs.nh}/bin/nh os switch ${configDirectory} --hostname ${hostname} --update
|
sudo nixos-rebuild switch --upgrade --flake '${configDirectory}#${hostname}'
|
||||||
elif [[ $1 == "clean" ]];then
|
elif [[ $1 == "update" ]];then
|
||||||
cd ${configDirectory} && ${pkgs.nh}/bin/nh clean all
|
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
|
||||||
elif [[ $1 == "remote" ]];then
|
elif [[ $1 == "remote" ]];then
|
||||||
cd ~/.config/nixos && git add . && git commit -m "update" && git push
|
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"
|
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
|
else
|
||||||
echo "Unknown argument"
|
echo "Unknown argument"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
../../home/programs/markdown
|
../../home/programs/markdown
|
||||||
../../home/programs/thunar
|
../../home/programs/thunar
|
||||||
../../home/programs/lazygit
|
../../home/programs/lazygit
|
||||||
|
../../home/programs/nh
|
||||||
|
|
||||||
# Scripts
|
# Scripts
|
||||||
../../home/scripts # All scripts
|
../../home/scripts # All scripts
|
||||||
|
|||||||
Reference in New Issue
Block a user