snix/snix/eval
edef bcb8438856 refactor(eval/builtins/intersectAttrs): use cmp for three-way comparison
There is no point in separately checking lt/eq/gt separately when we
always need the full ordering anyway.

Change-Id: I993108029d205ac17f01acdb6dbf9b2f0cd80f28
Reviewed-on: https://cl.snix.dev/c/snix/+/30372
Reviewed-by: Florian Klink <flokli@flokli.de>
Tested-by: besadii
2025-05-01 16:03:11 +00:00
..
benches feat(tvix/eval/benches): benchmark intersectAttrs 2025-05-01 16:03:11 +00:00
builtin-macros chore(snix): s/tvix/snix/ 2025-03-17 17:15:08 +00:00
proptest-regressions/value chore(snix): s/tvix/snix/ 2025-03-17 17:15:08 +00:00
src refactor(eval/builtins/intersectAttrs): use cmp for three-way comparison 2025-05-01 16:03:11 +00:00
tests fix(nix_oracle): update thunked_formals_fallback_name_resolution_literal 2025-03-18 12:06:33 +00:00
.skip-subtree chore(snix): s/tvix/snix/ 2025-03-17 17:15:08 +00:00
build.rs chore(snix): s/tvix/snix/ 2025-03-17 17:15:08 +00:00
Cargo.toml chore(snix): s/tvix/snix/ 2025-03-17 17:15:08 +00:00
clippy.toml chore(snix): s/tvix/snix/ 2025-03-17 17:15:08 +00:00
default.nix chore(snix): s/tvix/snix/ 2025-03-17 17:15:08 +00:00
README.md chore(snix/eval): Remove refrences of Tvix in docs 2025-03-17 18:18:01 +00:00

Snix Evaluator

This project implements an interpreter for the Nix programming language. You can experiment with an online version of the evaluator: snixbolt.

The interpreter aims to be compatible with nixpkgs, on the foundation of Nix 2.3.

Important note: The evaluator is not yet feature-complete, and while the core mechanisms (compiler, runtime, ...) have stabilised somewhat, a lot of components are still changing rapidly.

Tests

Snix currently has three language test suites for snix-eval:

  • nix_tests and snix_tests are based on the same mechanism borrowed from the C++ Nix implementation. They consist of Nix files as well as expected output (if applicable). The test cases are split into four categories: eval-okay (evaluates successfully with the expected output), eval-fail (fails to evaluate, no expected output), parse-okay (expression parses successfully, no expected output) and parse-fail (expression fails to parse, no expected output). Snix currently ignores the last two types of test cases, since it doesn't implement its own parser.

    Both test suites have a notyetpassing directory. All test cases in here test behavior that is not yet supported by Snix. They are considered to be expected failures, so you can't forget to move them into the test suite proper when fixing the incompatibility.

    Additionally, separate targets in the depot pipeline, under //snix/verify-lang-tests, check both test suites (including notyetpassing directories) against C++ Nix 2.3 and the default C++ Nix version in nixpkgs. This way we can prevent accidentally introducing test cases for behavior that C++ Nix doesn't exhibit.

    • nix_tests has the test cases from C++ Nix's language test suite and is sporadically updated by manually syncing the directories. The notyetpassing directory shows how far it is until we pass it completely.

    • snix_tests contains test cases written by the Snix contributors. Some more or less duplicate test cases contained in nix_tests, but many cover relevant behavior that isn't by nix_tests. Consequently, it'd be nice to eventually merge the two test suites into a jointly maintained, common Nix language test suite.

      It also has a notyetpassing directory for missing behavior that is discovered while working on Snix and isn't covered by the nix_tests suite.

  • nix_oracle can evaluate Nix expressions in Snix and compare the result against C++ Nix (2.3) directly. Eventually it should gain the ability to property test generated Nix expressions. An additional feature is that it can evaluate expressions without --strict, so thunking behavior can be verified more easily.

rnix-parser

Snix is written in memory of jD91mZM2, the author of rnix-parser who sadly passed away.

Snix makes heavy use of rnix-parser in its bytecode compiler. The parser is now maintained by Nix community members.