mnix: Nix binary-cache client PoC in MoonBit (install hello from cache.nixos.org) #1
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user