Nix Platform-Specific Configuration

•
40
•

Prevents infinite recursion errors in Nix modules by implementing standardized patterns for cross-platform NixOS and nix-darwin configurations.

This skill provides Claude with specialized logic to handle the complexities of writing multi-platform Nix modules. It addresses the common 'infinite recursion' problem that occurs when developers mistakenly use lazy evaluation tools like mkIf for platform-specific option paths. By teaching Claude the distinction between parse-time checks using optionalAttrs and lazy checks using mkIf, this skill ensures that system configurations for NixOS and macOS remain robust, modular, and error-free.

Key Features

01Provides patterns for nesting mkIf within platform-specific blocks
02Standardizes cross-platform module structures for Darwin and NixOS
03Automates debugging of problematic config references in option defaults
04Implements optionalAttrs for parse-time platform detection
0540 GitHub stars
06Resolves infinite recursion in Nix evaluation logic

Use Cases

01Fixing evaluation errors like _module.freeformType or anon-43 in complex dotfiles
02Porting system-level configurations between NixOS and nix-darwin safely
03Creating a single Nix module that supports both macOS and Linux environments