dot

vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks

137 lines6254 bytesMarkdown
1# dot
2
3NixOS configuration for `desktop`: the CachyOS setup from
4[Eiziv/dotfiles]https://github.com/Eiziv/dotfiles, rewritten as a flake with
5Home Manager. Hyprland (Lua config) under uwsm, the greetd/gtkgreet login screen,
6the patched Waybar and the Eww control centre, the CachyOS kernel and the CachyOS
7system tweaks.
8
9Moving from CachyOS: see [MIGRATION.md]MIGRATION.md. The install wipes the
10NVMe drive and partitions it with [disko]https://github.com/nix-community/disko.
11
12## Layout
13
14```
15flake.nix inputs, the desktop system, the packages below
16hosts/desktop/ this machine: hostname, Home Manager
17 disko.nix the drive's partitions and btrfs subvolumes
18modules/nixos/
19 base.nix Nix, boot, locale, network, firewall, user
20 cachyos.nix CachyOS kernel + cachyos-settings, file by file
21 nvidia.nix RTX 3080 Ti, open kernel module
22 desktop.nix Hyprland, uwsm, greetd, audio, Bluetooth, fonts
23 gaming.nix Steam, proton-cachyos, gamemode, gamescope, ...
24 apps.nix desktop apps, Claude Cowork, OpenDeck udev, Flatpak
25 vm.nix the test VM
26modules/home/
27 desktop.nix Hyprland, hyprlock, hypridle, hyprpaper, Waybar, dunst
28 apps.nix kitty, fuzzel, neovim, Firefox
29 files.nix links the rest of config/ into ~/.config (was symlink.sh)
30 services.nix desktop background programs as systemd user services
31 shell.nix zsh (as cachyos-zsh-config), git, gh, ssh
32 theming.nix GTK, cursor, Qt (qt6ct, Kvantum, kdeglobals)
33 packages.nix tools the scripts call; imsh-clients, philly
34config/ the dotfiles themselves
35pkgs/ packages not in nixpkgs, or patched
36tools/bench-compare compares MangoHud logs from CachyOS and NixOS
37```
38
39## Everyday use
40
41```bash
42nixos-rebuild switch --sudo --flake ~/git/dot # apply changes (alias: rebuild)
43nix flake update --flake ~/git/dot # newer packages; then rebuild (alias: update)
44```
45
46Every rebuild is a boot menu entry, so a bad one is undone by picking the one
47before it.
48
49**Editing configs.** Apps with a Home Manager module are set in Nix, in
50`modules/home/desktop.nix`, `apps.nix` and `theming.nix`: Hyprland, hyprlock,
51hypridle, hyprpaper, Waybar, dunst, kitty, fuzzel, Firefox's prefs, qt6ct, Kvantum
52and `kdeglobals`. Paths in them (wallpaper, icons, scripts, the terminal) come
53from Nix, so change these there and `rebuild`.
54
55What has no module, or is code rather than settings, stays in `config/` and is
56linked straight to this checkout, like the old `symlink.sh` did, so edits apply
57without a rebuild: Hyprland's startup rules (`hypr/startup.lua`), the scripts
58under `hypr/scripts` and `waybar/scripts`, the Eww flyouts (`waybar/eww`),
59fuzzel's launcher and favourites, nvim's `init.lua`, Firefox's `userChrome.css`,
60the Kvantum themes, the Philly theme and `~/.p10k.zsh`. (Set
61`dot.liveConfig = false` to have them copied into the Nix store instead.) If the
62checkout is not at `~/git/dot`, set `dot.repoPath`.
63
64Configs that programs write themselves (btop, micro, MangoHud/vkBasalt/vkSumi, `mimeapps.list`) are copied in only when missing and then left to
65the program.
66
67**Signal theme.** `config/signal/theme.css` is built into the Signal package
68(`pkgs/signal-desktop-themed`), so after editing it run `rebuild` and then
69`config/signal/restart`.
70
71## Background programs
72
73Everything Hyprland used to start from `hl.on("hyprland.start")` is a systemd
74user service now, started with `graphical-session.target` by uwsm and restarted
75if it crashes:
76
77| Service | |
78|---|---|
79| `waybar`, `hypridle`, `hyprpaper`, `dunst`, `hyprpolkitagent` | the shell |
80| `eww` | control centre and notification flyouts |
81| `blueman-applet`, `nm-applet`, `xembedsniproxy` | tray (after Waybar) |
82| `xwl-clipbridge` | X11 → Wayland clipboard for Wine/Proton games |
83| `autostart-apps` | opens Signal, Discord, Faugus, OpenDeck and WowUp, each as its own unit |
84
85```bash
86systemctl --user status waybar
87journalctl --user -u waybar -f
88systemctl --user restart waybar
89```
90
91`config/hypr/startup.lua` keeps only what has to live in the compositor: the
92startup window rules that place those apps and hide WowUp's window.
93
94## Gaming
95
96- Kernel: `linux-cachyos-latest-lto-zen4` from
97 [xddxdd/nix-cachyos-kernel]https://github.com/xddxdd/nix-cachyos-kernel, the
98 same build as CachyOS's znver4 `linux-cachyos` (EEVDF, 1000 Hz, ThinLTO, Zen 4).
99- cachyos-settings: sysctl, I/O schedulers, THP, ntsync, limits, oomd, PCI latency,
100 ananicy-cpp with CachyOS's rules, bpftune; see `modules/nixos/cachyos.nix`.
101- `proton-cachyos` is installed for Steam under CachyOS's own internal name
102 (`proton-cachyos-slr`), so Steam's existing choice of it still applies.
103 ProtonPlus-installed tools in `~/.steam` carry over as they are.
104- Launch options: `game-performance %command%`, `gamemoderun %command%`,
105 `dlss-swapper %command%`, `mangohud %command%`.
106
107Not ported: CachyOS builds *all* its packages for x86-64-v3/v4; NixOS uses
108generic x86-64 builds outside the kernel and Proton. The difference in games is
109small.
110
111`nix develop` opens a shell with nixos-anywhere and nixfmt, on this machine or
112the Mac.
113
114## Testing in a VM
115
116```bash
117./vm.sh
118```
119
120Boots this exact system in QEMU, without NVIDIA and with the configs copied in.
121You land on the desktop; log out (Super+Delete) to see the login screen.
122
123## Custom packages
124
125| | |
126|---|---|
127| `waybar` | nixpkgs' Waybar with the three patches from the old PKGBUILD |
128| `xembedsniproxy` | standalone build from plasma-workspace 6.7.5, three patches |
129| `signal-desktop-themed` | Signal with `config/signal/theme.css` and a transparent window |
130| `claude-desktop` | Anthropic's official Linux .deb, repackaged |
131| `opendeck` | upstream release .deb, repackaged |
132| `breezex-cursor` | BreezeX-Black cursor theme |
133| `proton-cachyos` | CachyOS's Proton release, for Steam |
134| `python3-desktop` | Python with PyGObject and python-xlib for the scripts |
135
136Each builds on its own, e.g. `nix build .#waybar`. The `.deb`-based ones and
137proton-cachyos say at the top of their file how to update them.