Add a Nix flake (anydoc as the default package) - #75
Open
commandodev wants to merge 1 commit into
Open
Conversation
Adds Nix flake support so anydoc can be consumed reproducibly without a Cargo or npm toolchain on the host. Two packages, both driving the same local (offline) Rust conversion: - `default` / `anydoc` — the bare Rust CLI, built from the `convert` example over the library. A single binary with no runtime deps, ideal for images/VMs that just need file-in / Markdown-out. - `anydoc-node` — the upstream `cli.js` over the napi addon, wrapped with a Node runtime for the fuller UX (`--help`, `--version`, stdin `-`, richer format detection). The loader is pointed at the freshly built cdylib via `NAPI_RS_NATIVE_LIBRARY_PATH`, so there are no prebuilt `.node` downloads or platform-triple filenames involved. Also exposes a devShell (cargo/rustc/rustfmt/clippy) and a nixpkgs-fmt formatter. No changes to the Rust sources; `doCheck` is disabled because the snapshot suite needs the gitignored `samples/` corpus. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Nix flake support so anydoc can be consumed reproducibly without a Cargo or npm toolchain on the host — handy for NixOS images, VMs, and CI. No changes to the Rust sources; this is purely additive (
flake.nix+flake.lock).Packages
Both drive the same local, offline Rust conversion:
default/anydoc— the bare Rust CLI, built from theconvertexample over the library. A single binary with no runtime deps.anydoc-node— the upstreamcli.jsover the napi addon, wrapped with a Node runtime for the fuller UX (--help,--version, stdin-, richer format detection).NAPI_RS_NATIVE_LIBRARY_PATH(honoured first innode/index.js), so there are no prebuilt.nodedownloads or platform-triple filenames involved.Also exposes a
devShell(cargo/rustc/rustfmt/clippy) and anixpkgs-fmtformatter.Notes
doCheckis disabled: the snapshot suite depends on the gitignoredsamples/corpus, which isn't in the tree.x86_64-linux,aarch64-linux,x86_64-darwin,aarch64-darwin. Verified with a real build + conversion onx86_64-linux(both packages). The macOS napi link path (-undefined dynamic_lookupvianapi_build) is declared but untested by me — happy to trim the platform list if you'd prefer to only advertise what's CI-verified.🤖 Generated with Claude Code