From 15b6581aa100de2133d85af9d69438453acd1654 Mon Sep 17 00:00:00 2001 From: tombdf Date: Wed, 18 Dec 2024 01:00:03 +0100 Subject: [PATCH] feat(install): add initial setup script - Added install.sh script to automate the installation process. - Included functions for initial checks, component installation, and configuration setup. - Ensured the script runs with strict mode enabled for better error handling. - Added user confirmation prompt before starting the setup. - Displayed a completion message and prompt for system reboot. --- README.md | 225 +++++++++++++++++++++++++++++++++++++++++ install.sh | 49 +++++++++ scripts/core.sh | 22 ++++ scripts/desktop.sh | 35 +++++++ scripts/development.sh | 20 ++++ scripts/shells.sh | 68 +++++++++++++ utils/colors.sh | 8 ++ utils/helpers.sh | 161 +++++++++++++++++++++++++++++ utils/packages | 66 ++++++++++++ 9 files changed, 654 insertions(+) create mode 100644 README.md create mode 100755 install.sh create mode 100644 scripts/core.sh create mode 100644 scripts/desktop.sh create mode 100644 scripts/development.sh create mode 100644 scripts/shells.sh create mode 100644 utils/colors.sh create mode 100644 utils/helpers.sh create mode 100644 utils/packages diff --git a/README.md b/README.md new file mode 100644 index 0000000..4523154 --- /dev/null +++ b/README.md @@ -0,0 +1,225 @@ +

.dotfiles πŸ“

+ + [ 
 About 
 
](#about-this-repository)  + [ 
 Installation 
 
](#installation)  + [ 
 Usage 
 
](#usage)  + [ 
 Troubleshooting 
 
](#troubleshooting)  +

+ +## About this repository +It contains all my configuration files and the script permitting to install my configuration on any Arch-based Linux distribution or any Linux distribution (as long as you can install [that](#prerequisites)). + +**Overview :** +- [πŸ’» OS](): + - [Arch Linux πŸ’₯](https://archlinux.org/) +- [πŸͺŸ Windows Manager](): + - [HyprLand 🍚](https://hyprland.org/) +- [πŸ“Ÿ Widgets](): + - [ Eww 🀒](https://github.com/elkowar/eww) +- [πŸ‘½ Terminal](): + - [β˜„ Emulator](): + - [Kitty 😽](https://sw.kovidgoyal.net/kitty/) + - [🐚 Shell](): + - [fish 🐟](https://fishshell.com/) with [Fisher 🎣](https://github.com/jorgebucaran/fisher) + - [Zsh πŸ“‘]() with [Zinit 🌻](https://github.com/zdharma-continuum/zinit) + - [Bash πŸ“»]() + - **πŸ€– Prompt**: [Oh-My-Posh πŸ”‹](https://ohmyposh.dev/) + - [πŸ“ Editor](): + - [Vim πŸ‘Ύ](https://www.vim.org/) + - [NeoVim πŸ‘“](https://neovim.io/) with [NvChad πŸ—Ώ](https://nvchad.com/) +- [πŸ”Ž Browser](): + - [Firefox 🌐](https://www.mozilla.org/fr/firefox/) + +Check the `utils/packages` file to see all the packages installed by the script. + +
+ +## Installation +### Prerequisites +`Git`, `pacman` and `sudo` are necessary, be sure to have them install and configure! +You may want to install the appropriate [driver](https://wiki.archlinux.org/title/NVIDIA) if you have an NVIDIA GPU. + +### Installation guide +Clone this repository in your home directory with the `git clone` command. +``` +git clone https://gitea.hexasec.io/tombdf/.dotfiles.git ~/.dotfiles +``` +Then execute the `install.sh` script file. +``` +~/.dotfiles/install.sh +``` +> [!CAUTION] +> I do **NOT** recommand you to change the name of the `.dotfiles` directory nor do I recommand you to place the folder somewhere else than the home directory. + +### Finishing the configuration +The script will end by itself. I recommend you to restart your computer. +After restarting and opening the terminal, Fisher will install all the plugins. +If you have access to Github Copilot, I recommend you to log in neovim with the `Copilot auth` command. +I also recommend you to launch Firefox and create a Betterfox profile (using the `~/.config/betterfox/` folder). You can follow [this tutorial](https://github.com/yokoffing/Betterfox?tab=readme-ov-file). You may want to add an DNS in `user.js` (search line `user_pref("network.trr.uri", "");`). +You may also setup the DNS in `/etc/systemd/resolved.conf` (I use [NextDNS](https://nextdns.io/) for that). +Once you've done that, it's all good, enjoy your new config! +PS: Don't forget to check the log file + +
+ +## Usage +The following sections will resume what usage you can have of different commands, text editors or terminal emulator. + +### Commands +With Zsh and Zinit, a lot of commands will be installed. They're very useful and powerful so it might be a good idea to learn what they are. +Note : Two keybindings are define in `.zshrc`. They are p and n. Use them for navigate in your command history. + +#### Zoxide +**Commands** : `z` | `zi` +**Replaced by** : `cd` | `cdi` +[Github page](https://github.com/ajeetdsouza/zoxide) + +Zoxide is a **cd** replacement. It will work fine as cd does, but every time you use the command, it will remember the path to the directory. +After a little bit of time using the command, you could use it to "jump" to a repository i.e. you could only write a part of the path to the directory. You could also not write the entire name of the directory. +If you want to see all the repository remembered by Zoxide, you can use the `cdi` command. +**Note** : Zoxide integrate a system to replace the original `z` command by another (alternative to alias). That mean that only the "new" command work, not the original work. You can find the command in the Shell configuration file. + +Usage of the command : `tldr zoxide` + +
+ +#### Lsd +**Command** : `lsd` +**Aliased by** : `ls` | `ll` +[Github page](https://github.com/lsd-rs/lsd-rs) + +Lsd is a **ls** replacement. It will add colors, icons and even git status to the display. +The `ll` alias will print all the informations on all the files (including hidden files) in a directory. Check the aliases in the Shell configuration file. + +Usage of the command : `tldr lsd` + +
+ +#### Rip +**Command** : `rip` +**Aliased by** : `rm` +[Github page](https://github.com/nivekuil/rip) + +Rip is a **rm** replacement. It will send all the deleted files to the graveyard (`/tmp/graveyard-$USER` or `$XDG_DATA_HOME/graveyard`), which means that the files can be restored. +The files can only be deleted permanently by deleting the entire graveyard with the appropriate flag. Note that the graveyard can be put where you want with the right option. + +Usage of the command : `tldr rip` + +
+ +#### Bat +**Command** : `bat` +**Aliased by** : `cat` +[Github page](https://github.com/sharkdp/bat) + +Bat is a **cat** replacement. It supports syntax-highlighting and git integration. +It can be use as a pager. + +Usage of the command : `tldr bat` + +
+ +#### Ripgrep +**Command** : `rg` +**Aliased by** : `grep` +[Github page](https://github.com/BurntSushi/ripgrep) + +Ripgrep is a **grep** replacement. It's a faster and recursive alternative to the original command. + +Usage of the command : `tldr rg` + +
+ +#### Fd +**Command** : `fd` +**Aliased by** : `find` +[Github page](https://github.com/sharkdp/fd) + +Fd is a **find** replacement. It's a faster and more user-friendly alternative to the original command. +The alias is set to show the hidden directory as well. Check the alias in the Shell configuration file. + +Usage of the command : `tldr fd` + +
+ +#### Sd +**Command** : `sd` +**Aliased by** : `sed` +[Github page](https://github.com/chmln/sd) + +Sd is a **sed** replacement. It's a faster and more intuitive alternative to the original command. + +Usage of the command : `tldr sd` + +
+ +#### Topgrade +**Command** : `topgrade` +[Github page](https://github.com/topgrade-rs/topgrade) + +Topgrade permit to update, not only the system, but also all the packages and the git repository. It update **ALL** the things. + +Usage of the command : `tldr topgrade` + +
+ +#### Tealdeer +**Command** : `tldr` +[Github page](https://github.com/dbrgn/tealdeer) + +Tealdeer is a faster TLDR. It shows you pages written by community on different commands and programs. +The pages shows different common and useful uses of commands. + +### Text editors +Differents text editors are available with my config. They're very powerful if you know how to use them and if you know the right keyboard shortcuts. + +#### Vim +**Command** : `vim` +**Replaced by** : `vi` +**Leader** : `,` + +Vim is installed with vim-plug plugin manager and the Gruvbox theme. In Vim, you can use the `PlugInstall` command to install the plugin, and `Minimap` to toggle the minimap. +In Insert mode, you can use the `jj` mapping to go in Normal mode, and type Space to enter Command mode. +Also in Insert mode, you can use the `'` mapping to open a block instruction. +In Normal mode, use the `j`|`k`|`l`|`m` keys to move. Use the `` mapping to open NerdTree. + +To see all the mappings, check the `.vimrc` config file. + +
+ +#### Neovim with NvChad +**Command** : `nvim` +**Aliased by** : `vim` +**Leader** : `,` +[NvChad Github page](https://github.com/NvChad/NvChad) + +Neovim is installed with the NvChad config. The basics mappings in Neovim are the same as the ones describes [here](#Vim). +To see (almost) all the mappings, use the `ch` mapping. +Use the `Lazy` command in Neovim to manage the plugins, and the `Mason` command to manage LSP. +Type the `Copilot` command and type `tab` to see all the command available to use Copilot and CopilotChat. + +To see all the mappings, check the `mappings.lua` file in `.config/nvim/lua/`. To see all the plugins, check the `plugins.lua` file in `.config/nvim/lua/plugins`. + +### Terminal emulator +Kitty is the terminal emulator use in this config. +The leader key is Ctrl+Shift, here is a list of useful mappings : +* `t` : Create a new tab. +* `q` : Close a tab. +* `` : Split a tab. +* `` : Move between the different tab. + +Check the `kitty.conf` file in `.config/kitty/` to see all the possibility offered by Kitty. + +
+ +## Troubleshooting +Before doing anything, verify that all the packages listed [here](#necessary-packages) are installed with the latest stable version. + +### Fish +If something went wrong when sourcing the config file, it might be that fish_inclusion was not delete preventing, when sourcing the file again, the downloading or the call of certains plugins. +To fix that, you just have to run manually the command to reset the variable : set -e fish_inclusion + +### Neovim +If NvChad seems not to be installed, be sure to have the latest version of Neovim installed. +For any problem with a plugin, use the `checkhealth` command and see if anything wrong with the plugin is mentioned. +If you get an error message like this : **"Client 1 quit with code 1"**, it might mean that a package is missing for Mason to work correctly. diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..3f2a30e --- /dev/null +++ b/install.sh @@ -0,0 +1,49 @@ +#!/bin/bash +clear + +# Enable strict mode for bash +set -euo pipefail + +# Define functions and colors +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${SCRIPT_DIR}/utils/colors.sh" +source "${SCRIPT_DIR}/utils/helpers.sh" + +LOG="install.log" +[ -f "$LOG" ] && rm -f "$LOG" +touch "$LOG" + +# Displau logo and information +display_header + +# Initial checks +check_not_root +check_internet +check_arch + +# Request confirmation +echo "β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”" +echo "β”‚ Start Setup? (y/N) β”‚" +echo "β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜" +read -p "~> " inst +case $inst in + y | Y) echo -e "\nStarting setup..." ;; + *) echo -e "\nSetup cancelled." && exit 0 ;; +esac + +# Install components +source "${SCRIPT_DIR}/scripts/core.sh" +source "${SCRIPT_DIR}/scripts/desktop.sh" +source "${SCRIPT_DIR}/scripts/shells.sh" +source "${SCRIPT_DIR}/scripts/development.sh" + +# Setup configuration files +echo -e "${GREEN}Setting up configuration files...${DEFAULT}" +setup_dotfiles + +# Final configuration +setup_final + +echo -e "${GREEN}Installation completed successfully!${DEFAULT}" +echo -e "Please reboot your system to apply all changes." +exit 0 diff --git a/scripts/core.sh b/scripts/core.sh new file mode 100644 index 0000000..bfdf54b --- /dev/null +++ b/scripts/core.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +echo -e "${GREEN}Installing core packages...${DEFAULT}" + +# Installation of core packages +check_installation "sudo pacman -S --noconfirm --needed" "base-devel doxygen jdk-openjdk nodejs npm cargo curl wget unzip stow" + +# Installation of yay +if ! command -v yay &> /dev/null; then + echo -e "${BLUE}Installing Yay...${DEFAULT}" + git clone https://aur.archlinux.org/yay.git ~/.config/yay + (cd ~/.config/yay && makepkg -si --noconfirm) + rm -rf ~/.config/yay +fi + +# Verification of yay installation +if ! command -v yay &> /dev/null; then + echo -e "${RED}[ERROR] Yay installation failed${DEFAULT}" | tee -a "$LOG" + exit 1 +fi + +echo -e "${GREEN}Core installation completed${DEFAULT}" diff --git a/scripts/desktop.sh b/scripts/desktop.sh new file mode 100644 index 0000000..096d5dc --- /dev/null +++ b/scripts/desktop.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Installing Hyprland core components +echo -e "${GREEN}Installing Hyprland core components...${DEFAULT}" +check_installation "sudo pacman -S --noconfirm --needed" "wayland hyprland waybar hyprpaper xdg-desktop-portal-hyprland xdg-desktop-portal-gtk polkit-gnome" + +# Installing audio components +echo -e "${GREEN}Installing audio components...${DEFAULT}" +check_installation "sudo pacman -S --noconfirm --needed" "pipewire pipewire-pulse wireplumber pamixer pavucontrol" + +# Installing system utilities +echo -e "${GREEN}Installing system utilities...${DEFAULT}" +check_installation "sudo pacman -S --noconfirm --needed" "brightnessctl networkmanager network-manager-applet blueman inetutils" + +# Installing GUI applications +echo -e "${GREEN}Installing GUI applications...${DEFAULT}" +check_installation "sudo pacman -S --noconfirm --needed" "rofi thunar thunar-archive-plugin mpv imv" + +# Installing theme tools +echo -e "${GREEN}Installing Qt/GTK configuration tools...${DEFAULT}" +check_installation "sudo pacman -S --noconfirm --needed" "qt5-wayland qt6-wayland qt5ct qt6ct kvantum kvantum-qt5" + +# Installing AUR packages +echo -e "${GREEN}Installing AUR packages...${DEFAULT}" +check_installation "yay -S --noconfirm --needed" "ttf-jetbrains-mono-nerd swaylock-effects wlogout gruvbox-material-gtk-theme-git gruvbox-material-icon-theme-git bibata-cursor-theme" + +# Installing Firefox +echo -e "${GREEN}Installing Firefox...${DEFAULT}" +check_installation "sudo pacman -S --noconfirm" "firefox" + +# Configuring Firefox +mkdir -p $HOME/.config/betterfox/ +git update-index --assume-unchanged ~/.dotfiles/.config/betterfox/user.js + +echo -e "${GREEN}Desktop environment installation completed${DEFAULT}" diff --git a/scripts/development.sh b/scripts/development.sh new file mode 100644 index 0000000..3860dce --- /dev/null +++ b/scripts/development.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Installing Vim +echo -e "${GREEN}Setting up Vim...${DEFAULT}" +check_installation "sudo pacman -S --noconfirm --needed" "vim" +mkdir -p $HOME/.vim/{autoload,backup,colors,plugged} +curl -fLo $HOME/.vim/autoload/plug.vim --create-dirs "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" +check_installation "yay -S --noconfirm --needed" "code-minimap" + +# Installing NeoVim +echo -e "${GREEN}Setting up NeoVim...${DEFAULT}" +check_installation "sudo pacman -S --noconfirm --needed" "neovim wl-clipboard" + +# Installing Kitty +echo -e "${GREEN}Setting up Kitty...${DEFAULT}" +check_installation "sudo pacman -S --noconfirm --needed" "kitty" +echo -e "${GREEN}Setting up Gruvbox theme for Kitty...${DEFAULT}" +mkdir -p $HOME/.config/kitty +git clone --depth 1 https://github.com/dexpota/kitty-themes.git $HOME/.config/kitty/kitty-themes +ln -sf kitty-themes/themes/gruvbox_dark.conf $HOME/.config/kitty/theme.conf diff --git a/scripts/shells.sh b/scripts/shells.sh new file mode 100644 index 0000000..7c0ff96 --- /dev/null +++ b/scripts/shells.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +# Installing alternative shells +echo -e "${GREEN}Installing alternative shells...${DEFAULT}" + +# Installing and configuring Zsh +echo -e "${BLUE}Setting up Zsh and Powerline...${DEFAULT}" +check_installation "sudo pacman -S --noconfirm --needed" "zsh powerline" + +# Installing and configuring Fish +echo -e "${BLUE}Setting up Fish...${DEFAULT}" +check_installation "sudo pacman -S --noconfirm --needed" "fish" +mkdir -p ~/.config/fish/ + +# Installing prompt themes +echo -e "${BLUE}Installing Oh-My-Posh...${DEFAULT}" +check_installation "yay -S --noconfirm --needed" "oh-my-posh" + +# Installing navigation and search tools +echo -e "${GREEN}Installing navigation and search tools...${DEFAULT}" + +# Zoxide - An intelligent cd that learns your habits +echo -e "${BLUE}Setting up Zoxide and FZF...${DEFAULT}" +check_installation "sudo pacman -S --noconfirm --needed" "zoxide fzf" + +# Installing modern alternatives to classic Unix commands +echo -e "${GREEN}Installing modern Unix tools...${DEFAULT}" + +# lsd - A modern ls with a icons and coloring +echo -e "${BLUE}Installing lsd...${DEFAULT}" +check_installation "sudo pacman -S --noconfirm --needed" "lsd" + +# rip - A modern alternative to rm +echo -e "${BLUE}Installing rip (rm-improved)...${DEFAULT}" +check_installation "yay -S --noconfirm --needed" "rm-improved-git" + +# bat - A modern cat with syntax highlighting +echo -e "${BLUE}Installing bat...${DEFAULT}" +check_installation "sudo pacman -S --noconfirm --needed" "bat" + +# ripgrep - A modern alternative to grep +echo -e "${BLUE}Installing ripgrep...${DEFAULT}" +check_installation "sudo pacman -S --noconfirm --needed" "ripgrep" + +# fd - A modern alternative to find +echo -e "${BLUE}Installing fd...${DEFAULT}" +check_installation "sudo pacman -S --noconfirm --needed" "fd" + +# sd - A modern alternative to sed +echo -e "${BLUE}Installing sd...${DEFAULT}" +check_installation "sudo pacman -S --noconfirm --needed" "sd" + +# Installing maintenance tools +echo -e "${GREEN}Installing maintenance tools...${DEFAULT}" + +# Topgrade - Universal update tool +echo -e "${BLUE}Installing Topgrade...${DEFAULT}" +check_installation "yay -S --noconfirm --needed" "topgrade" + +# Tealdeer - A fast implementation of tldr +echo -e "${BLUE}Installing TLDR (tealdeer)...${DEFAULT}" +check_installation "sudo pacman -S --noconfirm --needed" "tealdeer" + +# Changing the default shell to Fish +echo -e "${GREEN}Setting Fish as default shell...${DEFAULT}" +chsh -s $(which fish) + +echo -e "${GREEN}Shell configuration completed${DEFAULT}" diff --git a/utils/colors.sh b/utils/colors.sh new file mode 100644 index 0000000..80abebc --- /dev/null +++ b/utils/colors.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Definition of colors +BLUE="\033[1;34m" +GREEN="\e[32m" +RED="\e[31m" +YELLOW="\e[33m" +DEFAULT="\033[0m" diff --git a/utils/helpers.sh b/utils/helpers.sh new file mode 100644 index 0000000..f4835f8 --- /dev/null +++ b/utils/helpers.sh @@ -0,0 +1,161 @@ +#!/bin/bash + +# Check that the script is not run as root +function check_not_root() { + if [ "$(id -u)" -eq 0 ]; then + echo -e "${RED}[ERROR] This script shall not be executed as root${DEFAULT}" | tee -a "$LOG" + exit 1 + fi +} + +# Check that an internet connection is available +function check_internet() { + if ping -q -c 1 -W 1 archlinux.org >/dev/null; then + echo -e "${GREEN}Internet connection is available${DEFAULT}" | tee -a "$LOG" + else + echo -e "${RED}[ERROR] Internet connection is not available${DEFAULT}" | tee -a "$LOG" + exit 1 + fi +} + +# Check that the system is Arch Linux +function check_arch() { + if [ -f "/etc/arch-release" ]; then + echo -e "${GREEN}Arch Linux detected${DEFAULT}" | tee -a "$LOG" + else + echo -e "${RED}[ERROR] Arch Linux not detected${DEFAULT}" | tee -a "$LOG" + exit 1 + fi +} + +# Secure installation of packages +function check_installation() { + local command=$1 + local package=$2 + echo -e "${BLUE}Installing $package...${DEFAULT}" | tee -a "$LOG" + + if ! $command $package; then + echo -e "${RED}[ERROR] Installation of $package failed${DEFAULT}" | tee -a "$LOG" + return 1 + fi + echo -e "${GREEN}$package installed successfully${DEFAULT}" | tee -a "$LOG" + return 0 +} + +# Configuration backup function +function backup_config() { + local path=$1 + if [ -e "$path" ]; then # VΓ©rifie si le fichier ou le rΓ©pertoire existe + local backup_path="${path}.backup.$(date +%Y%m%d_%H%M%S)" + echo -e "${BLUE}Backing up $path to $backup_path${DEFAULT}" | tee -a "$LOG" + mv "$path" "$backup_path" + fi +} + +# Final system configuration +function setup_final() { + echo -e "${BLUE}Performing final system configuration...${DEFAULT}" | tee -a "$LOG" + + # Enable systemd services + systemctl --user enable --now pipewire.service + systemctl --user enable --now pipewire-pulse.service + + # Configure git if necessary + if [ -z "$(git config --global user.name)" ]; then + echo -e "${BLUE}Configuring Git...${DEFAULT}" + read -p "Enter your Git name: " git_name + read -p "Enter your Git email: " git_email + git config --global user.name "$git_name" + git config --global user.email "$git_email" + fi + + # Setting up Vim plugins + echo -e "${GREEN}Installing Vim plugins...${DEFAULT}" + vim -E -s -u "~/.vimrc" +PlugInstall +qall >/dev/null 2>&1 + + # Setting up NeoVim plugins + echo -e "${GREEN}Installing NeoVim plugins...${DEFAULT}" + nvim +Lazy +MasonInstallAll +MasonUpdate +180sleep +qall + + # Clean up the system + echo -e "${BLUE}Cleaning up the system...${DEFAULT}" | tee -a "$LOG" + yay -Yc --noconfirm +} + +# Display logo and information +function display_header() { + echo -e "${BLUE}" + cat <<"EOF" + + β–„ + β–„β–ˆβ–„ + β–„β–ˆβ–ˆβ–ˆβ–„ + β–„β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–„ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ + β–„β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–„ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ + β–„ β–€β–€β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–„ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ + β–„β–ˆβ–ˆβ–„β–„ β–€β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–„ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ + β–„β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–„ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ + β–„β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–„ + β–„β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–„ + β–„β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–„ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” + β–„β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–€β–€β–€β–€β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–„ β”‚ β”‚ + β–„β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–€ β–€β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–„ β”‚ β€’ "Welcome to the Arch Linux DotFiles Setup Script!" β”‚ + β–„β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–€β–€β–ˆβ–ˆβ–„ β”‚ β”‚ + β–„β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–„β–„β–„ β”‚ β€’ Created by Thomas Brasdefer β”‚ + β–„β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–€ β–€β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–„ β”‚ β€’ Find me at hexasec.io or gitea.hexasec.io/tombdf β”‚ + β–„β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–€β–€β–€ β–€β–€β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–„ β”‚ for more. β”‚ + β–„β–ˆβ–ˆβ–ˆβ–€β–€ β–€β–€β–ˆβ–ˆβ–ˆβ–„ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ + β–„β–€β–€ β–€β–€β–„ + +Notes. + - Operation on non-Arch Linux based is not guaranteed. + - NVIDIA GPUs are supported. + - Do not run this script as root. + - Do NOT interrupt the script, it will end by itself. +EOF + echo -e "${DEFAULT}" +} + +# Function to manage configurations files with stow +function setup_dotfiles() { + echo -e "${BLUE}Setting up configuration files...${DEFAULT}" | tee -a "$LOG" + + # Check for existence of .dotfiles directory + if [ ! -d "$HOME/.dotfiles" ]; then + echo -e "${RED}[ERROR] .dotfiles directory not found${DEFAULT}" | tee -a "$LOG" + return 1 + fi + + # Backup existing configurations + local configs_to_backup=( + "$HOME/.config/hypr/" + "$HOME/.config/waybar/" + "$HOME/.config/nvim/" + "$HOME/.config/ohmyposh/" + "$HOME/.vimrc" + "$HOME/.bashrc" + "$HOME/.zshrc" + "$HOME/.config/fish/fish.config" + ) + + for config in "${configs_to_backup[@]}"; do + backup_config "$config" + done + + # Apply configurations with stow + echo -e "${BLUE}Applying dotfiles with stow...${DEFAULT}" | tee -a "$LOG" + cd "$HOME/.dotfiles" || exit 1 + + # Unstow first in case of existing links + stow -D . 2>/dev/null || true + + # Stow new configuration + if stow .; then + echo -e "${GREEN}Configuration files installed successfully${DEFAULT}" | tee -a "$LOG" + else + echo -e "${RED}[ERROR] Failed to install configuration files${DEFAULT}" | tee -a "$LOG" + return 1 + fi + + return 0 +} diff --git a/utils/packages b/utils/packages new file mode 100644 index 0000000..d594e7d --- /dev/null +++ b/utils/packages @@ -0,0 +1,66 @@ +base-devel +doxygen +jdk-openjdk +nodejs +npm +cargo +curl +wget +unzip +stow +yay +wayland +hyprland +waybar +hyprpaper +xdg-desktop-portal-hyprland +xdg-desktop-portal-gtk +polkit-gnome +pipewire +pipewire-pulse +wireplumber +pamixer +pavucontrol +brightnessctl +networkmanager +network-manager-applet +blueman +inetutils +rofi +thunar +thunar-archive-plugin +mpv +imv +qt5-wayland +qt6-wayland +qt5ct +qt6ct +kvantum +kvantum-qt5 +ttf-jetbrains-mono-nerd +swaylock-effects +wlogout +gruvbox-material-gtk-theme-git +gruvbox-material-icon-theme-git +bibata-cursor-theme +firefox +vim +vim-plug +code-minimap +neovim +wl-clipboard +kitty +kitty-themes +zsh +powerline +fish +oh-my-posh +zoxide fzf +lsd +rm-improved-git +bat +ripgrep +fd +sd +topgrade +tealdeer