nix-bundle-lgx

A Nix bundler that packages a derivation's lib/ output into a single-variant .lgx file.

Bundlers

#default (dev)

Wraps the derivation's lib/ directory directly into an .lgx package with a dev variant (-dev suffix). Dynamic libraries are not relocated — they continue to resolve dependencies from /nix/store at runtime. Suitable for environments where the Nix store is available.

nix bundle --bundler github:logos-co/nix-bundle-lgx .#lib

#portable

First passes the derivation through nix-bundle-dir#qtPlugin, which copies all non-system/non-Qt transitive dependencies alongside the library and rewrites their rpaths to use @loader_path (macOS) or $ORIGIN (Linux). The resulting self-contained directory is then wrapped into an .lgx package with the portable variant (no suffix).

nix bundle --bundler github:logos-co/nix-bundle-lgx#portable .#lib

#dual

Produces a dual-variant .lgx package containing both the portable variant and the dev variant. The portable variant is created via nix-bundle-dir (self-contained), while the dev variant uses the raw derivation output (resolves from /nix/store). Useful for distributing a single package that works in both dev and portable environments.

nix bundle --bundler github:logos-co/nix-bundle-lgx#dual .#lib

Variant Names

Each bundler mode produces variants with specific naming:

Nix system Dev variant (#default) Portable variant (#portable)
aarch64-darwin darwin-arm64-dev darwin-arm64
x86_64-darwin darwin-amd64-dev darwin-amd64
aarch64-linux linux-arm64-dev linux-arm64
x86_64-linux linux-amd64-dev linux-amd64

The #dual bundler includes both the portable and dev variant names in a single .lgx file.

Output

All bundlers produce a single .lgx file placed in $out/. When invoked via nix bundle -o result, the result symlink points to that directory.

Metadata

The bundler reads metadata.json from the derivation's source tree (drv.src) at Nix eval time — not from the build output. If metadata.json is found, the fields name, version, description, author, type, category, dependencies, and view are patched into the .lgx manifest automatically. If not found, the bundler falls back to an empty {}.

metadata.json is not required in the derivation output ($out/) for core or ui modules.

For type == "ui_qml":

  • view is required and points to the QML entry file bundled inside each variant
  • main is optional and, when present, is treated as the backend plugin base name
  • QML-only packages are emitted without synthesizing main = view

Expected derivation layout

The bundler expects the input derivation to expose a lib/ subdirectory containing the shared library (.dylib on macOS, .so on Linux). This matches the #lib output convention used by Logos modules.

$out/
  lib/
    libfoo.dylib   # or libfoo.so
  metadata.json    # optional
S
Description
No description provided
Readme
274 KiB
Languages
Shell 54.5%
Nix 45.5%