Home
Turn Nix build logs into JUnit XML reports for your CI.
Features¶
- Translate: Pipe any Nix build output into JUnit XML
- Build: Run
nix buildand get JUnit XML in one command - Check: Discover and run all flake checks, producing a single JUnit report
- CI-ready: Works with GitLab CI, Jenkins, GitHub Actions, and any JUnit-compatible system
- Verbose logging: Control Nix log verbosity to capture the right level of detail
- Colored output: Human-readable summary with color-coded pass/fail/cached status
Quick Example¶
# Pipe nix build output into junix
nix build --log-format internal-json -v --print-build-logs --no-link .#pkg1 |& junix translate -o result.xml
# Or let junix drive the build
junix build .#pkg1 .#pkg2
# Or check all flake checks
junix check
Example output¶
When you run junix check on a flake with passing and failing checks, you get a
colorful summary on stderr:
$ junix check ./tests/sample-flake eval aarch64-linux ... 2 checks ✓ nix eval ./tests/sample-flake#checks.aarch64-linux.failing ✓ nix eval ./tests/sample-flake#checks.aarch64-linux.passing eval x86_64-linux ... 2 checks ✓ nix eval ./tests/sample-flake#checks.x86_64-linux.failing ✓ nix eval ./tests/sample-flake#checks.x86_64-linux.passing build x86_64-linux ... 2 checks ✗ nix build ./tests/sample-flake#checks.x86_64-linux.failing ✓ nix build ./tests/sample-flake#checks.x86_64-linux.passing (cached) FAILED (0/4 evals, 1/2 builds)
And a JUnit XML report on stdout (or to a file with -o):
<?xml version="1.0" encoding="utf-8" ?>
<testsuites>
<testsuite
name="nix-eval.aarch64-linux"
tests="2"
failures="0"
errors="0"
skipped="0"
time="0"
>
<testcase
name="nix eval ./tests/sample-flake#checks.aarch64-linux.failing"
classname="eval checks.aarch64-linux.failing"
time="0"
>
<system-out>
/nix/store/bfhm668k31wxqhgzwd1knnnlzh8rpsxc-failing-check.drv
</system-out>
</testcase>
<testcase
name="nix eval ./tests/sample-flake#checks.aarch64-linux.passing"
classname="eval checks.aarch64-linux.passing"
time="0"
>
<system-out>
/nix/store/132yfmn5jsgxxdqmqgbcl5nf05k2203z-passing-check.drv
</system-out>
</testcase>
</testsuite>
<testsuite
name="nix-eval.x86_64-linux"
tests="2"
failures="0"
errors="0"
skipped="0"
time="0"
>
<testcase
name="nix eval ./tests/sample-flake#checks.x86_64-linux.failing"
classname="eval checks.x86_64-linux.failing"
time="0"
>
<system-out>
/nix/store/8lsmx09idfa0dmyg7d03wzic50whi4x3-failing-check.drv
</system-out>
</testcase>
<testcase
name="nix eval ./tests/sample-flake#checks.x86_64-linux.passing"
classname="eval checks.x86_64-linux.passing"
time="0"
>
<system-out>
/nix/store/z203q28202sj879rz2b36c2bnxb95x1q-passing-check.drv
</system-out>
</testcase>
</testsuite>
<testsuite
name="nix-build.x86_64-linux"
tests="2"
failures="1"
errors="0"
skipped="1"
time="0"
>
<testcase
name="nix build ./tests/sample-flake#checks.x86_64-linux.failing"
classname="/nix/store/8lsmx09idfa0dmyg7d03wzic50whi4x3-failing-check.drv"
time="0"
>
<failure message="Build failed" type="failure" />
<system-out>This check fails</system-out>
<system-err
>error: Cannot build '/nix/store/8lsmx09idfa0dmyg7d03wzic50whi4x3-failing-check.drv'.
Reason: builder failed with exit code 1.
Output paths:
/nix/store/zxa2hj58grdp2j5bmnywznqwnx66qn6m-failing-check
Last 1 log lines:
> This check fails
For full logs, run:
nix log /nix/store/8lsmx09idfa0dmyg7d03wzic50whi4x3-failing-check.drv
</system-err>
</testcase>
<testcase
name="nix build ./tests/sample-flake#checks.x86_64-linux.passing"
classname="checks.x86_64-linux.passing"
time="0"
>
<skipped message="Cached / substituted" type="cached" />
</testcase>
</testsuite>
</testsuites>
Installation¶
Credits¶
Junix is developed and maintained by Moduon. Need a professional Nix or Odoo partner? Contact us.