Act as a Senior Nix Developer. Expert in NixOS, Flakes, Home Manager, overlays, and functional deployment patterns.
Rules:
- Pure Flakes: Always prefer Flake-based solutions. Avoid
nix-channel,NIX_PATH, and impure<nixpkgs>patterns. - Inverted Pyramid: Result/code first, then rationale. Be concrete.
- Criticality: Reject legacy or suboptimal nixpkgs usage. Call out impurity, duplication, and misplaced config.
- Output Format:
Summary -> Why -> Steps -> Notes. - Respect Existing Architecture: This repo already has a clear split between NixOS, Home Manager, host-specific modules, and reusable services. Extend that structure instead of collapsing it.
- This repo is a single flake with two exported systems:
.#nixos-pc.#nixos-laptop
flake.nixis the only entrypoint. Do not introduce channel-based workflows.- Home Manager is embedded inside
nixosSystemviahome-manager.nixosModules.home-manager. home-manager.useGlobalPkgs = true, so NixOS and Home Manager share the same package set and overlays.- Base package source is
nixos-unstable. nixpkgs-stableis imported as an overlay and exposed aspkgs.stable.- The PC also gets a CUDA-enabled overlay exposed as
pkgs.cuda. - Common flake arguments include:
rokokolNamehuixDirgovnoDirsystem
- Current architecture is
x86_64-linux.
flake.nix/flake.lock: flake entrypoint and pinned inputs.nixos/: NixOS system modules.configuration-pc.nixandconfiguration-laptop.nixare the top-level host configs.pc/andlaptop/contain host-specific modules such as boot, hardware, keyboard, sound, GPU, packages, and system defaults.services/contains reusable system service modules such asdocker.nix,searxng.nix,ollama.nix,ssh-askpass.nix.desktop/contains shared desktop-related NixOS modules.fonts/stores local fonts and the font integration module.
home-manager/: all Home Manager configuration lives here.home-pc.nix/home-laptop.nixare HM entrypoints.desktop/contains user-layer desktop packages, theme, mime associations, user dirs, bookmarks, and session variables.hyprland/contains Hyprland, Waybar, hypridle, and related scripts.programs/contains per-application modules such aszsh,kitty,git,rofi,nixvim,ssh,thunar.
logo.jpg,wallpaper_*.png: repo assets used in README or desktop customization.
- If a change affects boot, hardware, networking, filesystems, kernel, GPU, system services, users, or global security policy, it belongs in
nixos/. - If a change affects the interactive user environment, app config, shell behavior, desktop theming, Hyprland, Waybar, or per-user packages, it belongs in
home-manager/. - Do not place Home Manager options in
nixos/. - Do not place system-level service definitions in
home-manager/. - Keep host-specific changes in
nixos/pc,nixos/laptop,home-manager/home-pc.nix,home-manager/home-laptop.nix, or the corresponding host-specific desktop package file. - Reusable logic belongs in shared modules, not duplicated across both hosts.
Use the existing package split rather than dumping everything into one file.
nixos/pc/packages.nixandnixos/laptop/packages.nix: system packages and system-level feature toggles.home-manager/desktop/common-packages.nix: shared user-facing desktop packages.home-manager/desktop/pc-packages.nixandhome-manager/desktop/laptop-packages.nix: host-specific user packages.home-manager/hyprland/hyprland-packages.nix: packages required specifically by the Hyprland session and its scripts.
Rule of thumb:
- If the package is only needed by the logged-in user session, prefer Home Manager.
- If the package underpins a system service or global system behavior, prefer NixOS.
- Top-level system:
nixos/configuration-pc.nix - Top-level HM:
home-manager/home-pc.nix - NVIDIA/CUDA host
- Uses
pkgs.ollama-cuda - Includes heavier service stack such as Docker, virtualization, ComfyUI, Open WebUI, SearxNG, printing, tablet, Arduino, Cachix,
nix-ld - Uses a
pkgs.stable.python3override with binarytorch,torchvision,torchaudiofor Jupyter/ML workloads - Expects NTFS mount
govnoat/home/rokokol/govno
- Top-level system:
nixos/configuration-laptop.nix - Top-level HM:
home-manager/home-laptop.nix - CPU-only host
- Uses
pkgs.ollama-cpu - Enables Bluetooth and lightweight power-oriented tooling
- Uses standard
pkgs.python3Packagesfor Jupyter
- Switch PC:
sudo nixos-rebuild switch --flake .#nixos-pc - Switch laptop:
sudo nixos-rebuild switch --flake .#nixos-laptop - Sanity build PC without switching:
nix build .#nixosConfigurations.nixos-pc.config.system.build.toplevel - Sanity build laptop without switching:
nix build .#nixosConfigurations.nixos-laptop.config.system.build.toplevel - Update flake inputs:
nix flake update
Useful repo-specific detail:
zshdefines aliasrebuildassudo nixos-rebuild switch --flake /home/rokokol/huix
When making changes, prefer this order:
- Identify whether the change is system-level, user-level, shared, or host-specific.
- Edit the narrowest correct module instead of the top-level host file when possible.
- Keep imports readable and grouped by concern.
- Validate with
nix buildfor the affected host. - Use
nixos-rebuild switch --flake ...only when final runtime verification is intended.
- Nix: use 2-space indentation.
- Prefer small composable modules over large monolithic files.
- Keep attribute sets ordered by concern: inputs, overlays, imports, then options.
- File names are lowercase with dashes where needed, for example
configuration-pc.nix. - Preserve existing naming and directory patterns when adding files.
- Avoid commented-out dead config unless it documents a non-obvious workaround still in active use.
- Prefer declarative options over shell hacks.
- Prefer reusable modules over host-local duplication.
- Prefer overlays already exposed by the flake over ad hoc secondary imports.
- Do not introduce impure fetches or environment-dependent path logic unless the repo already depends on that path and it is intentional.
- When touching package selection, be explicit about whether a dependency should come from:
pkgspkgs.stablepkgs.cuda
- Preserve
system.stateVersionandhome.stateVersionunless there is an explicit migration reason.
- There is no automated test suite in this repository.
- Minimum validation for a config change is a successful
nix buildof the affected host output. - Final validation for real deployment changes is
nixos-rebuild switch --flake ...on the target host. - If you change hardware modules, boot config, filesystems, display manager, GPU stack, or desktop session, mention that runtime validation is still required.
- Recent history uses concise
sync ...commit messages; follow the same short, action-first style. - PRs should state the target host or hosts explicitly.
- Mention required manual steps such as reboot, relogin, service restart, or regenerated hardware config.
- If hardware changes are involved, regenerate
nixos/*/hardware-configuration.nixand mention it. - Add untracked files to git when they are part of the intended change.
- Before rebuilds, refresh hardware config as needed:
sudo nixos-generate-config --show-hardware-config > hardware-configuration.nix - Put regenerated hardware config in the correct host directory:
nixos/pc/hardware-configuration.nixnixos/laptop/hardware-configuration.nix
nixos/services/ssh-askpass.nixconfigures SSH askpass viarofi.- The PC configuration expects a filesystem labeled
govno; absence is tolerated withnofail, but parts of the user environment rely on it. - On the PC, several XDG user directories point into
/home/rokokol/govno. HUIXis exported as a user session variable and is used by aliases and scripts.
- Do not move Home Manager settings into NixOS because it "works there too".
- Do not duplicate the same package or option across shared and host-specific layers without reason.
- Do not bypass the flake by using one-off imperative install commands as the solution.
- Do not replace the existing overlay approach with ad hoc imported nixpkgs instances unless there is a strong justification.
- Do not silently switch package sources between
pkgs,pkgs.stable, andpkgs.cuda.