skills/flake.nix
dan e921fd96df feat: add per-repo skill deployment pattern
- Add bin/use-skills.sh helper with use_skill and load_skills_from_manifest
- Add .skills manifest pattern for declarative skill configuration
- Fix ai-skills.nix: remove broken npm plugin code, update skill list
- Add update-opencode, web-search, web-research to flake.nix availableSkills
- Add RFC and documentation for team adoption

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 14:47:02 -08:00

106 lines
3.2 KiB
Nix

{
description = "AI agent skills for Claude Code and OpenCode";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
let
# Home Manager module for deploying skills
skillsModule = import ./modules/ai-skills.nix;
# List of available skills
availableSkills = [
"niri-window-capture"
"screenshot-latest"
"tufte-press"
"worklog"
"update-spec-kit"
"update-opencode"
"web-search"
"web-research"
];
in
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs { inherit system; };
in
{
# Development shell for working on skills
devShells.default = pkgs.mkShell {
name = "ai-skills";
packages = with pkgs; [
bash
shellcheck
jq
];
shellHook = ''
echo "🤖 AI Skills development environment"
echo "Available skills: ${builtins.concatStringsSep ", " availableSkills}"
echo ""
echo "Commands:"
echo " ./bin/deploy-skill.sh <name> - Copy skill to dotfiles"
echo " bash -n skills/*/scripts/*.sh - Validate all scripts"
'';
};
# Package individual skills for deployment
packages =
let
# Filter to only skills that exist
existingSkills = builtins.filter
(name: builtins.pathExists (./skills + "/${name}"))
availableSkills;
individualSkills = builtins.listToAttrs (
map (skillName: {
name = skillName;
value = pkgs.stdenv.mkDerivation {
name = "ai-skill-${skillName}";
src = ./skills + "/${skillName}";
installPhase = ''
mkdir -p $out
cp -r . $out/
# Make scripts executable
if [ -d $out/scripts ]; then
chmod +x $out/scripts/*.sh 2>/dev/null || true
fi
'';
};
}) existingSkills
);
in
individualSkills // {
# All skills as a combined package
all-skills = pkgs.symlinkJoin {
name = "all-ai-skills";
paths = builtins.attrValues individualSkills;
};
};
})
// {
# Export the Home Manager module
homeManagerModules.ai-skills = skillsModule;
# Also export as nixosModules for compatibility
nixosModules.ai-skills = skillsModule;
# Export skills paths for direct use
lib = {
inherit availableSkills;
# Helper to get skill path
getSkillPath = skillName: ./skills/${skillName};
# Helper to get all skill paths
getAllSkillPaths = map (name: ./skills/${name}) availableSkills;
};
};
}