#!/usr/bin/env bash set -o errexit # crash the script when a command crash set -o pipefail # same as above set -o nounset # crash when a variable doesnt exist # TRACE=1 for debug if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace fi cd "$(dirname "$0")" # change script directory main() { # === Init pacman == pacman-key --init pacman-key --populate pacman -S archlinux-keyring --noconfirm # === Update Arch == pacman -Syu --noconfirm # === Remove packages == pacman -R --noconfirm fakeroot-tcp # === Install packages == pacman -S --noconfirm git wget zip openssh bat base-devel make python-pygments micro git-lfs npm sdl2_image nodejs fish autoconf valgrind automake python-virtualenv gdb tk sdl2_mixer exa texlive-most fzf glu man-pages-fr neofetch python-pip opam pacman-contrib cpanminus unison rebuild-detector # === Colors package manager == sed -i "s/#Color/Color/g" /etc/pacman.conf # === Remove SU password == echo -e "# Disable password for specific user\nanri ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers # === Yay == git clone https://aur.archlinux.org/yay.git cd yay || exit makepkg -si --noconfirm # Remove folder cd .. rm -rf yay # Enable *-git package updates yay -Y --devel --save # === AUR packages == yay -S --noconfirm spim-svn # === Rust == curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y source "$HOME"/.cargo/env # Dev tools rustup component add rust-analysis rls # Add Cargo packages from Rust fish -c "fish_add_path $HOME/.cargo/bin" # === Set-up systemd mkdir subsystemctl cd subsystemctl || exit curl -so PKGBUILD https://raw.githubusercontent.com/sorah/arch.sorah.jp/master/aur-sorah/PKGBUILDs/subsystemctl/PKGBUILD makepkg -si --noconfirm cd .. rm -rf tmsubsystemctlp subsystemctl start # === Locales == sed -i "s/#fr_FR.UTF-8 UTF-8/fr_FR.UTF8 UTF-8/g" /etc/locale.gen locale-gen subsystemctl exec sudo localectl set-locale fr_FR.UTF-8 # === Fish == # Remove motd fish -c "set -U fish_greeting" # Reversed search curl -sL https://git.io/fisher | fish -c "source && fisher install jorgebucaran/fisher" fish -c "fisher install jethrokuan/fzf" fish -c "fisher install jorgebucaran/autopair.fish" # SSH rm "$HOME"/.config/fish/functions/fish_ssh_agent.fish 2> /dev/null wget -q https://gitlab.com/kyb/fish_ssh_agent/raw/master/functions/fish_ssh_agent.fish -P "$HOME"/.config/fish/functions/ mkdir "$HOME"/.ssh # Custom config.fish rm "$HOME"/.config/fish/config.fish 2> /dev/null wget -q https://git.kennel.ml/Anri/confOS/raw/branch/main/.config/fish/config_wsl.fish -O "$HOME"/.config/fish/config.fish # Custom prompt shell (based on https://github.com/fish-shell/fish-shell/blob/master/share/tools/web_config/themes/Base16%20Eighties.theme) # Modifications: Changed comment color rm "$HOME"/.config/fish/functions/fish_prompt.fish 2> /dev/null wget -q https://git.kennel.ml/Anri/confOS/raw/branch/main/.config/fish/functions/fish_prompt.fish -P "$HOME"/.config/fish/functions/ fish -c "set -U fish_color_normal normal" fish -c "set -U fish_color_command 99cc99" fish -c "set -U fish_color_quote ffcc66" fish -c "set -U fish_color_redirection d3d0c8" fish -c "set -U fish_color_end cc99cc" fish -c "set -U fish_color_error f2777a" fish -c "set -U fish_color_param d3d0c8" fish -c "set -U fish_color_comment 5c6773" fish -c "set -U fish_color_match 6699cc" fish -c "set -U fish_color_selection white --bold --background=brblack" fish -c "set -U fish_color_search_match bryellow --background=brblack" fish -c "set -U fish_color_history_current --bold" fish -c "set -U fish_color_operator 6699cc" fish -c "set -U fish_color_escape 66cccc" fish -c "set -U fish_color_cwd green" fish -c "set -U fish_color_cwd_root red" fish -c "set -U fish_color_valid_path --underline" fish -c "set -U fish_color_autosuggestion 747369" fish -c "set -U fish_color_user brgreen" fish -c "set -U fish_color_host normal" fish -c "set -U fish_color_cancel -r" fish -c "set -U fish_pager_color_completion normal" fish -c "set -U fish_pager_color_description B3A06D yellow" fish -c "set -U fish_pager_color_prefix normal --bold --underline" fish -c "set -U fish_pager_color_progress brwhite --background=cyan" fish -c "set -U fish_pager_color_selected_background --background=brblack" fish -c "set -U fish_color_option d3d0c8" fish -c "set -U fish_color_keyword 99cc99" # EXA colors fish -c "set -Ux EXA_COLORS 'di=1;36:da=35'" # Add aliases fish -c "abbr ls 'exa --git --icons -gl'" fish -c "abbr cp 'cp -rv'" fish -c "abbr rm 'rm -rf'" fish -c "abbr mgcc 'clear; gcc -Wall -Wextra -Wshadow -Wcast-align -Wstrict-prototypes -fanalyzer -fsanitize=undefined -g main.c && ./a.out; rm a.out 2> /dev/null'" fish -c "abbr vgcc 'clear; gcc -Wall -Wextra -Wshadow -Wcast-align -Wstrict-prototypes -fanalyzer -fsanitize=undefined -g main.c && valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes -s ./a.out; rm a.out 2> /dev/null'" fish -c "abbr mg++ 'clear; g++ -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -g -Wold-style-cast -Wsign-conversion main.cpp && ./a.out; rm a.out 2> /dev/null'" fish -c "abbr vg++ 'clear; g++ -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -g -Wold-style-cast -Wsign-conversion main.cpp && valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes -s ./a.out; rm a.out 2> /dev/null'" fish -c "abbr mmake 'clear; make && ./main; make clean 2> /dev/null'" fish -c "abbr vmake 'clear; make && valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes -s ./main; make clean 2> /dev/null'" fish -c "abbr activate 'source bin/activate.fish'" fish -c "abbr c 'command'" fish -c "abbr vs 'code .'" fish -c "abbr untgz 'tar xvzf'" fish -c "abbr tgz 'tar czf \"Archive.tar.gz\"'" fish -c "abbr - 'cd -'" fish -c "abbr cd.. 'cd ..'" fish -c "abbr cat 'bat'" fish -c "abbr nano 'micro'" fish -c "abbr bigupdate 'yay -Syu --noconfirm && tldr --update && yes | sdk update && yes | sdk upgrade java'" fish -c "abbr d 'explorer.exe .'" fish -c "abbr gc 'git clone'" fish -c "abbr cl 'cat src/**.* | sed \'/^\s*$/d\' | wc -l'" fish -c "abbr mirrors_update \"curl -s 'https://archlinux.org/mirrorlist/?country=FR&country=GB&protocol=https&use_mirror_status=on' | sed -e 's/^#Server/Server/' -e '/^#/d' | sudo bash -c 'rankmirrors -n 7 - > /etc/pacman.d/mirrorlist' && sudo pacman -Syy\"" fish -c "abbr ocamlbuild 'ocamlbuild -no-hygiene'" fish -c "abbr opamupdate 'opam update && opam upgrade -y'" fish -c "abbr yay-rebuild 'checkrebuild | awk \'{print \$2}\' | xargs -r yay -S --rebuildtree --noconfirm'" fish -c "abbr pacman-clean 'sudo pacman -Rsn \$(pacman -Qqtd) --noconfirm'" # === Micro configuration == git config --global core.editor "micro" fish -c "set -Ux EDITOR micro" mkdir "$HOME"/.config/micro wget -q --show-progress https://git.kennel.ml/Anri/confOS/raw/branch/main/.config/micro/settings.json -O "$HOME"/.config/micro/settings.json micro -plugin install detectindent # === GL4D == # Download, build and installation git clone https://github.com/noalien/GL4Dummies.git cd GL4Dummies || exit make -f Makefile.autotools ./configure make make install cd .. rm -rf GL4Dummies # Fix for shared libraries (https://stackoverflow.com/a/9395355) ldconfig # Add to path fish -c "set -Ua LD_LIBRARY_PATH /usr/local/lib" # === Sign commits == git config --global commit.gpgsign true # === tldr == cargo install tealdeer tldr --update # Fish completion local latest_tldr url_tldr latest_tldr=$(wget -qO- https://api.github.com/repos/dbrgn/tealdeer/releases/latest) url_tldr=$(grep 'browser_download_url": ".*/completions_fish"' <<< "$latest_tldr" | awk "{ print substr ($0, 32 ) }" | awk "{ print substr( $0, 1, length($0)-1 ) }") wget -q --show-progress "$url_tldr" -O completions_fish mv completions_fish ~/.config/fish/completions/tldr.fish # === Java == curl -s "https://get.sdkman.io" | bash source "$HOME/.sdkman/bin/sdkman-init.sh" if [ -x "$HOME"/.config/fish ] ; then if [ ! -f "$HOME"/.config/fish/functions/fisher.fish ] ; then # install fisher if not already installed curl -sL https://git.io/fisher | fish -c "source && fisher install jorgebucaran/fisher" fi fish -c "fisher install reitzig/sdkman-for-fish" fi sdk install java 17.0.4.1-tem # https://whichjdk.com/#adoptium-eclipse-temurin yes | sdk upgrade java # === Manual color == fish -c "set -Ux MANPAGER \"sh -c 'col -bx | bat -l man -p'\"" # === Shared folders == mkdir /mnt/y # === Git == git config --global user.email "kennel.anri@tutanota.com" git config --global user.name "Mylloon" git config --global pull.rebase true git config --global init.defaultBranch main # === Python == # Add PIP packages from Python fish -c "fish_add_path $HOME/.local/bin" # === OCaml == # Init Opam and install stuff echo | opam init yes | opam init opam install -y utop ocaml-lsp-server ocamlformat ocamlformat-rpc wget -q https://git.kennel.ml/Anri/confOS/raw/branch/main/dotfiles/.ocamlformat -O "$HOME"/.ocamlformat # Add Opam packages from OCaml fish -c "fish_add_path $HOME/.opam/default/bin" # Fix dlllwt_unix_stubs.so shared object file fish -c "set -Ux CAML_LD_LIBRARY_PATH $(opam var stublibs)" # === Clang == wget -q https://git.kennel.ml/Anri/confOS/raw/branch/main/dotfiles/.clang-format -O "$HOME"/.clang-format # === LaTeX == # Pour latexindent sudo cpanm YAML::Tiny File::HomeDir # === Valgrind == fish -c "set -Ux DEBUGINFOD_URLS https://debuginfod.archlinux.org" # === Unison == wget -q https://git.kennel.ml/Anri/confOS/raw/branch/main/.unison/default.prf -O "$HOME"/.unison/default.prf # === Clear useless packages pacman -Rsn "$(pacman -Qqtd)" 2> /dev/null echo -e "\nInstallation terminée !\nIl faut redémarrer WSL (dans Powershell = wsl --shutdown)." echo -e "---\nPense bien à paramétrer ton terminal, exemple avec Windows Terminal :" echo "- Ligne de commande = wsl.exe -d Arch fish" echo "- Profils par défaut => Apparence :" echo " - Jeu de couleur = One Half Dark" echo " - Type de police = Caskaydia Cove Nerd Font Complete Mono Windows Compatible" echo " (à télécharger ici : https://www.nerdfonts.com/font-downloads)" } if grep "WSL2" /proc/version > /dev/null; then main "$@" else echo "Ce script ne fonctionne que sur ArchWSL." >&2 fi