dotfiles/install_user.sh

122 lines
4.7 KiB
Bash
Raw Normal View History

2023-07-31 20:17:54 +00:00
#!/bin/bash
set -euo pipefail
# Arch installation script to be ran during OS installation, after user account creation.
# (Check install_root.sh first)
# $ arch-chroot /mnt zsh
# $ useradd itsdrike
# $ usermod -aG wheel itsdrike
# $ install -o itsdrike -g itsdrike -d /home/itsdrike
# $ passwd itsdrike
# $ chsh -s /usr/bin/zsh itsdrike
# $ su -l itsdrike
2023-07-31 20:17:54 +00:00
# $ git clone --recursive https://github.com/ItsDrike/dotfiles ~/dots
# $ cd ~/dots
# $ ./install_user.sh
# ---------------------------------------------------------------------------------------
if [ "$UID" = 0 ]; then
echo >&2 "This script must be ran as an unpriviledged user (non-root)"
exit 1
fi
# cd into the dotfiles dir, no matter where the script was called from
pushd "$(dirname "$0")"
# Install AUR helper (yay)
git clone https://aur.archlinux.org/yay.git ~/yay
pushd ~/yay
makepkg -si
popd
rm -rf ~/yay
# Sync mirrors and update before other installations
yay -Syu --noconfirm
2023-07-31 20:17:54 +00:00
# Install some useful packages
yay -S --noconfirm --needed \
openssh cronie exa bat dust mlocate lshw trash-cli ncdu btop \
2023-07-31 20:17:54 +00:00
dnsutils net-tools wget jq fzf polkit rebuild-detector hyperfine mediainfo git-delta \
python-pip ripgrep zip unzip usbutils hexyl strace python-poetry pyenv yt-dlp \
2024-02-21 22:54:36 +00:00
luarocks rustup cargo cmake meson npm downgrade lf glow xdg-ninja-git github-cli
2023-07-31 20:17:54 +00:00
2023-11-18 23:13:09 +00:00
# Make yay automatically track development dependencies
yay -Y --gendb
yay -Y --devel --save
2023-07-31 20:17:54 +00:00
# Copy over zsh configuration
2023-08-02 00:29:54 +00:00
# Note that this assumes you've ran install_root.sh, whcih created /etc/zsh/zshenv
# with $ZOOTDIR exported. If you haven't done that, you'll want to symlink the
# ~/.config/zsh/.zshenv to your home directory.
2023-07-31 20:17:54 +00:00
mkdir -p ~/.config
cp -ra home/.config/shell ~/.config
2023-12-29 12:55:03 +00:00
rm -rf ~/.config/zsh/ || true # in case there is already some zsh config
2023-07-31 20:17:54 +00:00
cp -ra home/.config/zsh ~/.config
rm -rf ~/.config/zsh/.zgenom
git clone https://github.com/jandamm/zgenom ~/.config/zsh/.zgenom
2023-08-01 10:05:16 +00:00
mkdir -p ~/.cache/zsh
touch ~/.cache/zsh/history
# Copy other user configurations
mkdir -p ~/.local
cp -ra home/.local/bin ~/.local
2023-08-01 23:45:32 +00:00
cp -ra home/.config/python ~/.config
2023-07-31 20:17:54 +00:00
install -m 700 -d ~/.local/share/gnupg
2023-08-01 10:05:16 +00:00
mkdir -p ~/.local/share/npm/lib
2023-08-01 23:53:00 +00:00
mkdir -p ~/.local/state
2023-08-01 10:05:16 +00:00
cp -ra home/.config/btop ~/.config
mkdir -p ~/.config/gtk-2.0
mkdir -p ~/.config/gtk-3.0
mkdir -p ~/.config/java
# More opinionated settings, you may not need some of these
cp home/.config/black ~/.config
cp -ra home/.config/git ~/.config/git
cp -ra home/.config/gtk-2.0 ~/.config
cp -ra home/.config/gtk-3.0 ~/.config
cp -ra home/.config/lf ~/.config
2024-02-05 22:24:30 +00:00
cp -ra home/.config/npm ~/.config
2023-08-01 10:05:16 +00:00
cp -ra home/.local/share/gnupg/gpg.conf ~/.local/share/gnupg
chmod 600 ~/.local/share/gnupg/gpg.conf
2023-12-29 14:07:57 +00:00
mkdir ~/.config/wakatime
2023-07-31 20:17:54 +00:00
# Source the environment file to make sure the commands below
# install to the correct (XDG) location.
# shellcheck source=home/.config/shell/environment
source ~/.config/shell/environment
# Install stable channel default rust toolchain
rustup default stable
2023-12-29 12:55:03 +00:00
# Install various python versions with pyenv
# This might take a while
# (note: if you don't need pyenv, remove ~/.config/shell/py-alias, and commment these lines)
2023-12-29 14:07:57 +00:00
pyenv install -l | cut -d' ' -f3 | grep -E '^3\.12\.[0-9]+$' | tail -n 1 | xargs -I {} pyenv install {}
2023-12-29 12:55:03 +00:00
pyenv install -l | cut -d' ' -f3 | grep -E '^3\.11\.[0-9]+$' | tail -n 1 | xargs -I {} pyenv install {}
pyenv install -l | cut -d' ' -f3 | grep -E '^3\.10\.[0-9]+$' | tail -n 1 | xargs -I {} pyenv install {}
pyenv install -l | cut -d' ' -f3 | grep -E '^3\.9\.[0-9]+$' | tail -n 1 | xargs -I {} pyenv install {}
pyenv install -l | cut -d' ' -f3 | grep -E '^3\.8\.[0-9]+$' | tail -n 1 | xargs -I {} pyenv install {}
pyenv install -l | cut -d' ' -f3 | grep -E '^3\.7\.[0-9]+$' | tail -n 1 | xargs -I {} pyenv install {}
pyenv install -l | cut -d' ' -f3 | grep -E '^3\.6\.[0-9]+$' | tail -n 1 | xargs -I {} pyenv install {}
# Install IPython and upgrade pip on all pyenv python versions
PYENV_VERSION="3.12" pip install --upgrade pip ipython
PYENV_VERSION="3.11" pip install --upgrade pip ipython
PYENV_VERSION="3.10" pip install --upgrade pip ipython
PYENV_VERSION="3.9" pip install --upgrade pip ipython
PYENV_VERSION="3.8" pip install --upgrade pip ipython
PYENV_VERSION="3.7" pip install --upgrade pip ipython
PYENV_VERSION="3.6" pip install --upgrade pip ipython
2023-12-31 12:05:51 +00:00
# Pull my public key and give it ultimate trust
# (Obviously, you might not want to do this in your case,
# you can give it a lower trust level, or not import it at all)
gpg --keyserver keys.openpgp.org --recv-keys FA2745890B7048C0
echo "136F5E08AFF7F6DD3E9227A0FA2745890B7048C0:6:" | gpg --import-ownertrust
2023-07-31 20:17:54 +00:00
echo "You should now exit (logout) the user and relogin with: su -l itsdrike"
echo "This will put you into a configured ZSH shell, you can continue" \
2023-08-01 08:24:44 +00:00
"configuring the rest of of the system manually from there"
2023-07-31 20:17:54 +00:00
popd