diff --git a/home/modules/ai-tools/default.nix b/home/modules/ai-tools/default.nix index f24e040c..9ee6c47e 100644 --- a/home/modules/ai-tools/default.nix +++ b/home/modules/ai-tools/default.nix @@ -2,6 +2,7 @@ imports = [ ./claude-code.nix ./opencode.nix + ./skills.nix ./tirith.nix ]; } diff --git a/home/modules/ai-tools/skills.nix b/home/modules/ai-tools/skills.nix new file mode 100644 index 00000000..84d40a11 --- /dev/null +++ b/home/modules/ai-tools/skills.nix @@ -0,0 +1,49 @@ +{ + lib, + config, + pkgs, + ... +}: +let + cfg = config.ai-tools.claude-code; + + skillType = lib.types.submodule { + options = { + owner = lib.mkOption { type = lib.types.str; }; + repo = lib.mkOption { type = lib.types.str; }; + rev = lib.mkOption { type = lib.types.str; }; + hash = lib.mkOption { type = lib.types.str; }; + skill = lib.mkOption { type = lib.types.str; }; + }; + }; + + fetchSkill = + skill: + let + src = pkgs.fetchFromGitHub { + inherit (skill) + owner + repo + rev + hash + ; + }; + in + { + name = ".claude/skills/${skill.skill}"; + value = { + source = "${src}/${skill.skill}"; + recursive = true; + }; + }; +in +{ + options.ai-tools.claude-code.skills = lib.mkOption { + type = lib.types.listOf skillType; + default = [ ]; + }; + + config = lib.mkIf cfg.enable { + home.file = builtins.listToAttrs (map fetchSkill cfg.skills); + }; +}