nix-config

Manage modular NixOS and macOS configurations with a three-file pattern.

Updated Jan 1, 2026
One-click install
npx skills add https://github.com/ChanningHe/dotfiles --skill nix-config
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nix-config
Source: https://github.com/ChanningHe/dotfiles/tree/main/claude/skills/nix-config
Command: npx skills add https://github.com/ChanningHe/dotfiles --skill nix-config

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps teams manage complex multi-platform configurations by separating public configuration logic from sensitive data using a platform-agnostic three-file pattern for NixOS and macOS.

Core Features & Use Cases

  • Three-file pattern: default.nix (platform-agnostic), nixos.nix (Linux-specific), and darwin.nix (macOS-specific) to enable clean, reusable modules.
  • Layered configuration: hosts/common/core, hosts/common/optional, hosts/common/users, and host-specific directories allow scalable inheritance and customization.
  • Separation of concerns: public configuration vs private data via nix-config and nix-secrets, with documentation and quick-start guidance.

Quick Start

Create a new host by scaffolding default.nix along with nixos.nix and/or darwin.nix, and connect them to host specs while storing secrets in nix-secrets/secrets/${hostname}.yaml.

Frequently Asked Questions about nix-config

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage modular NixOS configurations for multiple hosts?

Structure modular NixOS and macOS configurations using a three-file pattern: default.nix for platform-agnostic logic, nixos.nix for Linux, and darwin.nix for macOS, enabling clean reusable modules across hosts.

How do I separate public configuration logic from private data in NixOS?

Separate public NixOS configuration from private data by splitting logic into nix-config and sensitive values into nix-secrets, storing encrypted secrets in files like nix-secrets/secrets/${hostname}.yaml.

Can I use the same Nix configuration files for both NixOS and macOS?

Yes, use default.nix for shared platform-agnostic logic, then branch into nixos.nix for Linux and darwin.nix for macOS to maintain shared configurations across both platforms.

What is the best way to add a new host in a modular NixOS setup?

Scaffold default.nix alongside nixos.nix or darwin.nix, connect them to host specs, and utilize hosts/common/core and optional directories to scale inheritance and customization for the new host.

How do I handle encrypted secrets in a multi-platform NixOS and Darwin setup?

Handle encrypted secrets by isolating them into a nix-secrets repository, storing sensitive values in YAML files like nix-secrets/secrets/${hostname}.yaml to separate them from public configuration logic.

Why does my modular NixOS configuration have conflicting platform-specific settings?

Conflicts arise when platform-specific logic is not isolated in nixos.nix or darwin.nix. Enforce a three-file pattern to keep default.nix platform-agnostic and use hosts/common/optional for scalable inheritance.