# dot NixOS configuration for `desktop`: the CachyOS setup from [Eiziv/dotfiles](https://github.com/Eiziv/dotfiles), rewritten as a flake with Home Manager. Hyprland (Lua config) under uwsm, logged in automatically and started behind hyprlock, the patched Waybar and the Eww control centre, the CachyOS kernel and the CachyOS system tweaks. Moving from CachyOS: see [MIGRATION.md](MIGRATION.md). The install wipes the NVMe drive and partitions it with [disko](https://github.com/nix-community/disko). ## Layout ``` flake.nix inputs, the desktop system, the packages below hosts/desktop/ this machine: hostname, Home Manager disko.nix the drive's partitions and btrfs subvolumes modules/nixos/ base.nix Nix, boot, locale, network, firewall, user cachyos.nix CachyOS kernel + cachyos-settings, file by file nvidia.nix RTX 3080 Ti, open kernel module desktop.nix Hyprland, uwsm, autologin, audio, Bluetooth, fonts gaming.nix Steam, proton-cachyos, gamemode, gamescope, ... apps.nix desktop apps, Claude Cowork, OpenDeck udev, Flatpak vm.nix the test VM modules/home/ desktop.nix Hyprland, hyprlock, hypridle, hyprpaper, Waybar, dunst apps.nix kitty, fuzzel, neovim, Firefox files.nix links the rest of config/ into ~/.config (was symlink.sh) services.nix desktop background programs as systemd user services shell.nix zsh (as cachyos-zsh-config), git, gh, ssh theming.nix GTK, cursor, Qt (qt6ct, Kvantum, kdeglobals) packages.nix tools the scripts call; imsh-clients, philly config/ the dotfiles themselves pkgs/ packages not in nixpkgs, or patched tools/bench-compare compares MangoHud logs from CachyOS and NixOS ``` ## Everyday use ```bash nixos-rebuild switch --sudo --flake ~/git/dot # apply changes (alias: rebuild) nix flake update --flake ~/git/dot # newer packages; then rebuild (alias: update) ``` The alias, like the control centre's Desktop update (`tools/nixos-update`), leaves the kernel alone: git.granstrm.com moves it to the latest CachyOS kernel every night and builds it into its binary cache (the `ci` output in `flake.nix`), so the update pulls that commit and downloads the kernel instead of compiling it. Every rebuild is a boot menu entry, so a bad one is undone by picking the one before it. **Editing configs.** Apps with a Home Manager module are set in Nix, in `modules/home/desktop.nix`, `apps.nix` and `theming.nix`: Hyprland, hyprlock, hypridle, hyprpaper, Waybar, dunst, kitty, fuzzel, Firefox's prefs, qt6ct, Kvantum and `kdeglobals`. Paths in them (wallpaper, icons, scripts, the terminal) come from Nix, so change these there and `rebuild`. What has no module, or is code rather than settings, stays in `config/` and is linked straight to this checkout, like the old `symlink.sh` did, so edits apply without a rebuild: Hyprland's startup rules (`hypr/startup.lua`), the scripts under `hypr/scripts` and `waybar/scripts`, the Eww flyouts (`waybar/eww`), fuzzel's launcher and favourites, nvim's `init.lua`, Firefox's `userChrome.css`, the Kvantum themes, the Philly theme and `~/.p10k.zsh`. (Set `dot.liveConfig = false` to have them copied into the Nix store instead.) If the checkout is not at `~/git/dot`, set `dot.repoPath`. Configs that programs write themselves (btop, micro, MangoHud/vkBasalt/vkSumi, `mimeapps.list`) are copied in only when missing and then left to the program. **Signal theme.** `config/signal/theme.css` is built into the Signal package (`pkgs/signal-desktop-themed`), so after editing it run `rebuild` and then `config/signal/restart`. ## Background programs Everything Hyprland used to start from `hl.on("hyprland.start")` is a systemd user service now, started with `graphical-session.target` by uwsm and restarted if it crashes: | Service | | |---|---| | `waybar`, `hypridle`, `hyprpaper`, `dunst`, `hyprpolkitagent` | the shell | | `eww` | control centre and notification flyouts | | `blueman-applet`, `nm-applet`, `xembedsniproxy` | tray (after Waybar) | | `xwl-clipbridge` | X11 → Wayland clipboard for Wine/Proton games | | `autostart-apps` | opens Signal, Discord, Faugus, OpenDeck and WowUp, each as its own unit | ```bash systemctl --user status waybar journalctl --user -u waybar -f systemctl --user restart waybar ``` `config/hypr/startup.lua` keeps only what has to live in the compositor: the startup window rules that place those apps and hide WowUp's window. ## Gaming - Kernel: `linux-cachyos-latest-lto-zen4` from [xddxdd/nix-cachyos-kernel](https://github.com/xddxdd/nix-cachyos-kernel), the same build as CachyOS's znver4 `linux-cachyos` (EEVDF, 1000 Hz, ThinLTO, Zen 4). Built every night it changes by git.granstrm.com, and downloaded from `https://cache.git.granstrm.com`. - cachyos-settings: sysctl, I/O schedulers, THP, ntsync, limits, oomd, PCI latency, ananicy-cpp with CachyOS's rules, bpftune; see `modules/nixos/cachyos.nix`. - `proton-cachyos` is installed for Steam under CachyOS's own internal name (`proton-cachyos-slr`), so Steam's existing choice of it still applies. ProtonPlus-installed tools in `~/.steam` carry over as they are. - Launch options: `game-performance %command%`, `gamemoderun %command%`, `dlss-swapper %command%`, `mangohud %command%`. Not ported: CachyOS builds *all* its packages for x86-64-v3/v4; NixOS uses generic x86-64 builds outside the kernel and Proton. The difference in games is small. `nix develop` opens a shell with nixos-anywhere and nixfmt, on this machine or the Mac. ## Testing in a VM ```bash ./vm.sh ``` Boots this exact system in QEMU, without NVIDIA and with the configs copied in. You land on the desktop; log out (Super+Delete) to see the login screen. ## Custom packages | | | |---|---| | `waybar` | nixpkgs' Waybar with the three patches from the old PKGBUILD | | `xembedsniproxy` | standalone build from plasma-workspace 6.7.5, three patches | | `signal-desktop-themed` | Signal with `config/signal/theme.css` and a transparent window | | `claude-desktop` | Anthropic's official Linux .deb, repackaged | | `opendeck` | upstream release .deb, repackaged | | `breezex-cursor` | BreezeX-Black cursor theme | | `proton-cachyos` | CachyOS's Proton release, for Steam | | `python3-desktop` | Python with PyGObject and python-xlib for the scripts | Each builds on its own, e.g. `nix build .#waybar`. The `.deb`-based ones and proton-cachyos say at the top of their file how to update them.