refactor: update dotfiles paths and remove obsolete configurations
Some checks failed
Nix Format Check / check-format (push) Failing after 40s

This commit is contained in:
2025-03-05 17:26:48 +01:00
parent 498b28fac0
commit 2ce4cfb608
51 changed files with 255 additions and 1406 deletions

View File

@@ -1,4 +1,4 @@
source $HOME/dotfiles/bin/helpers/functions.sh
source $DOTFILES_PATH/bin/helpers/functions.sh
export SSH_AUTH_SOCK=$HOME/.1password/agent.sock
# Check if is_wsl function returns true, don't continue if we are not on WSL

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash
source $HOME/dotfiles/bin/helpers/functions.sh
source $DOTFILES_PATH/bin/helpers/functions.sh
# Define associative array with app_name => command mapping
declare -A apps=(

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
source $HOME/dotfiles/bin/helpers/functions.sh
source $HOMEsource $DOTFILES_PATH/bin/helpers/functions.sh
welcome() {
echo

View File

@@ -1,10 +1,10 @@
#!/usr/bin/env bash
source $HOME/dotfiles/bin/helpers/functions.sh
source $DOTFILES_PATH/bin/helpers/functions.sh
# Print logo
logo
# Print help
cat $HOME/dotfiles/bin/resources/help.txt
cat $DOTFILES_PATH/bin/resources/help.txt
println " " "cyan"

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
source $HOME/dotfiles/bin/helpers/functions.sh
source $DOTFILES_PATH/bin/helpers/functions.sh
if is_wsl; then
output=$(op.exe item get "Dotfiles Secrets" --fields password)
@@ -111,8 +111,8 @@ decrypt_folder() {
if [[ "$1" == "decrypt" ]]; then
printfe "%s\n" "cyan" "Decrypting secrets..."
decrypt_folder ~/dotfiles/secrets
decrypt_folder $DOTFILES_PATH/secrets
elif [[ "$1" == "encrypt" ]]; then
printfe "%s\n" "cyan" "Encrypting secrets..."
encrypt_folder ~/dotfiles/secrets
encrypt_folder $DOTFILES_PATH/secrets
fi

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash
source $HOME/dotfiles/bin/helpers/functions.sh
source $DOTFILES_PATH/bin/helpers/functions.sh
help() {
printfe "%s\n" "green" "Usage: upgrade.sh [options]"
@@ -45,14 +45,14 @@ printfe "%s\n" "cyan" "Limiting to $CORES cores with $JOBS jobs."
if [[ "$RUN_HA" == true ]]; then
printfe "%s\n" "cyan" "Updating Home Manager flake..."
cd $HOME/dotfiles/config/home-manager && nix --extra-experimental-features nix-command --extra-experimental-features flakes flake update
cd $DOTFILES_PATH/config/home-manager && nix --extra-experimental-features nix-command --extra-experimental-features flakes flake update
if command -v home-manager &> /dev/null; then
printfe "%s\n" "cyan" "Cleaning old backup files..."
rm -rf $HOME/.config/mimeapps.list.backup
printfe "%s\n" "cyan" "Upgrading Home Manager packages..."
cd $HOME/dotfiles/config/home-manager && NIXPKGS_ALLOW_UNFREE=1 home-manager --extra-experimental-features nix-command --extra-experimental-features flakes switch -b backup --flake .#$HOSTNAME --impure --cores $CORES -j $JOBS
cd $DOTFILES_PATH/config/home-manager && NIXPKGS_ALLOW_UNFREE=1 home-manager --extra-experimental-features nix-command --extra-experimental-features flakes switch -b backup --flake .#$HOSTNAME --impure --cores $CORES -j $JOBS
if [[ $? -ne 0 ]]; then
printfe "%s\n" "red" "Failed to upgrade Home Manager packages."
@@ -76,7 +76,7 @@ if [[ "$RUN_ANSIBLE" == true ]]; then
fi
printfe "%s\n" "cyan" "Running Ansible playbook..."
cd $HOME/dotfiles/config/ansible && ansible-playbook -i $HOME/dotfiles/config/ansible/inventory.ini $HOME/dotfiles/config/ansible/main.yml --extra-vars "hostname=$HOSTNAME" --extra-vars "ansible_user=$USER" --limit $HOSTNAME --ask-become-pass ${ANSIBLE_VERBOSE:+-vvv}
cd $DOTFILES_PATH/config/ansible && ansible-playbook -i $DOTFILES_PATH/config/ansible/inventory.ini $DOTFILES_PATH/config/ansible/main.yml --extra-vars "hostname=$HOSTNAME" --extra-vars "ansible_user=$USER" --limit $HOSTNAME --ask-become-pass ${ANSIBLE_VERBOSE:+-vvv}
if [[ $? -ne 0 ]]; then
printfe "%s\n" "red" "Failed to upgrade Ansible packages."

View File

@@ -5,7 +5,7 @@ set -euo pipefail
IFS=$'\n\t'
# Script constants
readonly DOTFILES_ROOT="$HOME/dotfiles"
readonly DOTFILES_ROOT="$HOME/.dotfiles"
readonly DOTFILES_BIN="$DOTFILES_ROOT/bin"
# Source helper functions

View File

@@ -1,55 +0,0 @@
#!/usr/bin/env bash
source $HOME/dotfiles/bin/helpers/functions.sh
ensure_flatpak_packages_installed() {
flatpak_packages=($(ls $HOME/dotfiles/config/flatpaks/ | sed 's/.flatpakref//g'))
for package in "${flatpak_packages[@]}"; do
if ! flatpak list | grep -q $package; then
printfe "%s\n" "cyan" " - Installing $package..."
flatpak install -y flathub $package
if [ $? -eq 0 ]; then
printfe "%s\n" "green" " - $package installed successfully"
else
printfe "%s\n" "red" " - $package failed to install"
fi
else
printfe "%s\n" "green" " - $package is already installed"
fi
done
}
print_flatpak_status() {
if is_wsl; then
printfe "%s\n" "yellow" "Running in WSL, skipping Flatpak packages check."
return
fi
printfe "%s" "cyan" "Checking Flatpak packages..."
clear_line
flatpak_packages=($(ls $HOME/dotfiles/config/flatpaks/ | sed 's/.flatpakref//g'))
count=$(echo $flatpak_packages | wc -w)
installed=0
for package in "${flatpak_packages[@]}"; do
if flatpak list | grep -q $package; then
installed=$((installed + 1))
else
if [ "$verbose" = true ]; then
printfe "%s\n" "red" "$package is not installed"
fi
fi
done
printfe "%s" "cyan" "Flatpak"
if [ $installed -eq $count ]; then
printfe "%s" "green" " $installed/$count "
else
printfe "%s" "red" " $installed/$count "
fi
printfe "%s\n" "cyan" "packages installed"
}

View File

@@ -22,16 +22,16 @@ logo() {
fi
# Print if repo is dirty and the count of untracked files, modified files and staged files
if [[ $(git -C ~/dotfiles status --porcelain) ]]; then
if [[ $(git -C $DOTFILES_PATH status --porcelain) ]]; then
printfe "%s" "yellow" "dotfiles is dirty "
printfe "%s" "red" "[$(git -C ~/dotfiles status --porcelain | grep -c '^??')] untracked "
printfe "%s" "yellow" "[$(git -C ~/dotfiles status --porcelain | grep -c '^ M')] modified "
printfe "%s" "green" "[$(git -C ~/dotfiles status --porcelain | grep -c '^M ')] staged "
printfe "%s" "red" "[$(git -C $DOTFILES_PATH status --porcelain | grep -c '^??')] untracked "
printfe "%s" "yellow" "[$(git -C $DOTFILES_PATH status --porcelain | grep -c '^ M')] modified "
printfe "%s" "green" "[$(git -C $DOTFILES_PATH status --porcelain | grep -c '^M ')] staged "
fi
printfe "%s" "blue" "[$(git -C ~/dotfiles rev-parse --short HEAD)] "
if [[ $(git -C ~/dotfiles log origin/master..HEAD) ]]; then
printfe "%s" "yellow" "[!] You have $(git -C ~/dotfiles log origin/master..HEAD --oneline | wc -l | tr -d ' ') commit(s) to push"
printfe "%s" "blue" "[$(git -C $DOTFILES_PATH rev-parse --short HEAD)] "
if [[ $(git -C $DOTFILES_PATH log origin/master..HEAD) ]]; then
printfe "%s" "yellow" "[!] You have $(git -C $DOTFILES_PATH log origin/master..HEAD --oneline | wc -l | tr -d ' ') commit(s) to push"
fi
println "" "normal"