Declarative NixOS + home-manager configuration with Hyprland (primary) and KDE (secondary) desktop support, or headless. Multi-machine via flakes.
Rebuild (requires nix develop first):
nix develop
fr # rebuild current machine (alias for: nh os switch --hostname ${hostname})
fu # rebuild + update inputs (alias for: nh os switch --hostname ${hostname} --update)
ncg # garbage collection + bootloader cleanupSpecialisations (nslapt only):
sudo nixos-rebuild boot --flake .#nslapt --specialisation power-efficient
sudo reboot # disables NVIDIA for battery lifeThree-stage pipeline (flake.nix:58-100):
- Base (
machines/profiles/base.nix) - ~70 feature flags, most false - Profile (
machines/profiles/{pc,server}.nix) - Feature sets based on machine class - Machine (
machines/{hostname}/default.nix) - Per-machine overrides
Result: vars object available to all modules via specialArgs. Machines define configs inline OR nested in .vars object (flake auto-detects and merges).
Key quirk: Non-reserved attributes in machine config become extraNixosConfig, allowing arbitrary NixOS config in machine file (e.g., boot.devSize, services.periodic-reboot in nsminipc).
- nslapt (pc) - NVIDIA Prime (Intel iGPU + dGPU), passwordless sudo, Restic, iOS support (usbmuxd)
- nspc (pc) - Full NVIDIA (open driver), Steam enabled
- nsminipc (server) - Headless (
desktopEnvironment = null), minimal services
Desktop polymorphism: vars.desktopEnvironment selects "hyprland", "kde", or null. Single config tree supports all; home-manager conditionally imports DE modules.
Hyprland Lua config: Uses configType = "lua"; monitor setup dynamically loaded via require("monitors") from vars.extraMonitorSettings.
Secrets with sops-nix: machines/{hostname}/secrets.yaml encrypted with age key at ~/.config/sops/age/keys.txt. Expected: githubToken, plus conditionals (nextdnsServerName, nextdnsStamp, nextdnsIpUpdateUrl if NextDNS enabled; resticRepository if Restic enabled).
Distributed builds: nspc configured as SSH build machine (speedFactor 2x) for all hosts. Requires pre-configured SSH keys.
Architecture-specific caching: nslapt has gccarch-tigerlake (Intel 11th gen); nspc has gccarch-x86-64-v3. Enables targeted binary cache.
Catppuccin theme quirk: Theme enable = false for hyprland/hyprlock but true for swaync/wlogout/starship. Suggests custom theme or incomplete migration.
| File | Purpose |
|---|---|
flake.nix |
Machine definitions, profile loading, overlays |
machines/{hostname}/default.nix |
Per-machine vars + NixOS overrides |
machines/profiles/base.nix |
Feature flags, system defaults |
modules/system/ |
Boot, hardware, network, NVIDIA, audio, security, printing |
modules/software/packages.nix |
System packages, feature gating |
home/default.nix |
Home-manager conditional imports |
home/hyprland/binds.nix |
Hyprland keybindings |
home/zsh/default.nix |
Shell aliases (fr, fu, ncg defined here) |
- Feature toggle (per machine): Edit
machines/{hostname}/default.nix, addenableX = true/false - System package: Edit
modules/software/packages.nix(environment.systemPackages) - Home-manager app: Create
home/myapp.nix, import inhome/default.nix(conditionally if feature-gated) - Keybinding: Edit
home/hyprland/binds.nix - Theme/wallpaper: Update
stylixImagein machine config - Shell aliases: Edit
home/zsh/default.nix(shellAliases) orhome/zsh/zshrc-personal.nix - Monitor config: Declarative via
extraMonitorSettingsin machine config, or runtime vianwg-displays(F8 key) - Service: Create
modules/services/myservice.nix, conditionally import inmodules/services/default.nix
nix flake check # Validate flake syntax
sudo nixos-rebuild build --flake .#hostname # Dry-run (no reboot)
nix eval .#homeConfigurations.username@hostname # Inspect home-manager output
sudo nix-env --list-generations --profile /nix/var/nix/profiles/system
sudo nh os rollback # Rollback to previous generation