Solve a NixOS problem the declarative, reproducible way
A NixOS-native fix for a configuration, package, or service problem that survives rebuilds and can be rolled back.
The prompt
Help me solve a NixOS problem in a way that is idiomatic to NixOS. I already know Linux well, so skip the basics and focus on Nix-specific semantics.
What I'm trying to do or what's broken: [GOAL or SYMPTOM]
Setup: [flakes or channels, NixOS version, Home Manager yes/no, hardware or VM]
Relevant config: [paste configuration.nix, flake.nix, or module snippets]
Exact errors and commands run: [paste output of nixos-rebuild, nix build, journalctl, etc.]
What I've tried: [ATTEMPTS]
Rules:
- Prefer declarative fixes (module options, overlays, packages in config) over imperative ones (nix-env -i, editing files in /etc, mutable state).
- Check for an existing NixOS module option before writing custom systemd units or activation scripts.
- If the problem is a non-Nix binary (dynamic linking, FHS paths), explain the options: packaging it properly, buildFHSEnv, nix-ld, or steam-run, with trade-offs.
- Explain the root cause in Nix terms (evaluation vs. build vs. activation failure, option conflicts and mkForce/mkDefault priorities, impurity, store paths).
- Say whether the fix differs between flakes and channels.
- Don't invent option names. If unsure an option exists, tell me how to check (nixos-option, search.nixos.org, man configuration.nix) and mark it [VERIFY].
Return:
1. Root cause in 2-3 sentences.
2. The fix as a config diff or module snippet.
3. Commands to apply and test it (including nixos-rebuild test before switch).
4. How to roll back if it goes wrong.
5. Any gotchas for future upgrades.
Highlighted [brackets] are blanks to replace with your own details.
Fill in the blanks and use this promptMore Software Development prompts
What to fill in
- GOAL or SYMPTOM
- paste configuration.nix, flake.nix, or module snippets
- paste output of nixos-rebuild, nix build, journalctl, etc.
- ATTEMPTS
How this prompt is built
This prompt follows the RTF structure (Role, Task, Format). RTF tells the model who to be, what to do and what shape the answer should take. It is the quickest structure that still gives noticeably better results than a bare request.
Related prompts
- Explain what a piece of code doesPlain-language walkthrough of unfamiliar code: purpose, flow, key parts, and gotchas.
- Understand a new codebase quicklyMaps an unfamiliar repository: architecture, key flows, conventions, and where to start.
- Audit a codebase for bugs, risks, and tech debtA systematic review of a repository with prioritized findings and a remediation plan.
- Refactor code to be cleaner and easier to maintainImproves structure, naming, and design without changing behavior.