general upgrades and adds adb and ulauncher addon

This commit is contained in:
2024-11-21 16:52:06 +01:00
parent c0ab3d1517
commit 0b523463f2
13 changed files with 58 additions and 47 deletions

View File

@ -92,27 +92,28 @@ symlinks() {
done
}
sys_packages_upgrade() {
printfe "%s\n" "cyan" "Running NixOS channel update..."
sudo nix-channel --update
printfe "%s\n" "cyan" "Upgrading NixOS packages..."
cd $HOME/dotfiles/config/nixos && sudo nixos-rebuild switch --upgrade --flake .#$DOTF_HOSTNAME --impure
}
####################################################################################################
# Update packages
####################################################################################################
sys_packages() {
printfe "%s\n" "cyan" "Updating system packages..."
if [[ "$OSTYPE" == "darwin"* ]]; then
printfe "%s\n" "cyan" "Updating brew packages..."
brew update
brew upgrade
brew cleanup
else
if [ -x "$(command -v nixos-version)" ]; then
cd $HOME/dotfiles/config/nixos && sudo nixos-rebuild switch --flake .#$DOTF_HOSTNAME --impure
printfe "%s\n" "cyan" "Updating nix channels..."
printfe "%s" "cyan" "System channels: "
sudo -i nix-channel --update
printfe "%s" "cyan" "User channels: "
nix-channel --update
printfe "%s\n" "cyan" "Updating nixos flake..."
cd $HOME/dotfiles/config/nixos && nix flake update
# Exit if this failed
if [ $? -ne 0 ]; then
@ -121,6 +122,7 @@ sys_packages() {
return
fi
printfe "%s\n" "cyan" "Updating apt packages..."
sudo nala upgrade -y
sudo nala autoremove -y --purge
fi
@ -160,15 +162,8 @@ flatpakpkgs() {
}
homemanager() {
printfe "%s\n" "cyan" "Running Home Manager update..."
# Due to weirdness delete this file if it exists
if [ -f "$HOME/.config/mimeapps.list.backup" ]; then
echo "Removing mimeapps.list.backup"
rip "$HOME/.config/mimeapps.list.backup"
fi
cd $HOME/dotfiles/config/home-manager && NIXPKGS_ALLOW_UNFREE=1 home-manager switch -b backup --flake .#$DOTF_HOSTNAME --impure
printfe "%s\n" "cyan" "Updating Home Manager flake..."
cd $HOME/dotfiles/config/home-manager && nix flake update
}
####################################################################################################
@ -188,9 +183,6 @@ if [ "$#" -eq 0 ]; then
else
for arg in "$@"; do
case $arg in
--nixos-upgrade)
sys_packages_upgrade
;;
--nixos|nixos|nix|nixos-rebuild)
sys_packages
;;

8
bin/actions/upgrade.sh Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
source $HOME/dotfiles/bin/helpers/functions.sh
printfe "%s\n" "cyan" "Upgrading NixOS packages..."
cd $HOME/dotfiles/config/nixos && sudo nixos-rebuild switch --upgrade --flake .#$DOTF_HOSTNAME --impure
printfe "%s\n" "cyan" "Upgrading Home Manager packages..."
cd $HOME/dotfiles/config/home-manager && NIXPKGS_ALLOW_UNFREE=1 home-manager switch -b backup --flake .#$DOTF_HOSTNAME --impure

View File

@ -28,6 +28,15 @@ update() {
"$update_script" $@
}
upgrade() {
local upgrade_script="$DOTFILES_BIN/actions/upgrade.sh"
if [[ ! -x "$upgrade_script" ]]; then
printfe "%s\n" "red" "Error: Upgrade script not found or not executable"
return 1
fi
"$upgrade_script" $@
}
term() {
local term_script="$DOTFILES_BIN/actions/term.sh"
if [[ ! -x "$term_script" ]]; then
@ -114,6 +123,7 @@ main() {
# Parse commands
case "${1:-help}" in
update) shift; update "$@" ;;
upgrade) shift; upgrade "$@" ;;
help) shift; help "$@" ;;
term) shift; term "$@" ;;
secrets) shift; secrets "$@" ;;

View File

@ -1,7 +1,9 @@
Usage: dotf [OPTIONS] [ARGS]
update: Pull latest changes, and update symlinks and configurations.
update: Pull latest changes, and update symlinks and configurations
Also pulls latest nix channels and updates flakes to latest versions.
upgrade: Runs switch, flake variants for nix switch with upgrade and home-manager.
secrets: Encrypt and decrypt secrets.
auto-start: Start a set of pre-defined applications.
term: Shows the welcome message for the terminal.