nixos-modules

Document NixOS module patterns for options, imports, and systemd services.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/kaiiiiiiiii/nix-packages --skill nixos-modules
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nixos-modules
Source: https://github.com/kaiiiiiiiii/nix-packages/tree/main/.github/skills/nixos-modules
Command: npx skills add https://github.com/kaiiiiiiiii/nix-packages --skill nixos-modules

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The NixOS module system guide solves the complexity of building reusable, well-structured NixOS modules by providing clear patterns for options, imports, and service configurations.

Core Features & Use Cases

  • Clear module structure, option declarations via mkOption, and config composition using lib.mkIf and lib.mkMerge.
  • Reusable patterns for imports, services, and module organization to standardize NixOS configurations across projects.
  • Use cases include creating custom services, configuring system options, and composing multiple modules into a cohesive NixOS setup.

Quick Start

Create a simple NixOS module that declares an option and wires it into a service.

Frequently Asked Questions about nixos-modules

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

FAQPage Schema
How do I structure a NixOS module with mkOption and mkIf?

To structure a NixOS module, you declare custom options using mkOption and conditionally apply configurations using mkIf. This pattern separates option declarations from service logic, enabling reusable and composable NixOS setups across different projects.

What is the best way to compose multiple NixOS module configurations?

The best way to compose multiple NixOS configurations is by using mkMerge to combine option definitions safely. This approach standardizes module organization, allowing you to import and layer various services without conflicting overrides.

How do I create a custom systemd service in a NixOS module?

You create a custom systemd service in a NixOS module by declaring options with mkOption and wiring them into the systemd service configuration. Using mkIf ensures the service activates only when your specific custom option is enabled.

When do I need to use mkMerge when building NixOS modules?

You need to use mkMerge when building NixOS modules to combine multiple configuration attributes or conditional blocks defined with mkIf. It prevents conflicts by allowing multiple module definitions to coexist within a single cohesive NixOS setup.

Does this NixOS module pattern support standardizing configurations across projects?

Yes, these NixOS module patterns support standardizing configurations across projects. By providing reusable structures for imports, option declarations, and service integrations, you can maintain consistent NixOS setups and easily compose modules.

Why are my NixOS module options not overriding default system configurations?

NixOS module options may not override defaults if they are not properly structured using mkMerge to layer configurations. Applying these reusable patterns ensures your custom settings integrate correctly with existing system options without causing conflicts.