Upac — a modular package management library for Linux with OSTree integration
GitHub - justpav05/upac: Package manager for installing any type of package in Linux, as well as registering binary file rollbacks based on OSTree, written in Rust and Zig · GitHub | v0.1.4 | LGPL-3.0
Upac is a package management library written in Zig, designed to be embedded into any package manager through a stable C ABI. The CLI frontend is written in Rust and loads libupac.so dynamically at runtime.
What’s interesting about the design
The core idea is that the library imposes zero policy on how packages are fetched or what format they come in. Format-specific logic lives in separate backend shared libraries (libupac-alpm.so, libupac-rpm.so, etc.) — each independently handles unpacking, checksum verification, and metadata parsing. Adding support for a new package format means writing a new .so, the core never changes.
The C ABI boundary was a deliberate design decision: all strings cross as { ptr, len } pairs instead of null-terminated C strings. This makes FFI from Rust, Python, or any other language significantly less painful since Zig slices map naturally to fat pointers.
OSTree integration handles rollbacks — the system state can be reverted to any previous commit, which matters for immutable-style setups.
Why Zig + Rust
Zig handles the low-level library work well: C interop without overhead, precise control over memory layout at the ABI boundary, and comptime for backend dispatch. Rust handles the CLI because ergonomics matter there — argument parsing, formatted output, error display.
Supported Zig versions: ≥ 0.16.0
AI / LLM usage: Claude (Anthropic) was used during development for architectural discussions, design decisions, and code assistance. The project is not vibe-coded — all design decisions were made by the author.