17 lines
723 B
Bash
Executable file
17 lines
723 B
Bash
Executable file
#!/usr/bin/env bash
|
|
cd $DOTFILES_DIR
|
|
echo "Rebuilding..."
|
|
current=$(nixos-rebuild list-generations | grep True | awk '{print $4,"generation",$1,"kernel version",$5,"at",$3,$2}')
|
|
if [[ $* =~ u ]]; then
|
|
rm $DOTFILES_DIR/flake.lock
|
|
nix-channel --update
|
|
nix flake update
|
|
fi
|
|
git add . && git diff HEAD --minimal && git commit -am "$current rebuilding"
|
|
sudo nixos-rebuild switch --impure --flake $DOTFILES_DIR # &> nixos-switch.log || (cat nixos-switch.log | grep --color error && notify-send -e "NixOS Rebuild Failed!" --icon=software-update-available && exit 1) && notify-send -e "NixOS Rebuilt OK!" --icon=software-update-available
|
|
if [[ $* =~ p ]]; then
|
|
sync-dotfiles
|
|
fi
|
|
if [[ $* =~ r ]]; then
|
|
reboot
|
|
fi
|