# Add Nix Component

> How to add a new feature module, host, overlay, package, or NixOS user to this flake. Use when creating any new file under modules/, hosts/, or packages/.

- Skill: `billimek/add-nix-component` (Agent Skill)
- Install (CLI): `npx skillmds@latest add billimek/add-nix-component`
- Raw SKILL.md: https://api.skillmd.com/api/skills/billimek/add-nix-component/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Web & Frontend
- Author: billimek (https://skillmd.com/u/billimek)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/billimek/add-nix-component

---


1. **New feature module**: drop `modules/{nixos,darwin,home}-modules/<name>.nix` wrapped in `{ ... }: { flake.<class>Modules.<name> = <NixOS module>; }`. `import-tree` picks it up; nothing else to wire.
2. **New host**: add the host file(s) under `hosts/{nixos,darwin,home/<user>}/` and add a small `mkNixos`/`mkDarwin`/`mkHome` entry to `modules/wiring/hosts.nix` (system + `hostPath`, plus `sharedPath` for HM). System architecture is declared per host (no more `hostToSystem` heuristic — be explicit).
3. **New overlay**: drop `modules/overlays/<name>.nix` exporting `flake.overlays.<name> = final: prev: { ... }`.
4. **New package**: place the callPackage derivation at `packages/<name>.nix` and register it via `modules/packages/<name>.nix`:
   ```nix
   { ... }:
   {
     perSystem = { pkgs, ... }: {
       packages.<name> = pkgs.callPackage ../../packages/<name>.nix { };
     };
   }
   ```
5. **NixOS users**: `modules/nixos-modules/users-<user>.nix` is one self-contained module per user. Enable on a host via `modules.users.<user>.enable = true;`.

