원클릭으로
nixos-pitfalls-and-review
Common mistakes in NixOS code and standards for reviewing and refactoring NixOS repositories.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Common mistakes in NixOS code and standards for reviewing and refactoring NixOS repositories.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Use when creating or editing Obsidian Bases `.base` files with filters, formulas, and views.
Use only when interacting with an already running Obsidian GUI instance through the obsidian CLI.
Use when creating or editing Obsidian-flavored Markdown with wikilinks, embeds, callouts, and frontmatter.
Use when searching markdown knowledge bases, notes, and docs with QMD.
Package new software or update existing packages using Nix
| name | nixos-pitfalls-and-review |
| description | Common mistakes in NixOS code and standards for reviewing and refactoring NixOS repositories. |
NixOS modules are evaluated together and merged through the module system. This has important consequences:
Prefer module-system primitives inside modules:
imports = [ ... ] instead of ad hoc import wiring for moduleslib.mkIf instead of raw top-level if for conditional configlib.mkMerge, lib.mkBefore, lib.mkAfter, and lib.mkForce when merge semantics matterconfig too earlyDo not read merged config values in module top-level bindings unless you know the evaluation rules.
Risky pattern:
{ config, ... }:
let
enabled = config.services.nginx.enable;
in
{
# may cause recursion or surprising evaluation problems
}
Safer pattern:
{ config, lib, ... }:
{
config = lib.mkIf config.services.nginx.enable {
# ...
};
}
Do not create a custom option layer for every single setting.
Create custom options when:
enable switchDo not create them when a plain module import and a few direct assignments are enough.
Hosts should not become giant copies of service configuration. Put reusable service logic in modules and keep hosts focused on machine identity.
stateVersionsystem.stateVersion belongs in the host, not in a shared global file.home.stateVersion belongs in the user or Home Manager config.With flakes, untracked files are often invisible to evaluation.
packages/modules/If a file builds a derivation, it is usually a package file, not a NixOS module.
For larger repos, import a stable set of modules and enable them with options instead of hand-curating imports per host.
Benefits:
Each module should answer one question clearly:
When reviewing a NixOS change, ask:
stateVersion local to the host or user?Run at least:
nix flake checknixos-rebuild build --flake .#<host>If using Home Manager through NixOS, also validate the relevant host build rather than only checking formatting.
The best standards reduce guesswork. If a contributor can predict where a change belongs before searching, the structure is working.