Major rewrite (new install)

This commit is contained in:
ItsDrike 2025-09-02 22:38:05 +02:00
parent 4e89803237
commit e78b421565
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0
158 changed files with 2542 additions and 5238 deletions

View file

@ -7,10 +7,10 @@ set -euo pipefail
# $ useradd itsdrike
# $ usermod -aG wheel itsdrike
# $ install -o itsdrike -g itsdrike -d /home/itsdrike
# $ mv ~/dots /home/itsdrike
# $ chown -R itsdrike:itsdrike /home/itsdrike/dots
# $ passwd itsdrike
# $ chsh -s /usr/bin/zsh itsdrike
# $ su -l itsdrike
# $ git clone --recursive https://github.com/ItsDrike/dotfiles ~/dots
# $ cd ~/dots
# $ ./install_user.sh
# ---------------------------------------------------------------------------------------
@ -21,45 +21,62 @@ if [ "$UID" = 0 ]; then
fi
# cd into the dotfiles dir, no matter where the script was called from
pushd "$(dirname "$0")"
pushd "$(dirname "$0")" >/dev/null
if 0; then
# Source the environment file to make sure the commands below
# install to the correct (XDG) locations.
source home/.config/shell/environment
# Sync mirrors and update all packages first
sudo pacman -Syu --noconfirm
# Make sure we have rustup installed and with the stable channel rust toolchain. This is required for
# installing paru later on (and any other rust dependencies), to prevent a prompt asking whether we
# want rust or rustup package and with rustup to also prevent the no default channel configured.
sudo pacman -S --needed --noconfirm rustup
rustup default stable
if ! command -v paru >/dev/null; then
# Install AUR helper (paru)
git clone https://aur.archlinux.org/paru.git ~/paru
pushd ~/paru
# Install rustup first, as otherwise, makepkg would ask whether to install rust or rustup
# and we always want rustup, user shouldn't choose here
sudo pacman -S rustup
makepkg -si
popd
rm -rf ~/paru
fi
# Sync mirrors and update before other installations
# Sync mirrors and update with paru before other installations
paru -Syu --noconfirm
# Install some useful packages
paru -S --noconfirm --needed \
openssh cronie exa bat dust mlocate lshw trash-cli ncdu btop \
dnsutils net-tools wget jq fzf polkit rebuild-detector hyperfine mediainfo git-delta \
python-pip ripgrep zip p7zip unzip usbutils hexyl strace python-poetry rye uv yt-dlp \
luarocks cargo cmake meson npm downgrade lf glow xdg-ninja-git github-cli act lsof \
procs du-dust skim thermald
python-pip ripgrep zip p7zip unzip usbutils hexyl strace uv yt-dlp luarocks cargo \
cmake meson npm downgrade glow xdg-ninja-git github-cli act lsof procs skim thermald \
tealdeer pkgfile zoxide
# Make paru properly track git dependencies
paru --gendb
# Install some extensions for github-cli
gh auth login
gh extension install dlvhdr/gh-dash
gh extension install jrnxf/gh-eco
gh extension install meiji163/gh-notify
## Install some extensions for github-cli
## This is currently disabled as doing the login here is very annoying
## (requires manually typing out the github auth token, since we don't have a browser)
#gh auth login
#gh extension install dlvhdr/gh-dash
#gh extension install jrnxf/gh-eco
# Create some basic dirs
mkdir -p ~/.config
mkdir -p ~/.local/{share,state,bin}
# Copy over zsh configuration
#
# 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.
mkdir -p ~/.config
# with $ZOOTDIR exported. If you haven't done that, you'll want to copy it over from
# my dotfiles. If you can't (don't have root rights), it's also possible to use ~/.zshenv,
# which you can symlink to ~/.config/zsh/.zshenv.
pacman -S --noconfirm --needed zsh
cp -ra home/.config/shell ~/.config
rm -rf ~/.config/zsh/ || true # in case there is already some zsh config
cp -ra home/.config/zsh ~/.config
@ -67,49 +84,29 @@ rm -rf ~/.config/zsh/.zgenom
git clone https://github.com/jandamm/zgenom ~/.config/zsh/.zgenom
mkdir -p ~/.cache/zsh
touch ~/.cache/zsh/history
chsh -s /usr/bin/zsh "$USER"
# Copy other user configurations
mkdir -p ~/.local
cp -ra home/.local/bin ~/.local
cp -ra home/.config/python ~/.config
# GnuPG
install -m 700 -d ~/.local/share/gnupg
mkdir -p ~/.local/share/npm/lib
mkdir -p ~/.local/state
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
cp -ra home/.config/npm ~/.config
cp home/.config/pythonrc.py ~/.config
cp -ra home/.local/share/gnupg/gpg.conf ~/.local/share/gnupg
chmod 600 ~/.local/share/gnupg/gpg.conf
mkdir ~/.config/wakatime
cp home/.config/user-dirs.dirs ~/.config
cp home/.config/user-dirs.locale ~/.config
# Copy other user configurations
mkdir -p ~/.config/java
mkdir -p ~/.local/share/npm/lib
cp -ra home/.local/bin ~/.local
cp -ra home/.config/python ~/.config
cp -ra home/.config/btop ~/.config
cp -ra home/.config/git ~/.config
cp -ra home/.config/gh ~/.config
cp -ra home/.config/npm ~/.config
cp -ra home/.config/tealdeer ~/.config
# Source the environment file to make sure the commands below
# install to the correct (XDG) location.
export ZSH_VERSION=0 # necessary for the environment script to succeed
# shellcheck source=home/.config/shell/environment
source ~/.config/shell/environment
# Install stable channel default rust toolchain
rustup default stable
# Install various python versions with uv
uv python install 3.12 3.11 3.10 3.9 3.8 3.7
uv python install 3.13 3.12 3.11 3.10 3.9 3.8
# Install various useful python packages
paru -S --noconfirm --needed ipython ruff pyright mypy
uv tool install basedpyright
paru -S --noconfirm --needed ipython ruff pyright mypy basedpyright
# Pull my public key and give it ultimate trust
# (Obviously, you might not want to do this in your case,
@ -118,10 +115,15 @@ gpg --keyserver keys.openpgp.org --recv-keys FA2745890B7048C0
echo "136F5E08AFF7F6DD3E9227A0FA2745890B7048C0:6:" | gpg --import-ownertrust
# Enable systemd services
sudo systemctl enable --now thermald
sudo systemctl enable thermald pkgfile-update.timer
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" \
"configuring the rest of of the system manually from there"
echo ""
echo "Optional extra steps:"
echo "- import gpg private keys"
echo "- import ssh config"
echo "- import git credentials"
popd
popd >/dev/null