nixos-configs/README.md

237 lines
6.7 KiB
Markdown
Raw Permalink Normal View History

2023-02-11 23:28:22 -05:00
# Archinstaller
2023-06-10 23:56:18 -04:00
```
2023-02-11 23:28:22 -05:00
loadkeys ca
2023-06-10 23:56:18 -04:00
setfont ter-132b
```
2023-02-11 23:28:22 -05:00
## Partionning with [cryptsetup](https://wiki.archlinux.org/title/Dm-crypt/Encrypting_an_entire_system#LUKS_on_a_partition)
### Encrypting root partition
```
2023-06-10 23:56:18 -04:00
$ PART="encrypted partition number ie. 2"
$ cryptsetup -y -v luksFormat --type luks1 /dev/nvme0n1p$PART
$ cryptsetup open /dev/nvme0n1p$PART root
2023-03-02 19:06:48 -05:00
$ mkfs.btrfs /dev/mapper/root
$ mount /dev/mapper/root /mnt
2023-02-11 23:28:22 -05:00
```
### Mounting boot :
```
2023-03-02 19:06:48 -05:00
$ mount --mkdir /dev/nvme0n1p1 /mnt/boot
2023-02-11 23:28:22 -05:00
```
2023-02-11 23:59:23 -05:00
### Installing packages on the device
```
2023-06-10 23:56:18 -04:00
$ pacstrap -K /mnt base linux-firmware linux amd-ucode patch dkms kmod btrfs-progs grub os-prober ntfs-3g efibootmgr efivar networkmanager iwd nano sudo texinfo man-db man-pages
2023-02-11 23:59:23 -05:00
```
2023-02-14 11:16:05 -05:00
## Preparing for chroot
2023-02-11 23:59:23 -05:00
```
2023-03-02 19:06:48 -05:00
$ genfstab -U /mnt >> /mnt/etc/fstab
$ arch-chroot /mnt
2023-02-14 11:16:05 -05:00
```
# Chroot in Installed Arch
```
2023-03-02 19:06:48 -05:00
$ ln -sf /usr/share/zoneinfo/America/Montreal /etc/localtime
$ hwclock --systohc
$ echo matt-laptop > /etc/hostname
$ passwd
2023-02-11 23:28:22 -05:00
```
2023-02-11 23:59:23 -05:00
## Localization
Uncomment ca_FR.UTF-8 en_CA.UTF-8 en_US.UTF-8 fr_CA.UTF-8 and run
```
2023-03-02 19:06:48 -05:00
$ locale-gen
$ echo LANG=en_CA.UTF-8 > /etc/locale.conf
$ echo KEYMAP=ca > /etc/vconsole.conf
2023-02-11 23:59:23 -05:00
```
2023-02-12 12:49:54 -05:00
## Edit /etc/mkinitcpio.conf for LUKS
2023-02-11 23:59:23 -05:00
```
2023-06-10 23:56:18 -04:00
$ sed -i 's/BINARIES=.*/BINARIES=(btrfs)/' /etc/mkinitcpio.conf
2023-02-11 23:59:23 -05:00
...
2023-06-10 23:56:18 -04:00
$ sed -i 's/HOOKS=.*/HOOKS=(base udev autodetect modconf kms keyboard keymap consolefont block encrypt filesystems fsck)/' /etc/mkinitcpio.conf
2023-02-11 23:28:22 -05:00
```
then run ```mkinitpcio -P```
2023-02-11 23:59:23 -05:00
## Grub install
```
2023-06-11 00:36:30 -04:00
$ grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=wim --boot-directory=/boot/EFI/wim
2023-02-11 23:59:23 -05:00
```
2023-02-12 12:49:54 -05:00
### Edit /etc/default/grub for LUKS
2023-02-11 23:28:22 -05:00
```
2023-06-10 23:56:18 -04:00
$ CRYPT="cryptdevice=$(blkid | sed -n 's/.*nvme0n1p'$PART': \(.*\) TYPE.*/\1/p'):root"
$ sed -i 's#GRUB_CMDLINE_LINUX_DEFAULT.*#GRUB_CMDLINE_LINUX_DEFAULT="quiet loglevel 3 '$CRYPT' root=/dev/mapper/root"#' /etc/default/grub
2023-02-11 23:28:22 -05:00
```
2023-06-11 00:36:30 -04:00
make sure the UUID is the actual partition inside the LUKS container and run ```grub-mkconfig -o /boot/EFI/wim/grub/grub.cfg```
2023-02-11 23:28:22 -05:00
2023-02-11 23:59:23 -05:00
we can now reboot to the installed Arch
<br/><br/>
# Inside installed Arch
2023-02-11 23:28:22 -05:00
2023-02-11 23:59:23 -05:00
## Configure [internet](https://wiki.archlinux.org/title/Iwd) access
```
2023-06-10 23:56:18 -04:00
$ systemctl enable --now NetworkManager systemd-networkd systemd-resolved systemd-timesyncd
$ cat << EOF >> /etc/NetworkManager/conf.d/wifi_backend.conf
[device]
wifi.backend=iwd
EOF
2023-03-02 19:06:48 -05:00
$ cat << EOF >> /etc/iwd/main.conf
2023-02-11 23:59:23 -05:00
[General]
EnableNetworkConfiguration=true
EOF
$ systemctl stop iwd
$ systemctl restart NetworkManager
$ iwctl device list # check if powered on
$ iwctl station wlan0 scan
$ iwctl station wlan0 get-networks
$ iwctl station wlan0 connect $SSID
2023-02-11 23:59:23 -05:00
```
2023-03-01 21:54:04 -05:00
### Configure systemd-resolved
```
2023-03-02 19:06:48 -05:00
$ ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
$ sed -i 's/#DNS=.*/DNS=100.64.0.1/' /etc/systemd/resolved.conf
$ sed -i 's/#FallbackDNS=.*/FallbackDNS=1.1.1.1/' /etc/systemd/resolved.conf
2023-06-10 23:56:18 -04:00
$ sed -i 's/#DNSStubListener=.*/DNSStubListener=no/' /etc/systemd/resolved.conf
2023-03-01 21:54:04 -05:00
```
### Configure reflector for mirror management of pacman
```
2023-03-02 19:06:48 -05:00
$ pacman -Sy reflector
$ nano /etc/xdg/reflector/reflector.conf
$ systemctl enable --now reflector.timer
2023-03-01 21:54:04 -05:00
```
2023-02-11 23:59:23 -05:00
## User management
```
$ useradd -m matt -G wheel,input
2023-03-02 19:06:48 -05:00
$ passwd matt
$ env EDITOR=nano visudo # set wheel to allow sudo commands with pass
2023-02-11 23:59:23 -05:00
```
2023-02-11 23:28:22 -05:00
2023-02-12 00:14:34 -05:00
## A lot of packages to install
```
2023-06-10 23:56:18 -04:00
$ pacman -Sy htop pkgfile mlocate rsync tmux mosh usbutils wget git curl devtools mesa lib32-mesa vulkan-radeon lib32-vulkan-radeon libva-mesa-driver lib32-libva-mesa-driver mesa-vdpau lib32-mesa-vdpau bash-completion fzf
$ pkgfile --update
```
## su matt
2023-06-10 23:56:18 -04:00
## Install paru
2023-02-15 18:12:27 -05:00
```
$ sudo pacman -S --needed git base-devel
2023-06-10 23:56:18 -04:00
$ git clone https://aur.archlinux.org/paru-git.git
$ cd paru-git
2023-03-02 19:06:48 -05:00
$ makepkg -si
2023-02-15 23:05:22 -05:00
2023-06-10 23:56:18 -04:00
$ sed -i 's/#Color/Color/' /etc/pacman.conf
$ sed -i 's/#IgnorePkg.*/IgnorePkg = linux-xanmod-anbox linux-xanmod-anbox-headers/' /etc/pacman.conf
2023-02-16 23:01:31 -05:00
2023-06-10 23:56:18 -04:00
$ cat << EOF >> /etc/paru.conf
CombinedUpgrade
BatchInstall
BottomUp
NoWarn = plymouth-theme-arch-elegant
EOF
2023-02-15 18:12:27 -05:00
```
2023-02-12 00:14:34 -05:00
## Audio
2023-02-15 18:12:27 -05:00
### ALSA
2023-02-12 00:14:34 -05:00
```
2023-03-02 19:06:48 -05:00
$ yay -Sy alsa-utils alsa-firmware sof-firmware alsa-ucm-conf
2023-02-15 18:12:27 -05:00
#unmute speakers
2023-03-02 19:06:48 -05:00
$ amixer sset Master unmute
2023-02-15 18:12:27 -05:00
```
### Pipewire
```
2023-03-02 19:06:48 -05:00
$ yay -Sy pipewire-audio pipewire-alsa pipewire-pulse
$ yay -R pulseaudio-alsa
2023-06-10 23:56:18 -04:00
$ sudo systemctl stop pulseaudio.service
$ systemctl --user enable --now pipewire-pulse.service
2023-02-15 23:05:22 -05:00
```
2023-03-02 16:27:45 -05:00
## Fingerprint Sensor Hack
```
2023-03-02 19:06:48 -05:00
$ yay -Sy python pam-fprint-grosshack
$ sudo systemctl enable --now fprintd
$ fprintd-enroll
2023-03-02 16:27:45 -05:00
```
### Use the reader
2023-03-02 16:53:32 -05:00
add this to the top of every file in /etc/pam.d/ that you want ie. polkit-1, sudo uwu
2023-03-02 16:27:45 -05:00
```
auth sufficient pam_fprintd_grosshack.so
auth sufficient pam_unix.so try_first_pass nullok
```
2023-06-10 23:56:18 -04:00
OR (for gtklock and check for sddm)
```
auth sufficient pam_fprintd.so
```
2023-03-02 16:27:45 -05:00
2023-03-02 16:53:32 -05:00
## Plymouth and Silent Boot
By following the wiki pages on [watchdogs](https://wiki.archlinux.org/title/Improving_performance#Watchdogs), [silent booting](https://wiki.archlinux.org/title/Silent_boot#top-page) and [Plymouth](https://wiki.archlinux.org/title/Plymouth), I edited my grub config and mkinitcpio, installed and setup Plymouth, to get a satisfying booting experience
```
2023-06-10 23:56:18 -04:00
$ yay -Sy plymouth-git
2023-03-02 16:53:32 -05:00
```
/etc/mkinitcpio.conf
```
2023-06-10 23:56:18 -04:00
$ sudo sed -i 's/MODULES=()/MODULES=(amdgpu)/' /etc/mkinitcpio.conf
$ sudo sed -i 's/#COMPRESSION="lz4"/COMPRESSION="lz4"/' /etc/mkinitcpio.conf
$ sudo sed -i 's/HOOKS=(.* /HOOKS=(base udev plymouth encrypt autodetect modconf kms keyboard keymap consolefont block filesystems fsck)/' /etc/mkinitcpio.conf
COMPRESSION="lz4"
2023-03-02 16:53:32 -05:00
```
/etc/default/grub
```
2023-06-10 23:56:18 -04:00
sudo sed -i 's/quiet loglevel 3/quiet splash loglevel=3 systemd.show_status=auto rd.udev.log_level=3 splash nowatchdog psi=1/' /etc/default/grub
2023-03-02 16:53:32 -05:00
```
Mute watchdog
```
2023-03-02 19:06:48 -05:00
$ echo blacklist sp5100_tco | sudo tee /etc/modprobe.d/disable-sp5100-watchdog.conf
2023-03-02 16:53:32 -05:00
```
2023-06-10 23:56:18 -04:00
Apply changes [Theme](https://github.com/murkl/plymouth-theme-arch-elegant)
2023-03-02 16:53:32 -05:00
```
2023-06-10 23:56:18 -04:00
$ git clone https://github.com/murkl/plymouth-theme-arch-elegant.git
$ cd plymouth-theme-arch-elegant/aur
$ makepkg -si
$ sudo plymouth-set-default-theme -R arch-elegant
2023-03-02 19:06:48 -05:00
$ sudo grub-mkconfig -o /boot/grub/grub.cfg
$ sudo sed -i 's/echo/#ech~o/g' /boot/grub/grub.cfg
2023-03-02 16:53:32 -05:00
```
2023-02-15 23:05:22 -05:00
## Here are some random changes and tweaks
2023-02-11 21:37:02 -05:00
2023-02-15 23:05:22 -05:00
### Firefox touchscreen [tweak](https://wiki.archlinux.org/title/Firefox/Tweaks#Enable_touchscreen_gestures)
```
2023-03-02 19:06:48 -05:00
$ echo MOZ_USE_XINPUT2 DEFAULT=1 | sudo tee -a /etc/security/pam_env.conf
2023-02-15 23:05:22 -05:00
```
then logout
2023-02-15 18:12:27 -05:00
2023-06-10 23:56:18 -04:00
### More Packages that are most likely needed
2023-02-15 23:05:22 -05:00
```
2023-06-10 23:56:18 -04:00
run toinstall.sh script
2023-03-02 19:06:48 -05:00
$ sudo reboot
2023-02-15 23:05:22 -05:00
```
### Flatpak
```
2023-06-10 23:56:18 -04:00
$ flatpak install com.github.iwalton3.jellyfin-media-player com.github.tchx84.Flatseal xournalpp stemlink
2023-03-02 19:06:48 -05:00
$ sudo flatpak override --filesystem=xdg-config/gtk-3.0
2023-02-15 23:05:22 -05:00
```
## Finally, install dotfiles
### get access to repo first
2023-02-15 23:05:22 -05:00
```
2023-03-02 19:06:48 -05:00
$ mkdir ~/git && cd ~/git
$ git clone git@git.nelim.org:matt1432/dotfiles.git
$ cd dotfiles
2023-06-10 23:56:18 -04:00
$ bash getenv.sh
2023-03-02 19:06:48 -05:00
$ sudo bash setup.sh
$ sudo bash fzf.sh /usr/share/fzf
2023-02-15 23:07:56 -05:00
```