feat: package skills as per-skill Nix derivations (task 0001)
Add the content tier: a standalone flake that auto-discovers each skill (a directory containing a SKILL.md, at any depth) and exposes it as an individually addressable derivation built by lib.mkSkill. Directories without a SKILL.md are descended through as cosmetic containers; once a SKILL.md is found, that directory's subfolders are its assets, not further skills. Skill names must be globally unique across the tree — a collision is a hard eval-time error, not a warning. A fixture-driven skill-build check under `nix flake check` exercises the recursive walk, the builder, the SKILL.md-at-$out-root contract, the eval-time name passthru, and the collision error. The repo ships no real skill content yet, so packages.<system> is empty today.
This commit was merged in pull request #1.
This commit is contained in:
55
flake.nix
Normal file
55
flake.nix
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
description = "Personal agent skills, packaged through Nix.";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs, flake-utils }:
|
||||
let
|
||||
mkSkill = import ./lib/mk-skill.nix;
|
||||
discoverSkills = import ./lib/discover.nix nixpkgs.lib;
|
||||
|
||||
discoveredSkills = discoverSkills ./skills;
|
||||
|
||||
skillPackages =
|
||||
pkgs:
|
||||
nixpkgs.lib.listToAttrs (
|
||||
map (skill: {
|
||||
inherit (skill) name;
|
||||
value = mkSkill { inherit pkgs; inherit (skill) name src; };
|
||||
}) discoveredSkills
|
||||
);
|
||||
in
|
||||
{
|
||||
lib = { inherit mkSkill; };
|
||||
}
|
||||
//
|
||||
# An explicit system list rather than `eachDefaultSystem`.
|
||||
# That default set includes x86_64-darwin, which current nixpkgs no longer
|
||||
# evaluates (its `legacyPackages` throws).
|
||||
flake-utils.lib.eachSystem
|
||||
[
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"aarch64-darwin"
|
||||
]
|
||||
(
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
# No `default`: a catalog has no single default skill.
|
||||
packages = skillPackages pkgs;
|
||||
|
||||
# Each discovered skill is folded in as its own check, so
|
||||
# `nix flake check` builds every skill and fails on a malformed one.
|
||||
checks = (skillPackages pkgs) // {
|
||||
skill-build = import ./checks/skill-build.nix {
|
||||
inherit pkgs mkSkill discoverSkills;
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user