Proof-of-concept mnix CLI implementing the binary-cache side of Nix in MoonBit (native backend): mnix install hello fetches hello and its closure from cache.nixos.org, verifies it, unpacks it and mnix run hello prints Hello, world!.
What works (verified for real against cache.nixos.org / hydra.nixos.org, x86_64-linux)
store path model + nixbase32, narinfo parsing, ed25519 signature verification (cache.nixos.org-1), closure over References, xz + zstd NAR download, FileHash/NarHash/size verification, NAR parse (+writer), atomic unpack, profile (install/list/remove/env/run), search.
hello (5-path closure) and ripgrep installed and run, both with a user-writable store (via an unprivileged user+mount namespace in mnix run) and with native /nix/store.
moon check --deny-warn, moon test --deny-warn (35 tests), moon fmt clean. Tests include a real signed narinfo, real xz/zstd vectors, NAR round trips, real symlink/exec-bit unpack.
Design decisions / limitations (details in README)
Name resolution: Hydra JSON API (/job/<project>/<jobset>/<attr>.<system>/latest-finished) for exact per-platform paths; store-paths.xz only for search because it mixes platforms. Not pinned to the channel revision.
Binaries hardcode /nix/store; no relocation. Either use --store /nix/store or mnix run (namespace wrapper, needs unprivileged userns).
In-memory NARs (<2 GiB), sequential downloads, no store DB/GC, out output only, bin/ links only.
Stretch goal (Nix expression evaluator) not implemented.
## Summary
Proof-of-concept `mnix` CLI implementing the binary-cache side of Nix in MoonBit (native backend): `mnix install hello` fetches `hello` and its closure from cache.nixos.org, verifies it, unpacks it and `mnix run hello` prints `Hello, world!`.
## What works (verified for real against cache.nixos.org / hydra.nixos.org, x86_64-linux)
- store path model + nixbase32, narinfo parsing, ed25519 signature verification (`cache.nixos.org-1`), closure over References, xz + zstd NAR download, FileHash/NarHash/size verification, NAR parse (+writer), atomic unpack, profile (`install`/`list`/`remove`/`env`/`run`), `search`.
- `hello` (5-path closure) and `ripgrep` installed and run, both with a user-writable store (via an unprivileged user+mount namespace in `mnix run`) and with native `/nix/store`.
- `moon check --deny-warn`, `moon test --deny-warn` (35 tests), `moon fmt` clean. Tests include a real signed narinfo, real xz/zstd vectors, NAR round trips, real symlink/exec-bit unpack.
## Design decisions / limitations (details in README)
- Name resolution: Hydra JSON API (`/job/<project>/<jobset>/<attr>.<system>/latest-finished`) for exact per-platform paths; `store-paths.xz` only for `search` because it mixes platforms. Not pinned to the channel revision.
- Binaries hardcode `/nix/store`; no relocation. Either use `--store /nix/store` or `mnix run` (namespace wrapper, needs unprivileged userns).
- In-memory NARs (<2 GiB), sequential downloads, no store DB/GC, `out` output only, bin/ links only.
- Stretch goal (Nix expression evaluator) not implemented.
- Reused mooncakes: moonbitlang/async, moonbitlang/x (sha256), hustcer/ed25519, lin2077-zeming/moonxz, gaato/zstd.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Store path model + nixbase32, narinfo parser, ed25519 signature
verification, NAR reader/writer, closure computation, xz/zstd NAR fetch
with hash verification, atomic store unpack, profile management, Hydra-based
name resolution, and the mnix CLI. README documents usage, the /nix/store
limitation, and what a fuller implementation needs.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Proof-of-concept
mnixCLI implementing the binary-cache side of Nix in MoonBit (native backend):mnix install hellofetcheshelloand its closure from cache.nixos.org, verifies it, unpacks it andmnix run helloprintsHello, world!.What works (verified for real against cache.nixos.org / hydra.nixos.org, x86_64-linux)
cache.nixos.org-1), closure over References, xz + zstd NAR download, FileHash/NarHash/size verification, NAR parse (+writer), atomic unpack, profile (install/list/remove/env/run),search.hello(5-path closure) andripgrepinstalled and run, both with a user-writable store (via an unprivileged user+mount namespace inmnix run) and with native/nix/store.moon check --deny-warn,moon test --deny-warn(35 tests),moon fmtclean. Tests include a real signed narinfo, real xz/zstd vectors, NAR round trips, real symlink/exec-bit unpack.Design decisions / limitations (details in README)
/job/<project>/<jobset>/<attr>.<system>/latest-finished) for exact per-platform paths;store-paths.xzonly forsearchbecause it mixes platforms. Not pinned to the channel revision./nix/store; no relocation. Either use--store /nix/storeormnix run(namespace wrapper, needs unprivileged userns).outoutput only, bin/ links only.🤖 Generated with Claude Code