6 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
Then, clone the dotfiles repo with yadm:
yadm clone git@github.com:SqrtMinusOne/dotfiles.git
Checkout the changed files.
Clone the org-mode repo:
git clone git@github.com:SqrtMinusOne/dotfiles.git "/home/pavel/30-39 Life/32 org-mode"
Then run emacs and make sure it starts.
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 | kek |
| browsers | + | + |
| console | + | |
| desktop | + | |
| desktop-misc | + | |
| desktop-polybar | + | |
| desktop-rofi | + | |
| dev | + | |
| emacs | + | |
| latex | + | |
| + | ||
| music | + | |
| 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 |
|---|
| base |
| base-devel |
| decman |
| grub |
| iwd |
| lightdm |
| lightdm-gtk-greeter |
| linux |
| linux-firmware |
| nano |
| metapac |
| openssh |
| pacman-contrib |
| paru |
| pipewire |
| pipewire-audio |
| pipewire-alsa |
| pipewire-pulse |
| pipewire-jack |
| smartmontools |
| vim |
| xterm |
| wget |
| wireless_tools |
| wpa_supplicant |
| yadm |
| zram-generator |
Various drivers, I'm not sure which I actually need, so…
| Arch dependency |
|---|
| libva-intel-driver |
| intel-media-driver |
| vulkan-intel |
| nvidia-utils |
| vulkan-radeon |
| xf86-video-amdgpu |
| xf86-video-ati |
(my/format-arch-dependencies category)
<<packages()>>