nix-patterns
NixOS module patterns. Use when creating or editing NixOS/home-manager modules, adding packages, or configuring programs.
Installation
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
View source ↗GuidesSkill instructions
NixOS Module Patterns
Directory structure
-
modules/home/*.nix- Home-manager modules (user packages, dotfiles) -
modules/nixos/*.nix- NixOS modules (system services) -
hosts/*/- Machine-specific configuration -
home/default.nix- Main home-manager entry point
Adding packages
home.packages = with pkgs; [
package-name
] ++ lib.optionals (stdenv.hostPlatform.system == "x86_64-linux") [
x86-only-package
];
Creating a module
{ pkgs, ... }:
{
home.packages = with pkgs; [ mypackage ];
xdg.configFile."app/config.json".text = builtins.toJSON { setting = "value"; };
}
Import in home/default.nix:
imports = [ ../modules/home/mymodule.nix ];
Examples
Read the usage examples in the source repository.
View source ↗Source history
- Indexed on
- 2026-01-20
- Index updated
- 2026-01-28
- Branch
- main
Index and sync dates describe this directory. View the source repository for code history.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!