$ show lumen-oss/lux
Lux is a Lua package manager and developer toolchain implemented as a Rust workspace. It is a true application, not a data/research project. The primary entry point is the `lx` CLI (`lux-cli/src/bin/lx.rs`), which dispatches roughly 40 subcommands covering dependency management, installation, building, testing, linting, formatting, vendoring, publishing, and project scaffolding. Underneath, `lux-lib` provides the core engine: rockspec parsing/execution, dependency resolution, lockfile management, source fetching with integrity verification, multi-backend builds, install-tree management, Lua version detection, and LuaRocks-compatible packaging. The workspace also includes `lux-lua` (a Lua API library), `lux-lsp` (progress reporting for language servers), `lux-macros` (proc macros for Lua serialization), and Nix packaging helpers. The primary data flow begins with `lux.toml` project files and workspace manifests. The dependency resolver (`lux-lib/src/pipeline/resolve.rs`) uses a package database chain and concurrent discovery to produce a package graph, which is materialized into a `lux.lock` lockfile with SRI hashes, version constraints, source URLs, and entrypoints. Packages are downloaded from LuaRocks-compatible servers, git remotes, or vendored directories, then built through backends for builtin, make, cmake, rust-mlua, rust-binary, and tree-sitter parsers. Final artifacts are installed into versioned rock trees or flat dist trees, and a Lua loader (`lux-lua/src/loader.rs`) makes those packages requireable from Lua. External dependencies include LuaRocks.org servers, git, C/CMake toolchains, optional Lua installations, and an optional external manifest cache service. Lux is actively maintained and shows strong engineering practices: consistent builder-pattern APIs, typed diagnostics, well-structured error enums, extensive integration tests, cross-platform CI, and a sophisticated Nix overlay. However, it is still pre-1.0 and evolving quickly, with many breaking changes in recent releases. Known weaknesses include non-transactional install operations, hardcoded Lua version hashes, several unsafe code paths, a very large `lua_impls.rs` file, and some disabled CI matrix entries for Lua 5.5 and LuaJIT. Overall, this is a mature and feature-complete package manager with genuinely reusable low-level components.
The LLM identified 5 files worth highlighting for reuse:
Implements Nix Archive (NAR) directory hashing, producing hashes compatible with `nix-hash`. It excludes VCS and Lux-generated files and is verified against the Nix tool in tests. This is a self-contained, non-obvious utility that can be reused by any build system needing reproducible, content-addressed directory digests.
Parses and compares LuaRocks-compatible package versions and constraints, handling operators like `~>`, `>=`, `<`, `==`, HTML-encoded operators, dev/scm revisions, and incomplete versions. This logic is tricky to get right and is a standalone domain capability that could be extracted into any LuaRocks-compatible tool or package-manager library.
Provides robust deserialization of Lua tables into typed Rust values through an embedded Lua interpreter (`ottavino`) and `serde_value`, plus careful escaping and Stylua-formatted rendering of Rust data back to Lua table syntax. This is a reusable bridge for any project that needs to parse or generate structured Lua data with high fidelity, not just rockspecs.
Custom derive/proc macros that serialize Rust structs and enums into Lua table syntax (`DisplayAsLuaKV` / `DisplayAsLuaValue`). The macro encapsulates a non-obvious Rust-to-Lua conversion pattern and could be extracted as a general-purpose serialization layer for Rust crates that need to emit Lua configuration or rockspec files.
A typed lockfile implementation parameterized by read-only/read-write permission states, with auto-flushing guards, integrity validation, and v1-to-v2 migration support. The ownership-and-state-machine pattern is a clean, reusable approach for any tool that needs safe transactional lockfile handling with minimal accidental writes.