cigen vs Nx affected and Nx Cloud
Nx picks the tasks a change affects and replays cached task output inside a job. cigen decides, per CI job, whether that job needs to run at all. How they differ, and how they combine.
Nx is a build system for monorepos, strongest in JavaScript and TypeScript. Two of its features cover
ground cigen also covers: nx affected runs only the tasks a change touches, and its cache (local, or remote through Nx
Cloud) replays a task’s output when its inputs haven’t changed. Both work inside your build, task by task. cigen works
one level up, on the CI config: it decides whether each CI job starts its work at all, and doesn’t care what build tool
the job runs.
What Nx does
nx affected -t test compares a base commit with the current files and selects every task whose declared inputs a
changed file matches, plus the tasks that read those tasks’ outputs. Nx’s docs recommend the latest successful commit on
main as the base, so every change since the last green run is included. A lockfile change affects every task unless
you narrow it with projectsAffectedByDependencyUpdates
(Run only tasks affected by a PR).
Its cache hashes a task’s inputs: the project’s files, files from projects it depends on, workspace configuration, external dependency versions, runtime values such as the OS, and the command’s arguments. A hit restores the task’s terminal output and its output files (Cache task results). Nx Cloud shares that cache across machines and adds distributed task execution; it has a free Hobby plan and paid plans (pricing). You can also run your own cache server against Nx’s OpenAPI spec (self-hosted remote cache).
Where Nx is the better choice
- It restores outputs: a cached
buildgives you itsdist/back, so later tasks can use it. cigen records only that a job passed; it caches no build artifacts and doesn’t plan to. - Nx skips individual tasks inside one job: lint one package, test three, build one. cigen skips whole CI jobs.
- In a JavaScript monorepo Nx reads package dependencies itself, and selects the dependents of a changed package without you listing them.
- Nx Cloud’s Ultracache hashes tasks from the files they actually read, on Nx Cloud’s agents, rather than only from declared inputs (the self-hosted cache relies on declared inputs, per the docs above).
Where cigen fits better
- cigen’s jobs run whatever their steps say (
cargo test,bundle exec rspec,make), with no workspace to adopt. Nx needs an Nx workspace and project configuration. - A job that runs Playwright, a Docker build or a deploy check isn’t an Nx task in most repos. cigen skips it from its inputs all the same.
- Nx’s docs warn that undeclared inputs cause missed selections. cigen adds the inputs people forget to a job’s hash itself: the job’s definition, the scripts its steps name, and the root toolchain pins and lockfiles (derived inputs).
- cigen compiles one strict config into GitHub Actions and CircleCI files, with the skip steps generated. With Nx you
still write the workflow yourself and call
nx affectedfrom it.
Using both
They stack. Let cigen skip the CI job when nothing it depends on changed, and run Nx inside the job when it does:
# cigen.yml
provider: github
workflows:
ci:
github:
on:
pull_request: {}
push: { branches: [main] }
jobs:
test:
image: node:24
inputs:
['apps/**', 'libs/**', 'nx.json', 'package.json', 'pnpm-lock.yaml']
steps:
- run: pnpm install --frozen-lockfile
- run: pnpm exec nx affected -t test --base=origin/main
When nothing under apps/ or libs/ changed since the job last passed, the job skips before installing anything. When
something did, Nx narrows the work to the affected tasks and replays the rest from its cache.
When to pick which
- Nx: a JavaScript or TypeScript monorepo with many packages, where task-level selection and restored build outputs save the most time.
- cigen: CI jobs in any language; jobs that aren’t build tasks; repos that want generated, strict CI config with skipping built in.
- Both: a monorepo where some CI jobs are Nx tasks and others aren’t.
What cigen can’t do yet
cigen is being rebuilt in the open. On GitHub Actions a skipped job still takes a runner and a checkout until the planned planner job exists. Pass records live in the GitHub Actions cache: scoped by branch and expired after 7 days unused. The release install step needs v0.2.0, which isn’t out yet. See the roadmap.