Files
logos-liblogos/nix/include.nix
T
Dario LipicarandClaude Opus 5 bfbb1998f9 chore(deps): bump logos-qt-sdk past the header dedup, and follow its plugin-qt (#185)
logos-qt-sdk#42 handed logos_ui_plugin_context.h to logos-view-module, which
owns it beside the view glue emitter it is a matched pair with. Three comments
here listed it among the headers this repo re-exports; they are corrected.

The bump is not a one-input change, for two reasons found by doing it:

  * logos-qt-sdk at this rev requires include/cpp/logos_host_core.h from the
    cpp-sdk headers export, and the logos-cpp-sdk pinned here (e3744fb) predates
    it -- CMakeLists.txt:122 fails the configure outright. So logos-cpp-sdk goes
    to acea0d2 in the same commit (and logos-lidl follows it).

  * logos-qt-sdk GAINED a logos-plugin-qt input after c6be61d0 -- the rev whose
    ABSENCE of one is what the comment here cited to argue there was "no second
    logos-qt-host to collide with". Without a follows the lock resolved qt-sdk's
    own logos-plugin-qt (9b2c64e5) alongside this repo's (1aa3e31c): two
    resolutions of the repo that owns logos-qt-host, which is a second
    TokenManager and every cross-module call refused at runtime with no build
    diagnostic. The follows is added beside the url, matching the ones already
    there for logos-protocol and logos-cpp-sdk. Lock stays at 211 nodes.

Measured effect on the header set this repo re-exports -- exactly one removal:

  removed  logos_ui_plugin_context.h
  added    logos_caller.h, logos_host_core.h, logos_host_services.h,
           logos_qt_host_core.h (+ their cpp/ copies)

logos_api.h, logos_api_provider.h, logos_provider_object.h,
logos_qt_arg_decode.h and qt_provider_object.h all SURVIVE despite leaving
qt-sdk's own cpp/: logos-qt-host supplies them, through the `cp -rf` that runs
after the qt-sdk one precisely so its copies win.

Verified: nix build .#checks.aarch64-darwin.tests and .#default both pass.

NOT addressed, and pre-existing: the lock holds SIX logos-plugin-qt nodes, five
at 9b2c64e5 and this repo's root input at 1aa3e31c. That split is byte-identical
before and after this change.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-23 20:56:40 -03:00

93 lines
4.2 KiB
Nix

# Installs the logos-liblogos headers
{ pkgs, common, src, logosSdk ? null, logosProtocolPkg ? null, logosQtSdk ? null
, logosQtHost ? null }:
pkgs.stdenv.mkDerivation {
pname = "${common.pname}-headers";
version = common.version;
inherit src;
inherit (common) meta;
# This output RE-EXPORTS the Qt host runtime headers, and two of them --
# logos_provider_object.h and logos_qt_arg_decode.h -- include
# <nlohmann/json.hpp>. So anything compiling against these includes needs
# nlohmann on its include path, whether or not it has ever heard of nlohmann.
#
# Consumers that go through find_package(logos-qt-host) already get it: that
# package find_dependency's logos-protocol, which PUBLIC-links nlohmann_json.
# Consumers that take the include directory DIRECTLY -- logos-module-viewer
# uses find_library + raw -I, and it is not alone in that -- bypass CMake's
# propagation entirely and fail with
#
# fatal error: nlohmann/json.hpp: No such file or directory
#
# in a repo that never mentions nlohmann. Propagating it here fixes both
# shapes at the source rather than adding a dependency to each consumer that
# trips over it, which is a list that only grows.
propagatedBuildInputs = [ pkgs.nlohmann_json ];
# No build phase needed, just install headers
dontBuild = true;
dontConfigure = true;
installPhase = ''
runHook preInstall
# Install headers
mkdir -p $out/include
# Install logos_core.h (main C API header)
if [ -f src/logos_core/logos_core.h ]; then
cp src/logos_core/logos_core.h $out/include/
fi
# Also copy SDK headers if available (including logos_mode.h)
if [ -n "${toString logosSdk}" ] && [ -d "${toString logosSdk}/include" ]; then
cp -r ${toString logosSdk}/include/* $out/include/ 2>/dev/null || true
fi
if [ -n "${toString logosProtocolPkg}" ] && [ -d "${toString logosProtocolPkg}/include" ]; then
cp -r ${toString logosProtocolPkg}/include/* $out/include/ 2>/dev/null || true
fi
if [ -n "${toString logosQtSdk}" ] && [ -d "${toString logosQtSdk}/include" ]; then
cp -r ${toString logosQtSdk}/include/* $out/include/ 2>/dev/null || true
fi
# logos-qt-host LAST, and deliberately so. It and logos-qt-sdk both ship a
# logos_api.h (and the rest of the host-runtime headers) while the B2b
# forwarders are still in place, so this copy decides which declaration a
# downstream consumer of THIS prefix compiles against. It has to be the one
# whose code liblogos_core actually links -- logos-qt-host's. They differ:
# qt-host's LogosAPI carries LOGOS_SHARED_API, which is the __declspec
# (dllimport) that makes an in-process Windows consumer import the host's
# TokenManager instead of linking a second one.
#
# Overwriting is the point, so this cp must stay after the qt-sdk one; the
# qt-sdk copy above still supplies the headers qt-host does not ship at all
# (logos_qt_lp_bridge.h, logos_qt_wire.h, logos_qt_host_core.h).
#
# `cp -rf` plus the chmod are load-bearing, not tidiness: everything copied
# above came out of the nix store mode 0444, so a plain `cp -r` over it
# fails with EACCES -- and the `|| true` these lines all carry would swallow
# that and silently leave logos-qt-sdk's header winning. The assertion below
# is what actually proves the overwrite happened.
if [ -n "${toString logosQtHost}" ] && [ -d "${toString logosQtHost}/include" ]; then
chmod -R u+w $out/include
cp -rf ${toString logosQtHost}/include/* $out/include/
# Fail closed if the header that ends up installed is not the one whose
# code liblogos_core links. LOGOS_SHARED_API is present in qt-host's
# logos_api.h and absent from qt-sdk's, so it is the discriminator.
if ! grep -q 'LOGOS_SHARED_API' $out/include/logos_api.h; then
echo "ERROR: $out/include/logos_api.h is not logos-qt-host's copy." >&2
echo " The qt-host headers did not overwrite the qt-sdk ones, so" >&2
echo " consumers of this prefix would compile against a different" >&2
echo " LogosAPI than liblogos_core links." >&2
exit 1
fi
fi
runHook postInstall
'';
}