Skip to content

Instantly share code, notes, and snippets.

@fcoury
Last active February 11, 2024 06:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fcoury/f161ef1ee3efdff07f5ff3d7b036c664 to your computer and use it in GitHub Desktop.
Save fcoury/f161ef1ee3efdff07f5ff3d7b036c664 to your computer and use it in GitHub Desktop.
Install Arch Linux on UTM on macOS on M1/M2/M3
Section "Monitor"
Identifier "Virtual-1"
Modeline "2560x1600" 348.50 2560 2760 3032 3504 1600 1603 1609 1658 -hsync +vsync
Option "PreferredMode" "2560x1600"
EndSection
Section "Screen"
Identifier "Screen0"
Monitor "Virtual-1"
DefaultDepth 24
SubSection "Display"
Modes "2560x1600"
EndSubSection
EndSection
# Match on all types of devices but joysticks
#
# If you want to configure your devices, do not copy this file.
# Instead, use a config snippet that contains something like this:
#
# Section "InputClass"
# Identifier "something or other"
# MatchDriver "libinput"
#
# MatchIsTouchpad "on"
# ... other Match directives ...
# Option "someoption" "value"
# EndSection
#
# This applies the option any libinput device also matched by the other
# directives. See the xorg.conf(5) man page for more info on
# matching devices.
Section "InputClass"
Identifier "libinput pointer catchall"
MatchIsPointer "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
Option "NaturalScrolling" "True"
EndSection
Section "InputClass"
Identifier "libinput keyboard catchall"
MatchIsKeyboard "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
EndSection
Section "InputClass"
Identifier "libinput touchpad catchall"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
EndSection
Section "InputClass"
Identifier "libinput touchscreen catchall"
MatchIsTouchscreen "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
EndSection
Section "InputClass"
Identifier "libinput tablet catchall"
MatchIsTablet "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
EndSection
#!/bin/bash
set -euo pipefail
loadkeys us-acentos
setfont Lat2-Terminus16
timedatectl
DEVICE="/dev/vda"
# Create partitions using sfdisk
{
echo label: gpt
echo size=512M, type=uefi
echo size=512M, type=swap
echo type=linux
} | sfdisk $DEVICE
echo "Partitioning on $DEVICE is done."
# Filesystems
mkfs.ext4 /dev/vda3
mkswap /dev/vda2
mkfs.fat -F 32 /dev/vda1
# Mount the new system
mount /dev/vda3 /mnt
mount --mkdir /dev/vda1 /mnt/boot
swapon /dev/vda2
# Install the base system
pacstrap -K /mnt base base-devel linux linux-firmware e2fsprogs dhcpcd networkmanager vim neovim man-db man-pages texinfo wget
genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt
#!/bin/bash
set -euo pipefail
systemctl start NetworkManager
ln -sf /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime
hwclock --systohc
# Locale
sed -i '/en_US.UTF-8/s/^#//g' /etc/locale.gen
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
echo KEYMAP=us-acentos > /etc/vconsole.conf
echo FONT=Lat2-Terminus16 >> /etc/vconsole.conf
echo archie > /etc/hostname
echo "127.0.0.1 localhost" >> /etc/hosts
echo "::1 localhost" >> /etc/hosts
echo "127.0.0.1 archie.localdomain archie" >> /etc/hosts
mkinitcpio -P || true
passwd
sed -i '/^SigLevel/s/^/#/' /etc/pacman.conf
sed -i '/^#SigLevel/a SigLevel = Never' /etc/pacman.conf
pacman -S archlinuxarm-keyring
pacman-key --populate
sed -i '/^SigLevel = Never/s/^/#/' /etc/pacman.conf
sed -i '/^#SigLevel/s/^#//' /etc/pacman.conf
pacman -S grub efibootmgr
grub-install --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
echo "Type poweroff to shut the VM down, remove the CD-ROM and start it again."
#!/bin/bash
set -euo pipefail
systemctl start NetworkManager
pacman -S neofetch
neofetch
pacman -Syu
pacman -S sudo
useradd -m -g users -G wheel,storage,power,audio fcoury
passwd fcoury
cp /etc/sudoers /etc/sudoers.bak
sed -i '/^#\s*%wheel ALL=(ALL:ALL) NOPASSWD: ALL/s/^#//' /etc/sudoers
run_as_fcoury() {
su - fcoury -c "$1"
}
run_sudo() {
sudo $1
}
run_sudo "pacman -S xdg-user-dirs"
run_as_fcoury "xdg-user-dirs-update"
run_sudo "pacman -S git"
run_as_fcoury "cd /home/fcoury && git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si"
run_sudo "pacman -S spice-vdagent"
run_sudo "pacman -S pulseaudio alsa-utils alsa-plugins pavucontrol"
run_sudo "pacman -S openssh iw wpa_supplicant"
run_sudo "systemctl enable sshd"
run_sudo "systemctl enable dhcpcd"
run_sudo "systemctl enable NetworkManager"
run_sudo "pacman -S bluez bluez-utils blueman"
run_sudo "systemctl enable bluetooth"
run_sudo "sed -i '/^#Color/s/^#//' /etc/pacman.conf"
run_sudo "sed -i '/^Color/a ILoveCandy' /etc/pacman.conf"
run_sudo "systemctl enable fstrim.timer"
run_sudo "pacman -S xorg-server xorg-apps xorg-xinit xclip"
run_sudo "pacman -S i3"
echo "exec i3" > ~/.xinitrc
run_sudo "pacman -S picom"
run_sudo "pacman -S noto-fonts ttf-cascadia-code-nerd ttf-firacode-nerd ttf-iosevka-nerd ttf-jetbrains-mono-nerd ttf-cascadia-code-nerd ttf-nerd-fonts-symbols ttf-victor-mono-nerd"
run_sudo "pacman -S zsh alacritty ranger dmenu rofi polybar feh ueberzug wget fd ripgrep htop"
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment