Skip to content
vic

adisbladis/lix-unit

Unit testing for Nix code using Lix

adisbladis/lix-unit.json
{
"createdAt": "2024-09-12T07:11:51Z",
"defaultBranch": "main",
"description": "Unit testing for Nix code using Lix",
"fullName": "adisbladis/lix-unit",
"homepage": null,
"language": "C++",
"name": "lix-unit",
"pushedAt": "2025-09-15T15:42:24Z",
"stargazersCount": 16,
"topics": [],
"updatedAt": "2025-11-07T10:07:48Z",
"url": "https://github.com/adisbladis/lix-unit"
}

[!NOTE] This is a fork of nix-unit that works with Lix.

This project runs an attribute set of tests compatible with lib.debug.runTests while allowing individual attributes to fail.

![]!(./.github/demo.gif)

  • Simple structure compatible with lib.debug.runTests

  • Allows individual test attributes to fail individually.

Rather than evaluating the entire test suite in one go, serialise & compare lix-unit uses the Nix evaluator C++ API. Meaning that we can catch test failures individually, even if the failure is caused by an evaluation error.

  • Fast.

No additional processing and coordination overhead caused by the external process approach.

This comparison matrix was originally taken from Unit test your Nix code but has been adapted. Pythonix is excluded as it’s unmaintained.

ToolCan test eval failuresTests defined in Nixin nixpkgssnapshot testing(1)Supports Lix
Lix-unityesyesnonoyes (2)
Nix-unityesyesyesnono
runTestsnoyesyesnoyes
Nixtnoyesnonoyes
Namakanoyesyesyes?
  1. Snapshot testing
  2. While lix-unit supports Lix, it does not support Nix, and vice versa.

The Lix codebase has gone through significant changes, and it’s not tenable to have a single code base that supports both implementations. Therefore lix-unit was forked from nix-unit.

https://adisbladis.github.io/lix-unit/