Back to list
khaneliman

nix-naming

by khaneliman

Nix configuration for my systems supporting macOS, NixOS, and WSL.

303🍴 14📅 Jan 23, 2026

SKILL.md


name: nix-naming description: "Nix naming conventions and code style. Use when naming variables, files, or organizing attributes in Nix code."

Naming Conventions

Quick Reference

ElementStyleExamples
VariablescamelCasecfg, userName, enableFeature
Files/dirskebab-casemy-module.nix, window-managers/
ConstantsUPPER_CASEMAX_RETRIES, DEFAULT_PORT
Cfg patternAlways usecfg = config.namespace.module;

Variables

let
  # Correct - camelCase
  userName = "khaneliman";
  serverHostname = "myserver";
  enableAutoStart = true;

  # Wrong
  user_name = "...";      # snake_case
  UserName = "...";       # PascalCase
in

The cfg Pattern

Always use this pattern:

let
  cfg = config.khanelinix.programs.myApp;
in
{
  config = lib.mkIf cfg.enable { ... };
}

File Naming

# Correct - kebab-case
modules/home/programs/my-app/default.nix
modules/nixos/services/my-service.nix

# Wrong
modules/home/programs/myApp/default.nix   # camelCase
modules/nixos/services/my_service.nix    # snake_case

Attribute Organization

Group by function, then alphabetical:

{
  # Options first
  options.namespace.module = { ... };

  # Config second
  config = {
    # Group related settings
    programs.git = { ... };
    programs.vim = { ... };

    # Then packages
    home.packages = [ ... ];
  };
}

Formatting

  • Use nixfmt for consistent formatting
  • Prefer flat dot-notation: services.nginx.enable = true
  • Avoid deep nesting when flat works

Score

Total Score

65/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

+5
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

+5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon