一键导入
nix-ci
Use this when setting up CI for a GitHub repository — offers GitHub Actions or Vira depending on the project
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use this when setting up CI for a GitHub repository — offers GitHub Actions or Vira depending on the project
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use this when building a Bun (bun.lock) project with Nix. Covers bun2nix, the bun.nix dependency workflow, the bun --compile top-level-await pitfall, and a CI drift check.
Use this when a flake's `nix develop` / `direnv allow` / `nix flake archive` is slow on a fresh checkout (the "first time takes 10 minutes" complaint). Diagnoses where the time actually lives and how to shrink the flake.lock input graph without changing build outputs.
Write a programming essay or blog post in the voice of the canon — Spolsky, Yegge, Graham, Mickens, Dijkstra, Brooks, Nystrom, Kleppmann, patio11. Invoke when the user wants to argue an idea about software, architecture, languages, or the craft — not a debugging war story (use debugging-story for that), not a tutorial, not a release note. The audience is working developers worldwide with taste and strong opinions of their own.
Use this when diagnosing or fixing a user's Nix installation — checks flakes, version, caches, max-jobs, direnv, rosetta, trusted-users, and shell config
Conventions for building Leptos CSR apps with Nix (crane + Trunk).
Run cargo-watch in the background for continuous clippy feedback during code editing.
| name | nix-ci |
| description | Use this when setting up CI for a GitHub repository — offers GitHub Actions or Vira depending on the project |
When the user asks to set up CI, use the Ask tool to prompt them to choose:
Use the install-nix action (avoid DetSys actions) and invoke Vira to build:
# .github/workflows/ci.yml
name: CI
on: [push, pull_request]
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v34
- run: nix profile install github:juspay/vira
- run: vira ci
nix build, no Vira)When building directly with nix build on GitHub runners (instead of vira ci), cache /nix/store across runs with cache-nix-action. Otherwise every run re-fetches all dependency tarballs and rebuilds the whole closure — easily 30 min for a large app. With a warm cache the build job drops to ~1 min (dominated by the restore).
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
actions: write # REQUIRED — see gotcha 2 below
steps:
- uses: actions/checkout@v4
- uses: nixbuild/nix-quick-install-action@v34
- uses: nix-community/cache-nix-action@v6
with:
primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.lock', '**/flake.nix') }}
restore-prefixes-first-match: nix-${{ runner.os }}-
gc-max-store-size-linux: 5G # keep under the 10 GB repo cache limit
purge: true
purge-prefixes: nix-${{ runner.os }}-
purge-last-accessed: 604800
purge-primary-key: never
- run: nix build -L
Two gotchas, each of which makes the cache silently no-op (save/restore complete in ~1s and nothing is cached):
cache-nix-action must pair with nix-quick-install-action, not the DeterminateSystems installer. The DetSys daemon-based store layout isn't snapshotted by the cache action. (This is the concrete reason for "avoid DetSys actions" above.)purge: true requires actions: write permission. Without it the save aborts with Resource not accessible by integration (it calls the REST cache API to purge stale entries) and no nix-* cache is ever created.Verify it worked: gh cache list should show a nix-* entry sized in the hundreds-of-MB-to-GB range — not just the installer's own ~40 MB cache.
Vira is already running and pointed at the repo. Create a vira.hs file in the repo root to configure the build pipeline.
Before generating vira.hs, you MUST fetch and read https://vira.nixos.asia/config to understand the exact DSL format. Do not guess the syntax.
vira.hssignoff.enable = Trueflake.nix files exist (e.g., in subdirectories), add all of them to build.flakes with appropriate overrideInputs settingscache.url = Nothing with a comment -- TODO: configure Attic cache URLbuild.systems should be set to ["x86_64-linux", "aarch64-darwin"] for multi-platform buildsAfter creating vira.hs, run vira ci -b to verify the configuration.