スキル一覧に戻る
khaneliman

nix-option-types

by khaneliman

nix-option-typesは、ソフトウェア開発を効率化するスキルです。開発ワークフロー全体をサポートし、チームの生産性向上とコード品質の改善を実現します。

303🍴 14📅 2026年1月23日
GitHubで見るManusで実行

SKILL.md


name: nix-option-types description: "Nix module option types and definition patterns. Use when defining options with mkOption, choosing types, or creating submodules."

Option Types

Prefer Helpers When Available

HelperUse For
mkEnableOptionBoolean enable flags
mkPackageOptionPackage options
mkOptionEverything else

Basic Types

options = {
  # Boolean (use mkEnableOption for enable flags)
  enable = mkEnableOption "feature";

  # String
  name = mkOption {
    type = types.str;
    default = "default";
    description = "The name";
  };

  # Integer
  count = mkOption {
    type = types.int;
    default = 1;
  };

  # Port (validated 1-65535)
  port = mkOption {
    type = types.port;
    default = 8080;
  };

  # Path
  configPath = mkOption {
    type = types.path;
    default = ./config.yaml;
  };

  # Package
  package = lib.mkPackageOption pkgs "myPackage" { };
};

Collection Types

options = {
  # List of strings
  args = mkOption {
    type = types.listOf types.str;
    default = [ ];
  };

  # Attribute set of strings
  env = mkOption {
    type = types.attrsOf types.str;
    default = { };
  };

  # Enum (one of values)
  level = mkOption {
    type = types.enum [ "debug" "info" "error" ];
    default = "info";
  };

  # Nullable
  optional = mkOption {
    type = types.nullOr types.str;
    default = null;
  };

  # Either type
  portOrSocket = mkOption {
    type = types.either types.port types.path;
  };
};

Submodule Pattern

options.services = mkOption {
  type = types.attrsOf (types.submodule {
    options = {
      enable = mkEnableOption "service";
      port = mkOption {
        type = types.port;
        default = 8080;
      };
    };
  });
  default = { };
};

# Usage:
config.namespace.services.myService = {
  enable = true;
  port = 9000;
};

mkPackageOption

# Simple
package = lib.mkPackageOption pkgs "git" { };

# Nested package path
package = lib.mkPackageOption pkgs "nodePackages" {
  default = [ "typescript" ];
};

スコア

総合スコア

65/100

リポジトリの品質指標に基づく評価

SKILL.md

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

+20
LICENSE

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

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

+5
最近の活動

3ヶ月以内に更新

+5
フォーク

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

+5
Issue管理

オープンIssueが50未満

+5
言語

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

+5
タグ

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

+5

レビュー

💬

レビュー機能は近日公開予定です