Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 164 additions & 0 deletions .github/workflows/nix-flake.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
name: nix-flake

on:
pull_request:
paths:
- "flake.nix"
- "flake.lock"
- "README.md"
- "skills/**"
- "agents/**"
- ".github/workflows/nix-flake.yaml"
push:
branches:
- main
paths:
- "flake.nix"
- "flake.lock"
- "README.md"
- "skills/**"
- "agents/**"
- ".github/workflows/nix-flake.yaml"

jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v21


- name: Evaluate flake outputs
run: |
set -euo pipefail

nix flake show --all-systems
nix eval .#lib.skillNames
nix eval .#lib.agentProfileNames
nix eval .#lib.supportedTools

test "$(nix eval --raw --apply 'x: if builtins.isFunction x then "true" else "false"' .#homeManagerModules.default)" = "true"
test "$(nix eval --raw --apply 'x: if builtins.isFunction x then "true" else "false"' .#nixosModules.default)" = "true"
test "$(nix eval --raw --apply 'x: if builtins.isFunction x then "true" else "false"' .#darwinModules.default)" = "true"

- name: Smoke test installer
run: |
set -euo pipefail

expected="$(find skills -mindepth 1 -maxdepth 1 -type d | wc -l | tr -d ' ')"
tmp="$(mktemp -d)"

nix run .#install -- --target "$tmp/.agents/skills"
actual_agents="$(find "$tmp/.agents/skills" -mindepth 1 -maxdepth 1 \( -type l -o -type d \) | wc -l | tr -d ' ')"

nix run .#install -- --tool codex --target "$tmp/.codex/skills"
actual_codex="$(find "$tmp/.codex/skills" -mindepth 1 -maxdepth 1 \( -type l -o -type d \) | wc -l | tr -d ' ')"

test "$actual_agents" = "$expected"
test "$actual_codex" = "$expected"

test -f "$tmp/.agents/skills/gitops-knowledge/SKILL.md"
test -f "$tmp/.agents/skills/gitops-repo-audit/SKILL.md"
test -f "$tmp/.agents/skills/gitops-cluster-debug/SKILL.md"

- name: Consumer flake evals (HM + NixOS + nix-darwin)
run: |
set -euo pipefail

repo_path="$PWD"
tmp_root="$(mktemp -d)"

hm_dir="$tmp_root/hm"
mkdir -p "$hm_dir"
cat > "$hm_dir/flake.nix" <<HM
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
home-manager.url = "github:nix-community/home-manager/release-25.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
fluxcd-agent-skills.url = "path:${repo_path}";
};

outputs = { nixpkgs, home-manager, fluxcd-agent-skills, ... }: {
homeConfigurations.test = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs { system = "x86_64-linux"; };
modules = [
fluxcd-agent-skills.homeManagerModules.default
{
home.username = "test";
home.homeDirectory = "/tmp/test-home";
home.stateVersion = "25.11";
programs."fluxcd-agent-skills".enable = true;
programs."fluxcd-agent-skills".tools = [ "codex" ];
}
];
};
};
}
HM

nix eval "$hm_dir#homeConfigurations.test.activationPackage.drvPath"

nixos_dir="$tmp_root/nixos"
mkdir -p "$nixos_dir"
cat > "$nixos_dir/flake.nix" <<NIXOS
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
fluxcd-agent-skills.url = "path:${repo_path}";
};

outputs = { nixpkgs, fluxcd-agent-skills, ... }: {
nixosConfigurations.test = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
fluxcd-agent-skills.nixosModules.default
{
system.stateVersion = "25.11";
boot.loader.grub.devices = [ "nodev" ];
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
fsType = "ext4";
};
programs."fluxcd-agent-skills".enable = true;
programs."fluxcd-agent-skills".targets = [ "/tmp/agent-skills" ];
}
];
};
};
}
NIXOS

test "$(nix eval --json "$nixos_dir#nixosConfigurations.test.config.programs.\"fluxcd-agent-skills\".enable")" = "true"

darwin_dir="$tmp_root/darwin"
mkdir -p "$darwin_dir"
cat > "$darwin_dir/flake.nix" <<DARWIN
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
fluxcd-agent-skills.url = "path:${repo_path}";
};

outputs = { nix-darwin, fluxcd-agent-skills, ... }: {
darwinConfigurations.test = nix-darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [
fluxcd-agent-skills.darwinModules.default
{
system.stateVersion = 6;
programs."fluxcd-agent-skills".enable = true;
programs."fluxcd-agent-skills".targets = [ "/Users/test/.agents/skills" ];
}
];
};
};
}
DARWIN

test "$(nix eval --json "$darwin_dir#darwinConfigurations.test.config.programs.\"fluxcd-agent-skills\".enable")" = "true"
70 changes: 70 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,76 @@ For Claude Code, add the marketplace and install the skills with:
/plugin install gitops-skills@fluxcd
```

### Using Nix Flake

This repository includes a minimal Nix flake for consumers who want a generic,
tool-agnostic skills install flow.

Install skills into the default location (`.agents/skills`):

```shell
nix run github:fluxcd/agent-skills#install
```

Install for a specific tool path:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move all of this to docs/nix-setup.md and in here just have the above command and like to the doc for more info.


```shell
nix run github:fluxcd/agent-skills#install -- --tool codex
nix run github:fluxcd/agent-skills#install -- --tool claude-code
nix run github:fluxcd/agent-skills#install -- --tool gemini
nix run github:fluxcd/agent-skills#install -- --tool kiro
```

Install to an explicit directory:

```shell
nix run github:fluxcd/agent-skills#install -- --target .my-agent/skills
```

The flake discovers skill directories dynamically from `skills/` at evaluation time,
so newly added skills are included automatically without hardcoding names.

### As a Flake Input

The flake exposes reusable modules for Home Manager, NixOS, and nix-darwin:

- `homeManagerModules.default`
- `nixosModules.default`
- `darwinModules.default`

Home Manager example:

```nix
{
inputs.fluxcd-agent-skills.url = "github:fluxcd/agent-skills";

outputs = { self, nixpkgs, home-manager, fluxcd-agent-skills, ... }: {
homeConfigurations.me = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs { system = "x86_64-linux"; };
modules = [
fluxcd-agent-skills.homeManagerModules.default
{
programs."fluxcd-agent-skills".enable = true;
programs."fluxcd-agent-skills".tools = [ "codex" ];
}
];
};
};
}
```

NixOS / nix-darwin (without Home Manager) example:

```nix
{
imports = [ fluxcd-agent-skills.nixosModules.default ]; # or darwinModules.default
programs."fluxcd-agent-skills".enable = true;
programs."fluxcd-agent-skills".targets = [ "/home/alice/.agents/skills" ];
}
```

In system modules, `targets` must be absolute paths and the links are created during activation.

## Prerequisites

The skills in this repository rely on the following tools being available in the environment:
Expand Down
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading