From 89e77f766c4ccfbea0f33368b7208d3c32d3424e Mon Sep 17 00:00:00 2001 From: aminedjeghri Date: Mon, 10 Feb 2025 04:05:13 +0100 Subject: [PATCH] :construction: migrating to chezmoi and mkdocs --- .chezmoidata/packages.yaml | 1 + CONTRIBUTING.md | 4 ++ Makefile | 4 +- README.md | 20 ++------ dotfiles/dot_zshrc | 50 ------------------- dotfiles/run_onchange_1_setup_linux.sh.tmpl | 22 -------- dotfiles/run_onchange_1_setup_macos.sh.tmpl | 13 ----- ...mpl => run_onchange_1-install-apps.sh.tmpl | 7 +-- run_onchange_1_setup_linux.sh.tmpl | 12 ----- ...sh.tmpl => run_onchange_3-dotfiles.sh.tmpl | 0 10 files changed, 12 insertions(+), 121 deletions(-) delete mode 100644 dotfiles/dot_zshrc delete mode 100644 dotfiles/run_onchange_1_setup_linux.sh.tmpl delete mode 100644 dotfiles/run_onchange_1_setup_macos.sh.tmpl rename run_onchange_2_apps.sh.tmpl => run_onchange_1-install-apps.sh.tmpl (92%) delete mode 100644 run_onchange_1_setup_linux.sh.tmpl rename run_onchange_3_zsh.sh.tmpl => run_onchange_3-dotfiles.sh.tmpl (100%) diff --git a/.chezmoidata/packages.yaml b/.chezmoidata/packages.yaml index 2d70130..349973f 100644 --- a/.chezmoidata/packages.yaml +++ b/.chezmoidata/packages.yaml @@ -3,6 +3,7 @@ packages: brews: - 'git' - 'zsh' + - 'chezmoi' casks: - 'brave-browser' - 'raycast' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b3c3b9e..a2691fc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,6 +35,10 @@ By participating, you are expected to uphold this code. Please report unacceptab ### 4.1 File structure (🌳 Tree) Check the readme file. +- When you run ``make install``, it will run ``[setup_os.sh](setup_os.sh)`` and ``chezmoi apply``. +- chezmoi apply will run all the scripts that start with ``run_``. +- You can check the [documentation of chezmoi](https://www.chezmoi.io/) + ### 4.2 Steps for Installation (Contributors and maintainers) - The first step is [to install, read and test the project as a user](README.md#-steps-for-installation-users) diff --git a/Makefile b/Makefile index 62e0f84..9e5668a 100644 --- a/Makefile +++ b/Makefile @@ -11,10 +11,10 @@ UV := "$$HOME/.local/bin/uv" # keep the quotes incase the path contains spaces install: ./setup_os.sh - chezmoi apply + @chezmoi apply # @echo "${YELLOW}=========> Installing dependencies...${NC}" # @$(UV) sync - @echo "${GREEN}Dependencies installed.${NC}" +# @echo "${GREEN}Dependencies installed.${NC}" pre-commit: @echo "${YELLOW}=========> Running pre-commit...${NC}" diff --git a/README.md b/README.md index f706be3..f4acf75 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,8 @@ You can follow this repository to get a similar setup on Windows11, Linux or bot * [Contributing](#contributing) + + ## 1. Windows 11-WSL2 Valuable applications & tips for enhancing your Windows user experience, with a focus on creating a productive @@ -97,23 +99,7 @@ Based on your needs, you can choose your OS. ## Contributing -- Git clone the repository -- Install and run pre-commit to check the code before pushing it with : - - `pip install pre-commit` - - `pre-commit install` - - `pre-commit run --all-files` - -- Generated docs: - - If you modify the README.md file, remember to modify it in the `docs` folder as well and adapt the paths. - - A folder named `docs` contains the docs for generating the website with Jetbrains Writerside plugin. - - Writerside supports only one file named `README.md`, that's why you will find other readme files - like `unix_workflow/README_unix.md` instead of being named `unix_workflow/README.md`. -- Modifying dotfiles like `.zshrc`: -- use `stow` to create symlinks to the dotfiles in your home directory as follows: -- `cd docs/unix_workflow/` then ``stow -t $HOME -R dotfiles `` - - This will create symlinks to the dotfiles in your home directory: ``cd ~ && cat .zshrc`` -- WARNING: Windows users can't open the dotfiles in their home directory with their text editor, you can only do it with - the terminal or open them in the repo folder. + **Star History Chart** [![Star History Chart](https://api.star-history.com/svg?repos=aminedjeghri/awesomewindows11&type=Date)](https://star-history.com/#aminedjeghri/awesomewindows11&Date) diff --git a/dotfiles/dot_zshrc b/dotfiles/dot_zshrc deleted file mode 100644 index 4feb7fc..0000000 --- a/dotfiles/dot_zshrc +++ /dev/null @@ -1,50 +0,0 @@ -# Initialization code that may require console input (password prompts, [y/n] -# confirmations, etc.) must go above this block; everything else may go below. -if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then - source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" -fi - -# If you come from bash you might have to change your $PATH. -# export PATH=$HOME/bin:/usr/local/bin:$PATH - -export ZSH="$HOME/.oh-my-zsh" -# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes -ZSH_THEME="powerlevel10k/powerlevel10k" - -zstyle ':omz:update' mode auto # update automatically without asking - -# Uncomment the following line to enable command auto-correction. -# ENABLE_CORRECTION="true" - -HIST_STAMPS="mm/dd/yyyy" - -# Standard plugins can be found in $ZSH/plugins/ -# Custom plugins may be added to $ZSH_CUSTOM/plugins/ -plugins=(git - dirhistory - history - colored-man-pages - jsontools - zsh-autocomplete - zsh-autosuggestions - zsh-syntax-highlighting - fzf-zsh-plugin - ) - -source $ZSH/oh-my-zsh.sh - -# For a full list of active aliases, run `alias`. -alias cat="bat" -export PATH=/opt/homebrew/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Applications/iTerm.app/Contents/Resources/utilities:/Users/aminedjeghri/.oh-my-zsh/custom/plugins/fzf-zsh-plugin/bin:/Users/aminedjeghri/.fzf/bin -alias ls="lsd" -alias top="btop" - -# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. -[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh - -. "$HOME/.local/bin/env" -alias python="uv run python" - -export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm -[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion diff --git a/dotfiles/run_onchange_1_setup_linux.sh.tmpl b/dotfiles/run_onchange_1_setup_linux.sh.tmpl deleted file mode 100644 index 9530d8e..0000000 --- a/dotfiles/run_onchange_1_setup_linux.sh.tmpl +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -install_homebrew() { -echo "Installing Homebrew" -yes | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -} - -# Function to update and upgrade packages -update_upgrade_packages() { - if ask_yes_no "Do you want to run sudo apt update & upgrade to load the latest packages?"; then - echo "${YELLOW} Upgrading & Updating your OS ${RESET}" - sudo apt update - sudo apt upgrade - sudo apt autoremove - sudo apt autoclean - fi -} - -{{ if eq .chezmoi.os "linux" -}} -#!/bin/sh -sudo apt update -y -sudo apt upgrade -y -{{ end -}} diff --git a/dotfiles/run_onchange_1_setup_macos.sh.tmpl b/dotfiles/run_onchange_1_setup_macos.sh.tmpl deleted file mode 100644 index faffa5c..0000000 --- a/dotfiles/run_onchange_1_setup_macos.sh.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -install_base_packages() { - -echo "Installing Homebrew" -yes | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - -echo "Installing UV" -curl -LsSf https://astral.sh/uv/install.sh | sh -} - -{{ if eq .chezmoi.os "darwin" -}} -install_base_packages -{{ end -}} diff --git a/run_onchange_2_apps.sh.tmpl b/run_onchange_1-install-apps.sh.tmpl similarity index 92% rename from run_onchange_2_apps.sh.tmpl rename to run_onchange_1-install-apps.sh.tmpl index 88a7c11..abe87b9 100644 --- a/run_onchange_2_apps.sh.tmpl +++ b/run_onchange_1-install-apps.sh.tmpl @@ -7,7 +7,7 @@ RESET=$(printf '\033[0m') GREEN=$(printf '\033[0;32m') echo " ${YELLOW}===========> Second step : running chezmoi apply ${RESET}" -echo " ${YELLOW}===========> Installing apps ${RESET}" +echo " ${YELLOW} Installing apps ${RESET}" # Function to check for a command and install it if not found check_and_install() { local command_name=$1 @@ -24,18 +24,15 @@ check_and_install() { fi } -echo " ${YELLOW} Installing apps ${RESET}" +########## MacOS {{ if eq .chezmoi.os "darwin" -}} -# Precompute installed brew formulas and casks installed_brew_apps=$(brew list) -# Install brew formulas {{ range .packages.darwin.brews -}} check_and_install {{ . | quote }} "brew install {{ . | quote }}" "${installed_brew_apps}" {{ end -}} -# Install cask packages {{ range .packages.darwin.casks -}} check_and_install {{ . | quote }} "brew install --cask {{ . | quote }}" "${installed_brew_apps}" {{ end -}} diff --git a/run_onchange_1_setup_linux.sh.tmpl b/run_onchange_1_setup_linux.sh.tmpl deleted file mode 100644 index 1769286..0000000 --- a/run_onchange_1_setup_linux.sh.tmpl +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - - -{{ if eq .chezmoi.os "linux" -}} -. run_once_before_0_setup.sh - - -# Function to update and upgrade packages - -check_and_install "uv" "curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR=\"$HOME/.local/bin\" sh" - -{{ end -}} diff --git a/run_onchange_3_zsh.sh.tmpl b/run_onchange_3-dotfiles.sh.tmpl similarity index 100% rename from run_onchange_3_zsh.sh.tmpl rename to run_onchange_3-dotfiles.sh.tmpl