dot

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

144 lines6705 bytesMarkdown

dot

NixOS configuration for desktop: the CachyOS setup from 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. The install wipes the NVMe drive and partitions it with 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

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, hyprpolkitagentthe shell
ewwcontrol centre and notification flyouts
blueman-applet, nm-applet, xembedsniproxytray (after Waybar)
xwl-clipbridgeX11 → Wayland clipboard for Wine/Proton games
autostart-appsopens Signal, Discord, Faugus, OpenDeck and WowUp, each as its own unit
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

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

./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

waybarnixpkgs' Waybar with the three patches from the old PKGBUILD
xembedsniproxystandalone build from plasma-workspace 6.7.5, three patches
signal-desktop-themedSignal with config/signal/theme.css and a transparent window
claude-desktopAnthropic's official Linux .deb, repackaged
opendeckupstream release .deb, repackaged
breezex-cursorBreezeX-Black cursor theme
proton-cachyosCachyOS's Proton release, for Steam
python3-desktopPython 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.