Skip to content

Add a Nix flake (anydoc as the default package) - #75

Open
commandodev wants to merge 1 commit into
firecrawl:mainfrom
getmissionctrl:add-nix-flake
Open

Add a Nix flake (anydoc as the default package)#75
commandodev wants to merge 1 commit into
firecrawl:mainfrom
getmissionctrl:add-nix-flake

Conversation

@commandodev

Copy link
Copy Markdown

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 the convert example over the library. A single binary with no runtime deps.
    nix run github:firecrawl/anydoc -- report.docx
    
  • 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).
    nix run github:firecrawl/anydoc#anydoc-node -- - --format csv < data.csv
    
    The loader is pointed at the freshly built cdylib via NAPI_RS_NATIVE_LIBRARY_PATH (honoured first in node/index.js), 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.

Notes

  • doCheck is disabled: the snapshot suite depends on the gitignored samples/ corpus, which isn't in the tree.
  • Systems declared: x86_64-linux, aarch64-linux, x86_64-darwin, aarch64-darwin. Verified with a real build + conversion on x86_64-linux (both packages). The macOS napi link path (-undefined dynamic_lookup via napi_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

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant