dot

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

144 lines6705 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, logged in automatically and
6started behind hyprlock, the 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, autologin, 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
46The alias, like the control centre's Desktop update (`tools/nixos-update`), leaves
47the kernel alone: git.granstrm.com moves it to the latest CachyOS kernel every
48night and builds it into its binary cache (the `ci` output in `flake.nix`), so
49the update pulls that commit and downloads the kernel instead of compiling it.
50
51Every rebuild is a boot menu entry, so a bad one is undone by picking the one
52before it.
53
54**Editing configs.** Apps with a Home Manager module are set in Nix, in
55`modules/home/desktop.nix`, `apps.nix` and `theming.nix`: Hyprland, hyprlock,
56hypridle, hyprpaper, Waybar, dunst, kitty, fuzzel, Firefox's prefs, qt6ct, Kvantum
57and `kdeglobals`. Paths in them (wallpaper, icons, scripts, the terminal) come
58from Nix, so change these there and `rebuild`.
59
60What has no module, or is code rather than settings, stays in `config/` and is
61linked straight to this checkout, like the old `symlink.sh` did, so edits apply
62without a rebuild: Hyprland's startup rules (`hypr/startup.lua`), the scripts
63under `hypr/scripts` and `waybar/scripts`, the Eww flyouts (`waybar/eww`),
64fuzzel's launcher and favourites, nvim's `init.lua`, Firefox's `userChrome.css`,
65the Kvantum themes, the Philly theme and `~/.p10k.zsh`. (Set
66`dot.liveConfig = false` to have them copied into the Nix store instead.) If the
67checkout is not at `~/git/dot`, set `dot.repoPath`.
68
69Configs that programs write themselves (btop, micro, MangoHud/vkBasalt/vkSumi, `mimeapps.list`) are copied in only when missing and then left to
70the program.
71
72**Signal theme.** `config/signal/theme.css` is built into the Signal package
73(`pkgs/signal-desktop-themed`), so after editing it run `rebuild` and then
74`config/signal/restart`.
75
76## Background programs
77
78Everything Hyprland used to start from `hl.on("hyprland.start")` is a systemd
79user service now, started with `graphical-session.target` by uwsm and restarted
80if it crashes:
81
82| Service | |
83|---|---|
84| `waybar`, `hypridle`, `hyprpaper`, `dunst`, `hyprpolkitagent` | the shell |
85| `eww` | control centre and notification flyouts |
86| `blueman-applet`, `nm-applet`, `xembedsniproxy` | tray (after Waybar) |
87| `xwl-clipbridge` | X11 → Wayland clipboard for Wine/Proton games |
88| `autostart-apps` | opens Signal, Discord, Faugus, OpenDeck and WowUp, each as its own unit |
89
90```bash
91systemctl --user status waybar
92journalctl --user -u waybar -f
93systemctl --user restart waybar
94```
95
96`config/hypr/startup.lua` keeps only what has to live in the compositor: the
97startup window rules that place those apps and hide WowUp's window.
98
99## Gaming
100
101- Kernel: `linux-cachyos-latest-lto-zen4` from
102 [xddxdd/nix-cachyos-kernel]https://github.com/xddxdd/nix-cachyos-kernel, the
103 same build as CachyOS's znver4 `linux-cachyos` (EEVDF, 1000 Hz, ThinLTO, Zen 4).
104 Built every night it changes by git.granstrm.com, and downloaded from
105 `https://cache.git.granstrm.com`.
106- cachyos-settings: sysctl, I/O schedulers, THP, ntsync, limits, oomd, PCI latency,
107 ananicy-cpp with CachyOS's rules, bpftune; see `modules/nixos/cachyos.nix`.
108- `proton-cachyos` is installed for Steam under CachyOS's own internal name
109 (`proton-cachyos-slr`), so Steam's existing choice of it still applies.
110 ProtonPlus-installed tools in `~/.steam` carry over as they are.
111- Launch options: `game-performance %command%`, `gamemoderun %command%`,
112 `dlss-swapper %command%`, `mangohud %command%`.
113
114Not ported: CachyOS builds *all* its packages for x86-64-v3/v4; NixOS uses
115generic x86-64 builds outside the kernel and Proton. The difference in games is
116small.
117
118`nix develop` opens a shell with nixos-anywhere and nixfmt, on this machine or
119the Mac.
120
121## Testing in a VM
122
123```bash
124./vm.sh
125```
126
127Boots this exact system in QEMU, without NVIDIA and with the configs copied in.
128You land on the desktop; log out (Super+Delete) to see the login screen.
129
130## Custom packages
131
132| | |
133|---|---|
134| `waybar` | nixpkgs' Waybar with the three patches from the old PKGBUILD |
135| `xembedsniproxy` | standalone build from plasma-workspace 6.7.5, three patches |
136| `signal-desktop-themed` | Signal with `config/signal/theme.css` and a transparent window |
137| `claude-desktop` | Anthropic's official Linux .deb, repackaged |
138| `opendeck` | upstream release .deb, repackaged |
139| `breezex-cursor` | BreezeX-Black cursor theme |
140| `proton-cachyos` | CachyOS's Proton release, for Steam |
141| `python3-desktop` | Python with PyGObject and python-xlib for the scripts |
142
143Each builds on its own, e.g. `nix build .#waybar`. The `.deb`-based ones and
144proton-cachyos say at the top of their file how to update them.