nixos-configs/README.md

298 lines
8.5 KiB
Markdown
Raw Normal View History

2023-02-11 23:28:22 -05:00
# 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](https://www.reddit.com/r/Lenovo/comments/yzs5fq/faulty_touchpad_tried_everything_to_fix_it_and_i/), I'll need this once I get it fixed.
<br/><br/>
2023-02-11 21:37:02 -05:00
2023-02-11 23:28:22 -05:00
# Archinstaller
loadkeys ca
## Partionning with [cryptsetup](https://wiki.archlinux.org/title/Dm-crypt/Encrypting_an_entire_system#LUKS_on_a_partition)
### Encrypting root partition
```
2023-03-02 19:06:48 -05:00
$ cryptsetup -y -v luksFormat --type luks1 /dev/nvme0n1p?
$ cryptsetup open /dev/nvme0n1p? root
$ 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-03-02 19:06:48 -05:00
$ pacstrap -K /mnt 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
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
```
BINARIES=(btrfs)
...
2023-02-11 23:28:22 -05:00
HOOKS=(base udev autodetect modconf kms keyboard keymap consolefont block encrypt filesystems fsck)
```
then run ```mkinitpcio -P```
2023-02-11 23:59:23 -05:00
## Grub install
```
2023-03-02 19:06:48 -05:00
$ grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch
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
```
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```
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-03-02 19:06:48 -05:00
$ 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
2023-02-11 23:59:23 -05:00
[General]
EnableNetworkConfiguration=true
EOF
```
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-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
```
2023-03-02 19:06:48 -05:00
$ useradd -m matt -G wheel
$ passwd matt
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
```
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
2023-02-15 23:05:22 -05:00
bash-completion
fzf
2023-02-12 00:14:34 -05:00
```
2023-02-16 23:01:31 -05:00
## Install [yay](https://github.com/Jguer/yay) and install tweaked NetworkManager
2023-02-15 18:12:27 -05:00
```
2023-03-02 19:06:48 -05:00
$ pacman -S --needed git base-devel
$ git clone https://aur.archlinux.org/yay.git
$ cd yay
$ makepkg -si
2023-02-15 23:05:22 -05:00
2023-03-02 19:06:48 -05:00
$ sudo sed -i 's/#Color/Color/' /etc/pacman.conf
2023-02-16 23:01:31 -05:00
2023-03-02 19:06:48 -05:00
$ yay -Sy networkmanager-iwd
$ sudo systemctl enable NetworkManager
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
$ systemctl stop pulseaudio.service
2023-02-12 00:14:34 -05:00
```
2023-03-01 19:42:03 -05:00
## Install Gnome
2023-02-15 23:05:22 -05:00
```
2023-03-02 19:06:48 -05:00
$ yay -Sy baobab cheese eog evince file-roller gdm gnome-backgrounds gnome-calculator gnome-calendar gnome-characters gnome-clocks gnome-color-manager gnome-console gnome-contacts gnome-control-center gnome-disk-utility gnome-font-viewer gnome-keyring gnome-logs gnome-menus gnome-music gnome-photos gnome-remote-desktop gnome-session gnome-settings-daemon gnome-shell gnome-shell-extensions gnome-system-monitor gnome-user-docs gnome-user-share gnome-video-effects grilo-plugins nautilus rygel simple-scan sushi totem tracker3-miners xdg-user-dirs-gtk yelp
2023-02-15 23:05:22 -05:00
```
2023-03-01 21:54:04 -05:00
### Download some apps and extensions
2023-02-15 23:05:22 -05:00
```
2023-03-07 22:16:46 -05:00
$ yay -Sy dconf-editor evolution gnome-nettool gnome-tweaks gnome-usage gnome-themes-extra adwaita-dark extension-manager libayatana-appindicator tailscale-systray-git galaxybudsclient-bin hplip cups nextcloud-client grub-customizer
2023-03-01 21:54:04 -05:00
## Download extensions and restore from Extensions Sync :
2023-03-02 19:06:48 -05:00
$ yay -Sy gnome-shell-extension-extensions-sync-git
2023-02-15 23:05:22 -05:00
```
2023-02-12 00:14:34 -05:00
2023-03-01 19:42:03 -05:00
### Build and install my fork of Dash to Panel
2023-02-15 23:05:22 -05:00
```
2023-03-02 19:06:48 -05:00
$ cd /tmp
$ git clone https://github.com/matt1432/dash-to-panel-touch-fix.git
$ cd dash-to-panel-touch-fix/
$ make install
2023-02-15 23:05:22 -05:00
```
2023-03-01 19:42:03 -05:00
### Enable GDM to launch the Desktop Environment
2023-02-15 23:05:22 -05:00
```
2023-03-02 19:06:48 -05:00
$ systemctl enable --now gdm
2023-02-15 23:05:22 -05:00
```
2023-02-12 00:14:34 -05:00
2023-03-02 16:27:45 -05:00
## Fingerprint Sensor Hack
### Flash [firmware](https://github.com/goodix-fp-linux-dev/goodix-fp-dump)
```
2023-03-02 19:06:48 -05:00
$ 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
2023-03-02 16:27:45 -05:00
```
### Install experimental [drivers](https://github.com/TheWeirdDev/libfprint/tree/55b4-experimental)
```
2023-03-02 19:06:48 -05:00
$ yay -Sy libfprint-goodixtls-55x4 fprintd
$ 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-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-03-02 19:06:48 -05:00
$ yay -Sy plymouth-git gdm-plymouth plymouth-theme-arch-charge-gdm-spinner
2023-03-02 16:53:32 -05:00
```
/etc/mkinitcpio.conf
```
MODULES=(amdgpu)
HOOKS=(base udev plymouth plymouth-encrypt ...)
```
/etc/default/grub
```
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash loglevel=3 systemd.show_status=auto rd.udev.log_level=3 splash vt.global_cursor_default=0 nowatchdog ..."
GRUB_TIMEOUT="1"
GRUB_TIMEOUT_STYLE="hidden"
GRUB_GFXMODE="1920x1200x32"
#GRUB_DISABLE_RECOVERY=true
GRUB_DISABLE_OS_PROBER="false"
```
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
```
Apply changes
```
2023-03-02 19:06:48 -05:00
$ sudo plymouth-set-default-theme -R arch-charge-gdm-spinner
$ 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-02-15 23:05:22 -05:00
### AUR Packages that are most likely needed
```
2023-03-06 20:05:01 -05:00
$ yay -Sy iio-sensor-proxy-git spotify-edge vscodium-bin
2023-03-02 19:06:48 -05:00
$ sudo reboot
2023-02-15 23:05:22 -05:00
```
### Flatpak
```
2023-03-02 19:06:48 -05:00
$ 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 org.gtk.Gtk3theme.Breeze-Dark ch.openboard.OpenBoard
$ FLATPAK_ENABLE_SDK_EXT=dotnet6,mono6 flatpak run com.vscodium.codium
$ sudo flatpak override --filesystem=xdg-config/gtk-3.0
2023-02-15 23:05:22 -05:00
```
### vscodium on Flatpak
```
2023-03-02 19:06:48 -05:00
$ CD=$(pwd)
$ mkdir /tmp/host && cd /tmp/host
$ curl -s https://api.github.com/repos/1player/host-spawn/releases \
2023-02-15 23:05:22 -05:00
| grep -m 1 "browser_download_url.*x86_64" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -qi -
2023-03-02 19:06:48 -05:00
$ mv * host-spawn
$ sudo chmod 755 host-spawn
2023-02-15 23:05:22 -05:00
2023-03-02 19:06:48 -05:00
$ mkdir ~/bin
$ sudo mv host-spawn /home/matt/bin
2023-02-15 23:05:22 -05:00
2023-03-02 19:06:48 -05:00
$ cd $CD
$ cp ../conf/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
2023-02-16 13:58:53 -05:00
2023-03-02 19:06:48 -05:00
$ 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}
2023-02-16 22:17:32 -05:00
```
2023-02-15 23:05:22 -05:00
## Finally, install dotfiles
```
2023-03-02 19:06:48 -05:00
$ 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
2023-02-15 23:07:56 -05:00
```