Skip to content

Commit 85ec6c6

Browse files
committed
Add nix-ci skill (#8)
Adds a new 'nix-ci' skill that guides agents through setting up CI for GitHub repositories, offering two options: - GitHub Actions with nix-quick-install-action + vira - Vira self-hosted with vira.hs configuration Closes #8
1 parent eb59a8a commit 85ec6c6

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ AI skill pack — reusable [SKILL.md](https://opencode.ai/docs/skills/) definiti
88
|-------|-------------|
99
| [`nix-flake`](./skills/nix-flake/SKILL.md) | Writing flakes with flake-parts, formatter, shell scripts, and language templates |
1010
| [`nix-haskell`](./skills/nix-haskell/SKILL.md) | Haskell projects with haskell-flake: dependencies, settings, devShell, autoWire |
11+
| [`nix-ci`](./skills/nix-ci/SKILL.md) | CI setup for GitHub repos — GitHub Actions or Vira |
1112
| [`vhs`](./skills/vhs/SKILL.md) | Deterministic terminal demo screencasts with VHS and wait patterns |
1213

1314
## Setup (home-manager)

skills/nix-ci/SKILL.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
name: nix-ci
3+
description: Use this when setting up CI for a GitHub repository — offers GitHub Actions or Vira depending on the project
4+
---
5+
6+
# CI Setup
7+
8+
When the user asks to set up CI, use the **Ask tool** to prompt them to choose:
9+
10+
1. **GitHub public runners** — CI via GitHub Actions
11+
2. **Vira self-hosted** — self-hosted CI using [Vira](https://vira.nixos.asia)
12+
13+
## Option 1: GitHub Actions
14+
15+
Use the [install-nix](https://github.com/nixbuild/nix-quick-install-action) action (avoid DetSys actions) and invoke Vira to build:
16+
17+
```yaml
18+
# .github/workflows/ci.yml
19+
name: CI
20+
on: [push, pull_request]
21+
jobs:
22+
build:
23+
strategy:
24+
matrix:
25+
os: [ubuntu-latest, macos-latest]
26+
runs-on: ${{ matrix.os }}
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: nixbuild/nix-quick-install-action@v34
30+
- run: nix profile install github:juspay/vira
31+
- run: vira ci
32+
```
33+
34+
## Option 2: Vira Self-Hosted
35+
36+
Vira is already running and pointed at the repo. Create a `vira.hs` file in the repo root to configure the build pipeline. Refer to the **[Vira configuration docs](https://vira.nixos.asia/config)** for the DSL format.
37+
38+
### Rules for generating `vira.hs`
39+
40+
- If the repo is on **GitHub**, set `signoff.enable = True`
41+
- If **multiple `flake.nix` files** exist (e.g., in subdirectories), add all of them to `build.flakes` with appropriate `overrideInputs` settings
42+
- Leave `cache.url = Nothing` with a comment `-- TODO: configure Attic cache URL`
43+
- Use the **Ask tool** to ask the user whether `build.systems` should be set to `["x86_64-linux", "aarch64-darwin"]` for multi-platform builds
44+
45+
After creating `vira.hs`, run `vira ci -b` to verify the configuration.
46+

0 commit comments

Comments
 (0)