Last active
August 30, 2021 20:23
-
-
Save lvaylet/5bad228cfb854756dac972d67dcfe969 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Instructions | |
# --- | |
# On top of a clean install of Arch Linux, for example after https://gist.github.com/lvaylet/c931e881f4038080b47646be1da6be65: | |
# | |
# 1. Download this script with: | |
# $ curl -Lo install_my_linux.sh -H 'Cache-Control: no-cache' https://gist.githubusercontent.com/lvaylet/5bad228cfb854756dac972d67dcfe969/raw | |
# or, thanks to GitHub's URL shortener: | |
# $ curl -Lo install_my_linux.sh -H 'Cache-Control: no-cache' https://git.io/JRsiW | |
# | |
# 2. Make the script executable by the current user with: | |
# $ chmod u+x install_my_linux.sh | |
# | |
# 3. Run the script with: | |
# $ ./install_my_linux.sh | |
# TODO | |
# [ ] Install and configure zsh, Oh-My-Zsh and Powerlevel10k (or stick with bash/zsh/fish + Startship?) | |
# [ ] Install Rust programs recommended by DistroTube as replacements of GNU utils (https://www.youtube.com/watch?v=dQa9mveTSV4) | |
################################################################################ | |
# Print beautiful banners with `boxes` (https://boxes.thomasjensen.com/) | |
banner () { | |
echo "$1" | boxes -d stone -p a1h20 | |
} | |
################################################################################ | |
banner 'NTP' | |
sudo timedatectl set-ntp true | |
timedatectl status | |
################################################################################ | |
banner 'Pacman' | |
# Add color output (uncomment Color in /etc/pacman.conf) | |
sudo sed '/^#Color/s/^#//' --in-place /etc/pacman.conf | |
# Synchronize package databases | |
sudo pacman -Syy | |
# Update mirrorlist | |
sudo pacman -S --noconfirm reflector | |
sudo reflector --latest 5 --sort rate --save /etc/pacman.d/mirrorlist | |
################################################################################ | |
banner 'SSH' | |
sudo pacman -S --noconfirm openssh | |
sudo systemctl start sshd | |
sudo systemctl enable sshd | |
# Generate SSH key | |
ssh-keygen -t ed25519 -C "[email protected]" -f ~/.ssh/id_ed25519 -q -N "" | |
# Add SSH key to GitHub | |
# Requires a Personal Access Token write:public_key permissions. | |
# Go to Settings > Developer setings > Personal access tokens in GitHub to generate one. | |
# Save the token in BitWarden for later reuse. | |
# See https://unix.stackexchange.com/questions/136894/command-line-method-or-programmatically-add-ssh-key-to-github-com-user-account for details on the API call. | |
echo "Please provide a GitHub Personal Access Token with write:public_key permission:" | |
read GITHUB_TOKEN | |
curl -H "Authorization: token $GITHUB_TOKEN" --data "{\"title\":\"home-vbox-arch\",\"key\":\"$(cat ~/.ssh/id_ed25519.pub)\"}" https://api.github.com/user/keys | |
################################################################################ | |
banner 'Git' | |
git config --global user.email "[email protected]" | |
git config --global user.name "Laurent Vaylet" | |
################################################################################ | |
banner 'Dotfiles' | |
# Reference: https://github.com/lvaylet/dotfiles | |
# Create and ignore folder where repo is going to be cloned to avoid weird recursion problems | |
mkdir $HOME/.cfg | |
echo ".cfg/" >> $HOME/.gitignore | |
# Clone dotfiles into bare repository | |
echo yes | git clone --bare [email protected]:lvaylet/dotfiles.git $HOME/.cfg | |
# Simplify dotfiles management with alias | |
alias dotfiles='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME' | |
# Clear untracked files and directories (-d) from local to prevent the following error when checking out the vbox-arch-xmonad branch: | |
# error: The following untracked working tree files would be overwritten by checkout: | |
# .bashrc | |
# Please move or remove them before you switch branches. | |
# Aborting | |
# Reference: https://stackoverflow.com/questions/17404316/the-following-untracked-working-tree-files-would-be-overwritten-by-merge-but-i | |
dotfiles clean --force . | |
# Check out the actual content from the bare repository | |
dotfiles checkout vbox-arch-xmonad | |
# Ignore untracked files in this specific (local) repository | |
dotfiles config --local status.showUntrackedFiles no | |
################################################################################ | |
banner 'Tools / Helpers referenced in .bashrc' | |
sudo pacman -S --noconfirm bat broot doas exa | |
sh -c "$(curl -fsSL https://starship.rs/install.sh)" | |
# Configure doas | |
echo "permit :wheel" | sudo tee /etc/doas.conf > /dev/null | |
# Configure broot and restore .bashrc (already patched by broot in dotfiles) | |
echo Y | broot | |
dotfiles restore .bashrc | |
################################################################################ | |
banner 'Yay' | |
# https://github.com/Jguer/yay | |
sudo pacman -S --needed git base-devel | |
PKG=yay | |
git clone https://aur.archlinux.org/${PKG}.git | |
pushd ${PKG} | |
makepkg --syncdeps --rmdeps --clean --install # makepkg -srci | |
popd | |
rm -rf ${PKG} | |
################################################################################ | |
banner 'Xorg, XMonad, Xmobar and fonts' | |
sudo pacman -S \ | |
xf86-video-fbdev \ | |
xorg xorg-xinit \ | |
nitrogen picom conky htop xterm alacritty dmenu firefox \ | |
xmonad xmonad-contrib xmobar xmessage \ | |
pacman-contrib \ | |
ttf-ubuntu-font-family adobe-source-code-pro-fonts | |
yay -S \ | |
nerd-fonts-mononoki otf-font-awesome-5-free | |
# Create Pacman hooks to run `xmonad --recompile` every time a Haskell dependency is updated, else XMonad may fail to start when you want to log in! | |
# Reference: https://xmonad.org/TUTORIAL.html | |
sudo mkdir -p /etc/pacman.d/hooks | |
sudo ln -s ~/.xmonad/pacman-hooks/recompile-xmonadx.hook /etc/pacman.d/hooks/recompile-xmonadx.hook | |
sudo ln -s ~/.xmonad/pacman-hooks/recompile-xmonadh.hook /etc/pacman.d/hooks/recompile-xmonadh.hook | |
################################################################################ | |
banner 'Vim' | |
sudo pacman -S --noconfirm vim neovim | |
# Install vim-plug | |
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim | |
# Install plugins with vim-plug from the command line and quit Vim after | |
vim +'PlugInstall --sync' +qa | |
################################################################################ | |
banner 'Wallpapers' | |
REMOTE_REPO="https://gitlab.com/dwt1/wallpapers.git" | |
LOCAL_REPO="wallpapers" | |
# Clone repo if it does exist yet locally | |
[ -d $LOCAL_REPO ] || git clone $REMOTE_REPO $LOCAL_REPO | |
# Pull the latest version anyway | |
(cd $LOCAL_REPO; git pull $REMOTE_REPO) | |
################################################################################ | |
banner 'DONE!' | |
echo 'TODO' | |
echo '---' | |
echo '[ ] Reboot and run `startx` to launch XMonad.' | |
echo '[ ] Configure port forwarding in VirtualBox so SSH'ing to locahost:4118 actually forwards to guest:22.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment