diff --git a/README.md b/README.md new file mode 100644 index 0000000..caaa49c --- /dev/null +++ b/README.md @@ -0,0 +1,345 @@ +# System install guide + +Install guide with DIY spirit, key is to reproduce my system setup while making sure understanding is there and all. + +- Commands are written for user `kk` unless stated otherwise. + +## 0. Current TODOs + +### System / mounts + +- [x] Add server SSH keys and PC SSH keys +- [ ] Mount the mobile phone + - Make sure nobody else can log in when I connect to random Wi-Fi. +- [ ] Mount `/proton` on startup +- [x] Mount `/lenovo-laptop` +- [x] Mount server at `/server-vps` + +### Desktop / UX + +- [x] Hibernate if not using the PC for 10 minutes +- [ ] Start Sway in a tmux session for debugging +- [ ] Kakoune setup +- [x] Firefox bookmarks +- [ ] Ideas for Chinese learning integration + +### Launcher / search + +- [x] Combine apps, scripts, bookmarks, and files + - [x] Use `.desktop` file name instead of the `Name` parameter +- [x] Everything relevant in `wmenu` browser + - [x] `plocate + wmenu > xdg-open` + - [x] Applications + `bin` folder + - [x] Bookmarks + +### Ideas looking for problems + +- [ ] tmux automation + +--- + +## 1. Bootstrap sudo and git + +```sh +su root +export PATH="$PATH:/usr/sbin" +apt install sudo git +usermod -aG sudo kk +``` + +Then exit both root and the user session, and log in again so the `sudo` group change applies. + +Verify: + +```sh +groups # should see "sudo" +sudo whoami # you should see "root" +``` + +Expected output from `sudo whoami`: + +```text +root +``` + +--- + +## 2. Install basic utilities + +**Automate later.** + +```sh +sudo apt update +sudo apt install -y \ + clang \ + cmake \ + build-essential \ + make \ + tcc \ + vim \ + ripgrep \ + curl \ + git \ + man-db \ + plocate \ + tmux \ + fzf \ + dtrx \ + gdb + +sudo updatedb # plocate update the database so you can query files on PC nicely +``` + +- fzf - fuzzy search on command line, good for making command line tools +- ripgrep - better grep, nicer syntax and faster: rg "query" +- dtrx - nice archive unpacking wrapper that makes it less confusing, just dtrx thing.zip or whatever other tar and it should work nicely + +Mostly development tools are downloaded here, stuff like tmux, vim and the compiler toolchain needed for development, compiling etc. + +--- + +## 3. Speed up GRUB boot + +**Automate later.** Edit `/etc/default/grub`: + +```sh +sudo vi /etc/default/grub +``` + +Set: + +```ini +GRUB_TIMEOUT=0 +GRUB_TIMEOUT_STYLE=hidden +``` + +Apply changes: + +```sh +sudo update-grub +``` + +--- + +## 4. Enable Debian non-free repositories + +**Automate later.** Needed for NVIDIA and firmware packages. + +Edit `/etc/apt/sources.list` and add: + +```text +contrib non-free non-free-firmware +``` + +Then update apt: + +```sh +sudo apt update +``` + +--- + +## 5. Install drivers and firmware + +**Machine-specific / automate carefully.** + +```sh +sudo apt install -y \ + nvidia-driver \ + firmware-misc-nonfree \ + linux-headers-amd64 +``` + +TODO: + +- Set NVIDIA modeset to `1`. +- Update initramfs. +- Reboot. + +--- + +## 7. Desktop environment: Sway + +**Automate later.** + +```sh +sudo apt install -y \ + sway \ + swayidle \ + swaybg \ + swaylock \ + foot \ + wmenu \ + brightnessctl \ + xwayland \ + wl-clipboard \ + xdg-desktop-portal-wlr \ + xdg-desktop-portal-gtk \ + xdg-user-dirs \ + fonts-jetbrains-mono \ + fonts-noto-cjk \ + fonts-noto-cjk-extra \ + pipewire \ + pipewire-pulse \ + pipewire-alsa \ + wireplumber \ + pavucontrol \ + grim +``` + +Package notes: + +- sway, terminal, menu, addons: + - `sway` - the Wayland window manager / desktop environment of choice. This is the main thing that replaces a traditional desktop like GNOME or KDE. + - `swayidle` - idle manager for Sway. Used for things like locking the screen, turning off the display, suspending, or hibernating after a timeout. + - `swaybg` - simple wallpaper/background setter for Sway. + - `swaylock` - screen locker for Sway/Wayland. Used when locking the session manually or from `swayidle`. + - `foot` - terminal emulator for Wayland. This is the main terminal. + - `wmenu` - small menu/launcher for Wayland. Useful for app launching and custom scripts like bookmarks/search/file opening. + - `grim` - screenshot tool for Wayland. Usually used together with selection/clipboard scripts later. + - `brightnessctl` - command line tool for changing screen brightness, usually bound to laptop brightness keys. + - `xwayland` - compatibility layer that allows older X11 applications to run inside the Wayland/Sway session. + - `wl-clipboard` - Wayland clipboard tools, mainly `wl-copy` and `wl-paste`. Needed by scripts and editor integrations. + - `fonts-jetbrains-mono` - nice monospace font for terminal/editor use. +- xdg, a standard required by some apps (shared enviroment variables and such): + - `xdg-desktop-portal-wlr` - desktop portal backend for wlroots compositors like Sway. Needed for screen sharing, screenshots, file pickers, and other app integrations. + - `xdg-desktop-portal-gtk` - GTK portal backend/fallback. Helps with file picker dialogs and desktop integration for some applications. + - `xdg-user-dirs` - creates standard user folders like `~/Downloads`, `~/Documents`, `~/Pictures`, etc. +- fix unicode characters (like Chinese) not showing up properly in firefox: + - `fonts-noto-cjk` - fonts needed for displaying Chinese, Japanese, Korean, etc. characters in Firefox, Chromium, terminal apps, and other programs. + - `fonts-noto-cjk-extra` - additional CJK font coverage/styles. +- audio: + - `pipewire` - the main modern Linux audio/media server. Handles audio routing and is also useful for screen sharing/media integration on Wayland. + - `pipewire-pulse` - PulseAudio compatibility layer for PipeWire. Makes applications that expect PulseAudio work through PipeWire instead. + - `pipewire-alsa` - ALSA compatibility layer for PipeWire. Helps applications that use ALSA directly play/record audio through PipeWire. + - `wireplumber` - PipeWire session/policy manager. It decides how audio devices and streams should be connected automatically. + - `pavucontrol` - graphical volume mixer. Useful for choosing input/output devices, changing app volumes, and debugging audio problems. + +### Fix Sway permission issues + +If Sway reports render/video permission errors, add the user to the relevant groups: + +```sh +sudo usermod -aG video,render kk +``` + +Log out and back in afterwards. + +--- + +## 9. SSH keys + +**Manual.** Generate a key if the machine does not already have one: + +```sh +ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N "" +``` + +Now exchange the keys with relevant machines so as to make communication easier. This prepares the ground for mounting these machines as easy to access drives. + +--- + +## 10. SSHFS drives + +**Partly manual.** Install SSHFS: + +```sh +sudo apt install -y sshfs +``` + +Create mount points as needed: + +```sh +sudo mkdir -p /server-vps /lenovo-laptop /proton +``` + +Example `/etc/fstab` entry for the VPS: + +```fstab +root@157.90.144.237:/ /server-vps fuse.sshfs noauto,x-systemd.automount,_netdev,x-systemd.idle-timeout=2min,x-systemd.mount-timeout=10s,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,IdentityFile=/home/kk/.ssh/id_ed25519,UserKnownHostsFile=/home/kk/.ssh/known_hosts,StrictHostKeyChecking=accept-new,allow_other,default_permissions 0 0 +``` + +Test after editing `/etc/fstab`: + +```sh +sudo systemctl daemon-reload +ls /server-vps +``` + +--- + +## 11. Browser / internet tools + +**Automate later.** + +```sh +sudo apt install -y chromium +``` + +Optional text/web search tools: + +```sh +sudo apt install -y w3m surfraw +``` + +--- + +## 12. Extras + +### Clipboard history + +```sh +sudo apt install -y cliphist +``` + +--- + +## 13. Voice typing: Voxtype + +**Manual / automate carefully.** + +Install Voxtype: + +```sh +curl -LO https://github.com/peteonrails/voxtype/releases/download/v0.6.0/voxtype_0.6.0-1_amd64.deb +sudo dpkg -i voxtype_0.6.0-1_amd64.deb +rm voxtype_0.6.0-1_amd64.deb +``` + +Install runtime dependencies: + +```sh +sudo apt install -y \ + wtype \ + wl-clipboard \ + libnotify-bin \ + playerctl +``` + +Allow input access: + +```sh +sudo usermod -aG input "$USER" +``` + +Log out and back in afterwards. + +### Optional GPU support + +```sh +read -r -p "Enable GPU support? [y/N] " answer +case "$answer" in + [yY]|[yY][eE][sS]) + sudo voxtype setup gpu --enable + ;; +esac +``` + +### Voxtype setup + +```sh +voxtype setup +voxtype setup systemd +voxtype setup model +``` + diff --git a/install_the_dotfiles.sh b/install_the_dotfiles.sh deleted file mode 100644 index ba6b947..0000000 --- a/install_the_dotfiles.sh +++ /dev/null @@ -1,106 +0,0 @@ -# TODO: -# - [x] Add server SSH keys and PC ssh keys -# - [ ] Mount /proton on startup -# - [x] Hibernate if not using PC for 10 minutes -# -# - [x] Mount /lenovo-laptop -# - [x] Mount server /server-vps -# -# - [x] Combine apps + bin + bookmarks -# - [x] Use .desktop file name instead of "Name" parameter -# - [ ] Firefox bookmarks -# - [x] everything relevant wmenu browser (programs and scripts without arguments, bookmarks, files) -# - [x] plocate + wmenu > xdg-open -# - [x] applications + bin folder -# - [x] bookmarks -# -# - [ ] Start sway in tmux session for debugging -# -# - [ ] Kakoune setup -# - [ ] Ideas for Chinese learning integration -# -# Solutions in search for problems: -# - [ ] tmux automation -# - - -## Setup sudo for user -# su root -# export PATH="$PATH:/usr/sbin" -# apt install sudo git -# usermod -aG sudo kk -# exit # exit root -# exit # exit user to reload config - -## Basic utilities -# sudo apt install -y clang cmake build-essential make tcc vim ripgrep curl git man-db plocate tmux fzf dtrx gdb -# sudo updatedb - -## Update grub to not wait on bootloader screen @todo: automate -# sudo vi /etc/default/grub -# GRUB_TIMEOUT=0 -# GRIM_TIMEOUT_STYLE=hidden - -## Drivers -## Need to update /etc/apt/sources.list (add contrib non-free non-free-firmware) @todo: automate -# sudo apt update -# sudo apt install -y nvidia-driver firmware-misc-nonfree linux-headers-amd64 -## Then do some nvidia configuration (set modeset=1, update ramfs, reboot) - -# # Standard enviroment setup -# sudo apt install -y xdg-desktop-portal-wlr xdg-desktop-portal-gtk xdg-user-dirs fonts-jetbrains-mono fonts-noto-cjk fonts-noto-cjk-extra - - -# # DE setup -# sudo apt install -y sway swayidle swaybg swaylock foot wmenu brightnessctl xwayland wl-clipboard grim - -# # Issue fix -# # there were issues because user was not in render group (error messages on start of sway) -# sudo usermod -aG video,render kk - -# # Setup audio -# sudo apt install -y pipewire pipewire-pulse wireplumber pavucontrol - -## Copy over ssh keys to relevant machines @user_action -ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N "" - -## Setup ssh drives -# sudo apt install -y sshfs -## Mount the drives using /etc/fstab automatically -## Example: -## -## root@157.90.144.237:/ /server-vps fuse.sshfs noauto,x-systemd.automount,_netdev,x-systemd.idle-timeout=2min,x-systemd.mount-timeout=10s,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,IdentityFile=/home/kk/.ssh/id_ed25519,UserKnownHostsFile=/home/kk/.ssh/known_hosts,StrictHostKeyChecking=accept-new,allow_other,default_permissions 0 0 - - - - - -# -# # Setup internet -# # sudo apt install w3m surfraw -# sudo apt install chromium - -# Extra -## Clipboard history -# sudo apt install cliphist - -# Install -curl -LO https://github.com/peteonrails/voxtype/releases/download/v0.6.0/voxtype_0.6.0-1_amd64.deb -sudo dpkg -i voxtype_0.6.0-1_amd64.deb -rm voxtype_0.6.0-1_amd64.deb -sudo apt install wtype wl-clipboard libnotify-bin pipewire-alsa playerctl - -sudo usermod -aG input $USER - -read -r -p "Enable GPU support? [y/N] " answer -case "$answer" in - [yY]|[yY][eE][sS]) - sudo voxtype setup gpu --enable - ;; -esac - - -# Interactive model selection and systemd setup -voxtype setup -voxtype setup systemd -voxtype setup model