From b55fe924e7888fdef0b7d1b3398fbc57562eeac6 Mon Sep 17 00:00:00 2001 From: Sprite Date: Tue, 24 Nov 2026 22:11:00 +0000 Subject: [PATCH] README: credit snix for design ideas; document GPL-3.0 licence boundary (no code copied) Co-Authored-By: Claude Sonnet 5.5 --- README.md | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 541a01a..7f9aa32 100644 --- a/README.md +++ b/README.md @@ -227,10 +227,45 @@ NAR round trips, and real symlink/exec-bit unpacking. * Building (sandboxed builders, namespaces, fixed-output derivations). * A pinned channel mechanism (channel eval id → exact package set). +## Inspiration: snix (and licensing) + +The layout is inspired by [snix](https://snix.dev/) ([source](https://git.snix.dev/snix/snix)), +the Rust re-implementation of Nix, in particular its `nix-compat` crate, +which splits Nix's wire/on-disk formats into small independent modules +(`nixbase32`, `store_path`, `narinfo`, `nar`, `nixhash`, `derivation`, …) +separate from the services that use them. Borrowed *ideas*: + +* format handling as pure, individually tested modules (our `store`, + `narinfo`, `nar`, `sign`) kept apart from I/O (`cache`, `installer`, + `profile`, `cli`); +* the store / content-addressed-store split: snix's `castore` stores + NAR *contents* (blobs/directories) separately from Nix's store-path + metadata. `mnix` only has the first, simplest half of that idea: the NAR + is parsed into an in-memory tree (`nar.Node`, comparable to castore's + directory/file/symlink nodes) which the `installer` materialises into a + store dir, so a content-addressed or chunked backend could replace + `installer` without touching the NAR/narinfo/signature code; +* "Nix-compatible surface, different internals" as the goal for a future + evaluator (see below). + +**Licence:** snix's crates are licensed GPL-3.0 (only its protobuf service +definitions are MIT). `mnix` is Apache-2.0, so **no snix code was copied or +translated**; everything here was written from the public Nix formats +(nixbase32, narinfo fingerprints, NAR) and from observing real +cache.nixos.org/Hydra responses. If snix code were ever reused, the +affected packages would have to be relicensed under GPL-3.0. + ## Stretch goal: Nix expression evaluator -Not implemented. The binary-cache path was prioritised and an evaluator -subset would not have contributed to the install flow. +Not implemented (the binary-cache path was prioritised). Design notes for a +future `nixexpr` package, informed by snix's `eval` crate (parser → AST → +bytecode compiler → VM with thunks/upvalues, builtins as a separate +module, an I/O abstraction so evaluation is embeddable and testable): +a lexer/parser for literals, attrsets, lists, `let`, lambdas, string +interpolation; a *lazy* evaluator (thunks, since Nix is lazy and nixpkgs +depends on it); a small `builtins` set behind an I/O trait; tests per +language feature. A tree-walking lazy evaluator would be the realistic +first step; a bytecode VM like snix's is the performance route. ## License