#!/bin/bash set -euo pipefail username=kk core_packages=( tmux kakoune man-db man-pages clang make cmake tcc ripgrep curl plocate fzf gdb which tree ) network_packages=( openssh sshfs ) desktop_packages=( sway swayidle swaybg swaylock foot wmenu polkit # this is needed to fix swayidle not being to suspend because it doesn't have the authority, systemd-logind asks it for policy xorg-xwayland wl-clipboard xdg-desktop-portal-wlr xdg-desktop-portal-gtk xdg-user-dirs xdg-utils grim # For screenshotting the desktop upower # For querying battery charge ) media_packages=( pipewire pipewire-pulse pipewire-alsa pipewire-jack pipewire-libcamera libcamera pavucontrol wireplumber bluez bluez-utils # bluetooth rtkit # There was a pipewire error so I decided to add this, "changes scheduling policy of user threads to realtime" ffmpeg imv mpv ) font_packages=( ttf-fira-code ttf-jetbrains-mono noto-fonts noto-fonts-cjk noto-fonts-emoji noto-fonts-extra ttf-liberation ttf-dejavu ttf-roboto fontconfig ) app_packages=( firefox ) machine_packages=( nvidia-open ) if [[ ${EUID} -ne 0 ]]; then printf 'Run this script as root inside arch-chroot.\n' >&2 exit 1 fi ln -sf /usr/share/zoneinfo/Europe/Warsaw /etc/localtime hwclock --systohc sed -i 's/^#\(en_US.UTF-8 UTF-8\)/\1/' /etc/locale.gen sed -i 's/^#\(pl_PL.UTF-8 UTF-8\)/\1/' /etc/locale.gen locale-gen cat >/etc/locale.conf <<'EOF' LANG=en_US.UTF-8 EOF cat >/etc/vconsole.conf <<'EOF' KEYMAP=pl2 EOF bootctl install cat >/boot/loader/loader.conf <<'EOF' default arch.conf timeout 0 console-mode max editor no EOF root_uuid=$(findmnt -no UUID /) if [[ -z ${root_uuid} ]]; then printf 'Could not detect root filesystem UUID. Check findmnt/blkid manually.\n' >&2 exit 1 fi cat >/boot/loader/entries/arch.conf </dev/null 2>&1; then useradd -m -s /bin/bash -G wheel,video,render "${username}" fi install -m 0750 -d /etc/sudoers.d cat >/etc/sudoers.d/00-wheel <<'EOF' %wheel ALL=(ALL:ALL) ALL EOF chmod 0440 /etc/sudoers.d/00-wheel visudo -cf /etc/sudoers.d/00-wheel passwd "${username}" curl -O https://download.sublimetext.com/sublimehq-pub.gpg && pacman-key --add sublimehq-pub.gpg && pacman-key --lsign-key 8A8F901A && rm sublimehq-pub.gpg echo -e "\n[sublime-text]\nServer = https://download.sublimetext.com/arch/stable/x86_64" | sudo tee -a /etc/pacman.conf pacman -Syu --needed \ "${core_packages[@]}" \ "${network_packages[@]}" \ "${desktop_packages[@]}" \ "${media_packages[@]}" \ "${font_packages[@]}" \ "${app_packages[@]}" \ "${machine_packages[@]}" \ sublime-merge sublime-text updatedb systemctl enable sshd.service systemctl enable rtkit-daemon.service systemctl enable --now bluetooth.service printf '\nChroot setup complete. Exit, unmount /mnt, reboot, then log in as %s.\n' "${username}" printf 'After first login, run: xdg-user-dirs-update\n' printf 'After first login, run: systemctl --user enable --now pipewire pipewire-pulse wireplumber\n' printf 'Generate SSH key after first login with: ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519\n'