pi: add android skills

This commit is contained in:
2026-04-29 23:46:27 -04:00
parent 47565c9e95
commit 8768b285df
3 changed files with 154 additions and 98 deletions

17
flake.lock generated
View File

@@ -25,6 +25,22 @@
"type": "github" "type": "github"
} }
}, },
"android-skills": {
"flake": false,
"locked": {
"lastModified": 1777305465,
"narHash": "sha256-9idRHLKyiVx16EhqYOSGPtUy8BOsf8N02mpUAnRSE7U=",
"owner": "android",
"repo": "skills",
"rev": "640c9e3d0d335c186652f412731ddf831659661c",
"type": "github"
},
"original": {
"owner": "android",
"repo": "skills",
"type": "github"
}
},
"arr-init": { "arr-init": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
@@ -1059,6 +1075,7 @@
"root": { "root": {
"inputs": { "inputs": {
"agenix": "agenix", "agenix": "agenix",
"android-skills": "android-skills",
"arr-init": "arr-init", "arr-init": "arr-init",
"deploy-rs": "deploy-rs", "deploy-rs": "deploy-rs",
"disko": "disko", "disko": "disko",

View File

@@ -82,6 +82,12 @@
url = "github:ChrisOboe/json2steamshortcut"; url = "github:ChrisOboe/json2steamshortcut";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
# Google's official agent-skills for Android development (Apache 2.0).
# Consumed by home/progs/pi.nix and exposed under ~/.omp/agent/skills/.
android-skills = {
url = "github:android/skills";
flake = false;
};
# Server (muffin) — follows nixpkgs-stable # Server (muffin) — follows nixpkgs-stable
nix-minecraft = { nix-minecraft = {

View File

@@ -34,6 +34,47 @@ let
}; };
}; };
}; };
# Pull Google's official agent-skills (github:android/skills, Apache 2.0).
# The upstream tree nests skills as <category>/<name>/SKILL.md (build/agp/…,
# jetpack-compose/migration/…, performance/r8-analyzer, etc.). omp expects a
# flat layout, so we walk the tree, find every SKILL.md, and mount each
# parent directory at ~/.omp/agent/skills/<basename>/. Every leaf basename
# in upstream is unique, so flattening is lossless. New skills upstream show
# up automatically on `nix flake update --input-name android-skills`.
findSkillDirs =
path:
let
entries = builtins.readDir path;
hasSkillMd = builtins.pathExists (path + "/SKILL.md");
subdirs = lib.filterAttrs (_: t: t == "directory") entries;
recurse = lib.concatLists (lib.mapAttrsToList (n: _: findSkillDirs (path + "/${n}")) subdirs);
in
if hasSkillMd then [ path ] else recurse;
androidSkillFiles = lib.listToAttrs (
map (
dir:
lib.nameValuePair ".omp/agent/skills/${builtins.unsafeDiscardStringContext (baseNameOf dir)}" {
source = dir;
}
) (findSkillDirs inputs.android-skills)
);
# Browser path for the playwright skill body.
playwrightChromium =
let
browsers = pkgs.playwright-driver.browsers;
chromiumDir = builtins.head (
builtins.filter (n: builtins.match "chromium-[0-9]+" n != null) (
builtins.attrNames browsers.passthru.entries
)
);
in
{
browsers = "${browsers}";
chrome = "${browsers}/${chromiumDir}/chrome-linux64/chrome";
};
in in
{ {
home.packages = [ home.packages = [
@@ -47,14 +88,15 @@ in
})) }))
]; ];
home.file = androidSkillFiles // {
# main settings: ~/.omp/agent/config.yml (JSON is valid YAML) # main settings: ~/.omp/agent/config.yml (JSON is valid YAML)
home.file.".omp/agent/config.yml".text = builtins.toJSON ompSettings; ".omp/agent/config.yml".text = builtins.toJSON ompSettings;
# model/provider config: ~/.omp/agent/models.yml # model/provider config: ~/.omp/agent/models.yml
home.file.".omp/agent/models.yml".text = builtins.toJSON ompModels; ".omp/agent/models.yml".text = builtins.toJSON ompModels;
# global instructions loaded at startup # global instructions loaded at startup
home.file.".omp/agent/AGENTS.md".text = '' ".omp/agent/AGENTS.md".text = ''
You are an intelligent and observant agent. You are an intelligent and observant agent.
If instructed to commit, disable gpg signing. If instructed to commit, disable gpg signing.
You are on nixOS, if you don't have access to a tool, you can access it via the `nix-shell` command. You are on nixOS, if you don't have access to a tool, you can access it via the `nix-shell` command.
@@ -79,7 +121,7 @@ in
When sketching out an implementation of something, always look for tools that already exist in the space first before implementing something custom. This is also the case when it comes to submodules and sections of code, I don't want you to implement things in-house when it isn't needed. When sketching out an implementation of something, always look for tools that already exist in the space first before implementing something custom. This is also the case when it comes to submodules and sections of code, I don't want you to implement things in-house when it isn't needed.
''; '';
home.file.".omp/agent/skills/android-ui/SKILL.md".text = '' ".omp/agent/skills/android-ui/SKILL.md".text = ''
--- ---
name: android-ui name: android-ui
description: Android UI automation via ADB. Use for any Android device interaction, UI testing, screenshot analysis, element coordinate lookup, and gesture automation. description: Android UI automation via ADB. Use for any Android device interaction, UI testing, screenshot analysis, element coordinate lookup, and gesture automation.
@@ -148,17 +190,7 @@ in
# omp has a built-in browser tool with NixOS auto-detection, # omp has a built-in browser tool with NixOS auto-detection,
# but this skill provides playwright MCP as a supplementary option # but this skill provides playwright MCP as a supplementary option
home.file.".omp/agent/skills/playwright/SKILL.md".text = ".omp/agent/skills/playwright/SKILL.md".text = ''
let
browsers = pkgs.playwright-driver.browsers;
chromiumDir = builtins.head (
builtins.filter (n: builtins.match "chromium-[0-9]+" n != null) (
builtins.attrNames browsers.passthru.entries
)
);
chromiumPath = "${browsers}/${chromiumDir}/chrome-linux64/chrome";
in
''
--- ---
name: playwright name: playwright
description: Browser automation via Playwright MCP. Use as an alternative to the built-in browser tool for Playwright-specific workflows, testing, and web scraping. Chromium is provided by NixOS. description: Browser automation via Playwright MCP. Use as an alternative to the built-in browser tool for Playwright-specific workflows, testing, and web scraping. Chromium is provided by NixOS.
@@ -169,19 +201,20 @@ in
## Browser Setup ## Browser Setup
Chromium is provided by NixOS. Do NOT attempt to download browsers. Chromium is provided by NixOS. Do NOT attempt to download browsers.
- Chromium path: `${chromiumPath}` - Chromium path: `${playwrightChromium.chrome}`
- Browsers path: `${browsers}` - Browsers path: `${playwrightChromium.browsers}`
## Usage ## Usage
Launch the Playwright MCP server for browser automation: Launch the Playwright MCP server for browser automation:
```bash ```bash
npx @playwright/mcp@latest --executable-path "${chromiumPath}" --user-data-dir "${config.home.homeDirectory}/.cache/playwright-mcp" npx @playwright/mcp@latest --executable-path "${playwrightChromium.chrome}" --user-data-dir "${config.home.homeDirectory}/.cache/playwright-mcp"
``` ```
Set these environment variables if not already set: Set these environment variables if not already set:
```bash ```bash
export PLAYWRIGHT_BROWSERS_PATH="${browsers}" export PLAYWRIGHT_BROWSERS_PATH="${playwrightChromium.browsers}"
export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
``` ```
''; '';
};
} }