nixos-configs/README.md
2023-02-18 00:32:12 -05:00

8.2 KiB

Lenovo Yoga 6 13ALC7

This repo is a documentation of how I installed Arch and got all the drivers for the Yoga 6, to make it work as if it was native. Since I got the touchpad issues, I'll need this once I get it fixed.

Local Pacman repo

The latest linux kernels do not have the laptop's Wifi card's drivers, therefore I'll need a custom repository to complete the ach installation.

Repo Packages
base
linux-firmware
linux
amd-ucode

patch
dkms
kmod
rtw89-dkms-git
btrfs-progs

grub
os-prober
ntfs-3g
efibootmgr
efivar

iwd
nano
sudo
texinfo
man-db


On a separate Arch installation with Wifi access, enter the following commands in a clean directory in a USB key :

git clone https://aur.archlinux.org/rtw89-dkms-git.git 
cd rtw89-dkms-git
makepkg
mv *.pkg.tar.zst ..
cd .. && sudo rm -r rtw89-dkms-git

mkdir /tmp/blankdb

pacman -Syw --cachedir . --dbpath /tmp/blankdb base linux-firmware linux amd-ucode patch dkms kmod btrfs-progs grub os-prober ntfs-3g efibootmgr efivar iwd nano sudo texinfo man-db man-pages

repo-add ./custom.db.tar.gz ./*



Archinstaller

loadkeys ca

Partionning with cryptsetup

Encrypting root partition

# cryptsetup -y -v luksFormat --type luks1 /dev/nvme0n1p?
# cryptsetup open /dev/nvme0n1p? root
# mkfs.btrfs /dev/mapper/root
# mount /dev/mapper/root /mnt

Mounting boot :

# mount --mkdir /dev/nvme0n1p1 /mnt/boot

Installing packages on the device

mount usb key and edit pacman.conf

# pacstrap -K /mnt base linux-firmware linux amd-ucode patch dkms kmod rtw89-dkms-git btrfs-progs grub os-prober ntfs-3g efibootmgr efivar iwd nano sudo texinfo man-db man-pages

Preparing for chroot

# genfstab -U /mnt >> /mnt/etc/fstab
# arch-chroot /mnt

Chroot in Installed Arch

# ln -sf /usr/share/zoneinfo/America/Montreal /etc/localtime
# hwclock --systohc
# echo matt-laptop > /etc/hostname
# passwd

Localization

Uncomment ca_FR.UTF-8 en_CA.UTF-8 en_US.UTF-8 fr_CA.UTF-8 and run

# locale-gen
# echo LANG=en_CA.UTF-8 > /etc/locale.conf
# echo KEYMAP=ca > /etc/vconsole.conf

Edit /etc/mkinitcpio.conf for LUKS

BINARIES=(btrfs)
...
HOOKS=(base udev autodetect modconf kms keyboard keymap consolefont block encrypt filesystems fsck)

then run mkinitpcio -P

Grub install

# grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch

Edit /etc/default/grub for LUKS

cryptdevice=UUID=??????:root root=/dev/mapper/root

make sure the UUID is the actual partition inside the LUKS container and run grub-mkconfig -o /boot/grub/grub.cfg

we can now reboot to the installed Arch

Inside installed Arch

Configure internet access

# systemctl enable --now iwd systemd-networkd systemd-resolved systemd-timesyncd
# iwctl device list # check if powered on
# iwctl station wlan0 scan
# iwctl station wlan0 get-networks
# iwctl station wlan0 connect SSID
# cat << EOF >> /etc/iwd/main.conf
[General]
EnableNetworkConfiguration=true
EOF

User management

# useradd -m matt -G wheel
# passwd matt

A lot of packages to install

htop
pkgfile
plocate
rsync
tailscale
tmux
usbutils
wget
git
curl
devtools
xorg
xf86-video-amdgpu
mesa
lib32-mesa
vulkan-radeon
lib32-vulkan-radeon
libva-mesa-driver
lib32-libva-mesa-driver
mesa-vdpau
lib32-mesa-vdpau
bash-completion
fzf

Install yay and install tweaked NetworkManager

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

# sudo sed -i 's/#Color/Color/' /etc/pacman.conf

# yay -Sy networkmanager-iwd
# sudo systemctl enable NetworkManager

Audio

ALSA

yay -Sy alsa-utils alsa-firmware sof-firmware alsa-ucm-conf

#unmute speakers
amixer sset Master unmute

Pipewire

yay -Sy pipewire-audio pipewire-alsa pipewire-pulse
yay -R pulseaudio-alsa
systemctl stop pulseaudio.service

Install KDE

# yay -Sy bluedevil breeze breeze-gtk discover drkonqi kactivitymanagerd kde-cli-tools kde-gtk-config kdecoration kdeplasma-addons kgamma5 khotkeys kinfocenter kmenuedit kpipewire kscreen kscreenlocker ksshaskpass ksystemstats kwallet-pam kwayland-integration kwin ayer-shell-qt libkscreen libksysguard milou oxygen-sounds plasma-browser-integration plasma-desktop plasma-disks plasma-integration  plasma-nm plasma-pa plasma-sdk plasma-systemmonitor plasma-thunderbolt 	plasma-vault plasma-workspace plasma-workspace-wallpapers polkit-kde-agent powerdevil sddm-kcm systemsettings xdg-desktop-portal-kde

Uninstall sddm and build from source for Wayland

# yay -R sddm
# yay -Sy sddm-git plasma-wayland-session

Download some kde apps

yay -Sy akonadi-calendar-tools ark colord-kde dolphin dolphin-plugins ffmpegthumbs filelight grantlee-editor gwenview kalendar kamera kamoso kapptemplate kcalc kcolorchooser kcron kdebugsettings kdeconnect kdegraphics-thumbnailers kdenetwork-filesharing kdenlive kdepim-addons kdesdk-thumbnailers kdf kdialog kfind kget kgpg kmag kompare konsole korganizer krdc krfb kruler ksystemlog kwalletmanager markdownpart okular gparted pim-data-exporter print-manager signon-kwallet-extension spectacle svgpart maliit-keyboard

Enable SDDM to launch the Desktop Environment

systemctl enable --now sddm

Here are some random changes and tweaks

Firefox touchscreen tweak

# echo MOZ_USE_XINPUT2 DEFAULT=1 >> /etc/security/pam_env.conf

then logout

AUR Packages that are most likely needed

# yay -Sy iio-sensor-proxy-git spotify-edge vscodium-bin # yoga-usage-mode-dkms-git ?
# sudo reboot

Flatpak

# flatpak install com.unity.UnityHub com.vscodium.codium org.freedesktop.Sdk.Extension.dotnet6 org.freedesktop.Sdk.Extension.mono6 com.github.iwalton3.jellyfin-media-player com.github.tchx84.Flatseal
# FLATPAK_ENABLE_SDK_EXT=dotnet6,mono6 flatpak run com.vscodium.codium
# sudo flatpak override --filesystem=xdg-config/gtk-3.0

vscodium on Flatpak

# CD=$(pwd)
# mkdir /tmp/host && cd /tmp/host
# curl -s https://api.github.com/repos/1player/host-spawn/releases \
| grep -m 1 "browser_download_url.*x86_64" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -qi -
# mv * host-spawn
# sudo chmod 755 host-spawn

# mkdir ~/bin
# sudo mv host-spawn /home/matt/bin

# cd $CD
# cp settings.json ~/.var/app/com.vscodium.codium/config/VSCodium/User/
# sudo ln -s /home/matt/bin/host-spawn /var/lib/flatpak/app/com.vscodium.codium/current/**/files/bin/git-lfs

# sudo mv /var/lib/flatpak/app/com.vscodium.codium/current/active/export/share/applications/com.vscodium.codium.desktop{,.bak}
# sudo mv /var/lib/flatpak/exports/share/applications/com.vscodium.codium.desktop{,.bak}

Fingerprint Sensor Hack

Flash firmware

# yay -Sy python pam-fprint-grosshack
# cd /tmp
# git clone --recurse-submodules https://github.com/goodix-fp-linux-dev/goodix-fp-dump.git
# cd goodix-fp-dump
# python -m venv .venv
# source .venv/bin/activate
# pip install -r requirements.txt
# sudo python3 run_55b4.py

Install experimental drivers

# yay -Sy libfprint-goodixtls-55x4 fprintd
# sudo systemctl enable --now fprintd
# fprintd-enroll

Use the reader

add this to the top of every file in /etc/pam.d/ that you want ie. sddm, kde, polkit-1, sudo uwu

auth            sufficient      pam_fprintd.so
auth            sufficient      pam_fprintd_grosshack.so
auth            sufficient      pam_unix.so try_first_pass nullok

Finally, install dotfiles

# mkdir ~/git && cd ~/git
# git clone git@git.nelim.org:matt1432/dotfiles.git
# cd dotfiles
# sudo bash setup.sh
# sudo chown matt:matt /home/matt/.env
# sed -i 's/USER=""/USER="matt"/'
# sudo bash fzf.sh /usr/share/fzf

TODO: make sed commands for mkinitcpio