dotfiles/Arch.org
SqrtMinusOne 68d3359644
Some checks are pending
Update Site / trigger_update (push) Waiting to run
arch: upd
2025-11-25 02:17:53 +03:00

8.2 KiB

Arch Linux

I've decided to switch to Arch Linux and configure it declaratively with metapac.

System installation

Installation

On installation, see https://wiki.archlinux.org/title/Installation_guide and/or use archinstall.

After installation

Update everything:

sudo pacman -Syyu

Install git, python and yadm:

sudo pacman -Syu python git pacman-contrib yadm

Select top-6 fastest mirrors to work with. Generate a mirrorlist file using this service: https://archlinux.org/mirrorlist/, then use rankmirrors from pacman-contrib (see Mirrors on Arch Wiki).

sudo -i
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup
rankmirrors -n 6 /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist

If there isn't enough RAM (e.g. running in a VM), turn off mounting /tmp as tmpfs:

sudo systemctl mask tmp.mount

Install paru:

sudo pacman -S --needed base-devel
git clone https://aur.archlinux.org/paru.git
cd paru
makepkg -si

Install metapac:

paru -Syyu metapac

Then install Arch packages with metapac:

mkdir ~/00-Scratch/
git clone https://github.com/SqrtMinusOne/dotfiles.git ~/00-Scratch/dotfiles/
cp -r ~/00-Scratch/dotfiles/.config/metapac ~/.config/
metapac s

Then, install the ssh and gpg keys (put them into the ~/.ssh folder). To export gpg keys:

gpg --output private.pgp --armor --export-secret-keys <keyname>

And to import:

gpg --import private.pgp
gpg --edit-key <keyname>
trust

Also the following to ~/.ssh/config:

Host *
    AddKeysToAgent yes

And run:

systemctl enable --user --now ssh-agent

It looks like it is necessary to run at least once.

Then, clone the dotfiles repo with yadm:

yadm clone git@github.com:SqrtMinusOne/dotfiles.git

Checkout the changed files.

Clone org-mode and passwords repos:

git clone ssh://git@git.sqrtminusone.xyz:222/sqrtminusone/org-mode.git "/home/pavel/30-39 Life/32 org-mode"
git clone ssh://git@git.sqrtminusone.xyz:222/sqrtminusone/passwords.git "/home/pavel/.password-store"

And don't forget to configure git:

git config --global user.email "thexcloud@gmail.com"
git config --global user.name "SqrtMinusOne"
sudo systemctl enable --now NetworkManager

Install wakatime:

cd ~/00-Scratch/
git clone https://github.com/wakatime/wakatime-cli.git
cd ./wakatime-cli
go build
mv wakatime-cli ~/bin

And create the ~/.wakatime.cfg file with the following contents:

[settings]
api_key = <api-key>

Then run emacs and make sure it starts. Run:

  • M-x nerd-icons-install-fonts
  • M-x all-the-icons-install-fonts
  • M-x treesit-install-language-grammar

Run rclone config, configure the remotes. Then M-x my/index-commands-sync.

If everything works, login into EXWM.

Create some directories:

mkdir -p /home/pavel/Pictures/screenshots/
mkdir -p /home/pavel/.mpd/playlists/

Also run:

sudo chmod +s /usr/bin/light

For I've decided to use NetworkManager, but Arch Linux uses iwd by default, which causes issues. Disable it by:

sudo systemctl disable --now iwd
sudo systemctl disable --now systemd-networkd

And reboot. After the reboot, NetworkManager should run using wpa_supplicant as backend for Wi-Fi.

Don't forget to sync mail and enable the sync timer.

Metapac configuration

metapac is a declarative wrapper around different package managers, including pacman and paru. This means the required packages can be listed in configuration files and checked into version control.

I've also tried decman, but it turned out to be too unstable because it ships its own logic for building AUR packages, which doesn't always work. So wrapping paru seems like a saner approach. Also, sometimes AUR drops packets, and decman can't handle it gracefully.

In metapac, packages are listed in "groups", each group being a TOML file stating which package has to be installed by which package manager. I declare groups as Org tables, see the "System configuration" section in Emacs.org.

Below is the table enabling different groups on different hostnames:

Profile archlinux weiss violet
browsers + + +
console + + +
desktop + + +
desktop-misc + + +
desktop-polybar + + +
desktop-rofi + + +
dev + + +
emacs + + +
latex + + +
mail + + +
music + + +
nvidia +
office + + +
system + + +

And the code to format it as TOML:

(let* ((hostnames (cdr (nth 0 groups)))
       groups-by-hostname)
  (cl-loop for row in (cdr groups)
           for group = (nth 0 row)
           do (cl-loop for i from 0
                       for sign in (cdr row)
                       for hostname = (nth i hostnames)
                       if (not (string-empty-p sign))
                       do (push group (alist-get hostname groups-by-hostname
                                                 nil nil #'equal))))
  (cl-loop for (hostname . groups) in groups-by-hostname
           concat (format "%s = [%s]\n" hostname
                          (mapconcat (lambda (g) (format "\"%s\"" g)) groups ","))))

Which is used in the config:

hostname_enabled_backends_enabled = false
enabled_backends = ["arch"]
hostname_groups_enabled = true

[hostname_groups]
<<metapac-groups-format()>>

[arch]
package_manager = "paru"

System packages

Some necessary Arch packages:

Arch dependency
amneziavpn-bin
base
base-devel
decman
grub
iwd
lightdm
lightdm-gtk-greeter
linux
linux-firmware
inetutils
nano
networkmanager
metapac
openssh
pacman-contrib
paru
pipewire
pipewire-audio
pipewire-alsa
pipewire-pulse
pipewire-jack
sof-firmware
smartmontools
vim
xterm
wget
wireless_tools
wireplumber
yadm
zram-generator

Various drivers, I'm not sure which I actually need, so…

Arch dependency
libva-intel-driver
intel-media-driver
vulkan-intel
vulkan-radeon
xf86-video-amdgpu
xf86-video-ati

NVIDIA drivers for violet

Category Arch dependency
nvidia cuda
nvidia nvidia-utils
nvidia nvidia
(my/format-arch-dependencies category)
<<packages("nvidia")>>
<<packages()>>