Skip to content

Bundle runtime helper binaries into module packages (postInstall files are dropped by the portable bundler) #114

Description

@xAlisher

Problem

A module often needs runtime helper executables alongside its plugin — e.g. radio-basecamp spawns mediamtx (HLS origin), tor/torsocks (onion mode), and ffplay. There's currently no supported way to ship them inside the .lgx: files a module writes via its flake postInstall to $out are dropped by the portable bundler. nix-bundle-dir closures only the plugin .so + its DT_NEEDED lib deps, so anything extra (a sidecar binary in $out/bin) never reaches modules/<name>/.

Repro

# module flake.nix
mkLogosModule {
  src = ./.; configFile = ./metadata.json; flakeInputs = inputs;
  postInstall = ''
    mkdir -p "$out/bin"
    install -m555 ${pkgs.mediamtx}/bin/mediamtx "$out/bin/mediamtx"
  '';
}

nix build .#install-portablefind result -name mediamtxempty. The binary is stripped from the bundle.

Impact

Modules that spawn helper binaries can't be self-contained. Today the user must install the binaries system-wide (or set env overrides), otherwise the module fails at runtime with e.g. "MediaMTX isn't available on this system." — a poor install UX, especially for catalog/lgpm installs where no setup script runs. metadata.json's nix.packages.runtime declares such deps but doesn't bundle them.

Ask

A supported "extra runtime files" mechanism — e.g. a runtimeBins / extraFiles argument to mkLogosModule that the portable bundler relocates into modules/<name>/bin/:

  • Static binaries (Go, e.g. MediaMTX) → just copy.
  • Dynamic binaries (tor, ffmpeg) → relocate their lib closure + patchelf --set-rpath '$ORIGIN/../lib', the same treatment the plugin .so already gets — so the .lgx stays portable on machines without Nix.

That would let modules ship a complete, self-contained package.

Context / workaround

Hit while building radio-basecamp (decentralized audio broadcast). Current workaround: the module resolves binaries from its own dir (env → <module-dir>/bin/<tool> → PATH) and the dev install script drops a static MediaMTX post-install — but catalog installs don't run that script, so it isn't a real fix. Hence this request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions