nix-module-template

Scaffold NixOS, Home Manager, and nix-darwin modules with standard structures.

340|18|Updated May 11, 2023
One-click install
npx skills add https://github.com/khaneliman/khanelinix --skill nix-module-template
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nix-module-template
Source: https://github.com/khaneliman/khanelinix/tree/main/modules/common/ai-tools/skills/module-template
Command: npx skills add https://github.com/khaneliman/khanelinix --skill nix-module-template

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This template provides a ready-to-use, standardized structure for NixOS, Home Manager, and nix-darwin modules, reducing setup time and ensuring consistency across projects.

Core Features & Use Cases

  • Standard module skeletons for NixOS systems, Home Manager configurations, and nix-darwin setups.
  • Encourages best practices: cfg pattern for options, mkIf enable guards, and self-contained module design.
  • Example-driven guidance with sample module layouts and patterns to copy-paste.

Quick Start

Copy the template into your modules directory and customize the options for your target NixOS, Home Manager, or nix-darwin module.

Frequently Asked Questions about nix-module-template

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

FAQPage Schema
How do I scaffold a NixOS module project with a standard structure?

You can scaffold a NixOS module project by copying a ready-to-use template that provides a standard structure. This approach gives you a self-contained module layout using the cfg pattern and mkIf enable guards to ensure consistency across your NixOS configurations.

What is the best way to create a Home Manager module using standard conventions?

Creating a Home Manager module is best done using a standardized template that encourages best practices. The template supplies sample module layouts that apply the cfg pattern for options and mkIf enable guards for safe, self-contained configuration design.

Does this Nix module template work for nix-darwin setups?

Yes, the Nix module template works for nix-darwin setups. It provides standard module skeletons specifically designed for nix-darwin, alongside NixOS and Home Manager, ensuring you can quickly kickstart projects across different Nix-based platforms.

Why use the cfg pattern and mkIf enable guards when building Nix modules?

Using the cfg pattern and mkIf enable guards ensures self-contained Nix module design. These conventions prevent module execution when disabled and provide a standard structure for defining options, reducing setup time and avoiding configuration conflicts.

How do I start customizing a Nix module after copying the template?

After copying the template into your modules directory, you customize the Nix module by modifying the provided options for your target NixOS, Home Manager, or nix-darwin setup. The example-driven sample patterns serve as a guide for copy-pasting.