nix-module-platform-branching
Languages & FrameworksShows how to write Nix modules whose settings exist on only one of NixOS or nix-darwin. Teaches the split between parse-time key removal with optionalAttrs and lazy value gating with mkIf, why mkIf alone lets the wrong platform see a missing option path, and why config reads inside option defaults or optionalAttrs conditions recurse forever. Use when a shared flake module fails evaluation on one platform with an option-does-not-exist error, when recursion errors mention _module.freeformType or anon entries, or when Linux-only and macOS-only settings must coexist in one module. Not for packaging, overlays, Nix language basics, or Home Manager issues unrelated to platform-gated options.
- Version
- v1.0.0
- Size
- 14 KB
- Updated
- 2026-10-10
$ skilvault read --manual nix-module-platform-branchingYour client verifies the signature before reading. This explicit manual read is available on every plan. Free automatically loads five chosen skills; paid plans automatically load relevant skills across the library.