Files
logos-protocol/nix/default.nix
Dario LipicarandClaude Opus 5 0d2a3c06bf feat(abi): 0.5 — advertise the module teardown surface (#63)
#62 added logos_module_about_to_unload() and
logos_module_set_unload_done_callback() to the module ABI and left the MINOR at
4. That was my oversight, and it is not cosmetic: this header's whole
versioning convention is that each additive surface bumps the MINOR so a
CONSUMER can detect it, and 0.3 exists for exactly this shape -- the
logos_module_grant_host_services export, guarded downstream on
LOGOS_PROTOCOL_VERSION_MINOR >= 3.

Without the bump a code generator emitting calls to the new pair has nothing to
guard on, so its output requires protocol >= #62 unconditionally and fails to
compile against any older header with "logos_module_unload_done_cb was not
declared". That is what logos-cpp-sdk#143 hit: new generator, older protocol
pin, and no way to tell them apart.

With 0.5 the emitters guard the same way 0.3's grant surface is guarded, and new
codegen compiles against an older protocol header -- emitting no teardown calls,
which is exactly right for a module whose ABI cannot carry them.

nix/default.nix tracks the header string by its own comment, so it moves too.

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

64 lines
2.4 KiB
Nix

# Common build configuration shared across all packages
{ pkgs }:
let
# wrapQtAppsNoGuiHook does not even EVALUATE for a mingw host, and would be
# inert anyway: wrap-qt-apps-hook.sh skips anything that is not ELF or
# Mach-O, so a PE is never wrapped. qtbase's own setup hook then hard-errors
# unless dontWrapQtApps is set -- hence both halves of this, not just one.
isWindows = pkgs.stdenv.hostPlatform.isWindows;
in
{
pname = "logos-protocol";
inherit isWindows;
# Tracks LOGOS_PROTOCOL_VERSION_STRING in cpp/logos_protocol.h.
version = "0.5.0";
# Common native build inputs
nativeBuildInputs = [
pkgs.cmake
pkgs.ninja
pkgs.pkg-config
]
++ pkgs.lib.optional (!isWindows) pkgs.qt6.wrapQtAppsNoGuiHook;
# Common runtime dependencies. Qt is an implementation detail of the
# qt_remote (QRO) / qt_local transports — the public C ABI is Qt-free.
buildInputs = [
pkgs.qt6.qtbase
pkgs.qt6.qtremoteobjects
pkgs.boost # Boost.Asio for plain-C++ TCP transports
pkgs.openssl # TLS for TcpSsl
pkgs.nlohmann_json # JSON data model of the C ABI + wire codec
];
# Subset of buildInputs that is safe to propagate to downstream
# consumers via `propagatedBuildInputs`. Excludes Qt: qtbase's
# setup-hook fires `qtPreHook` which errors unless `wrapQtAppsHook`
# (or the no-GUI variant) was sourced first, and propagation order
# through nixpkgs can't reliably guarantee that ordering. So
# consumers must list `qtbase` + `wrapQtAppsNoGuiHook` themselves;
# this set carries the rest (OpenSSL, Boost, nlohmann_json) so they
# don't have to retype it just to satisfy `find_dependency(...)`
# inside the protocol's CMake Config.
propagatedBuildInputs = [
pkgs.boost
pkgs.openssl
pkgs.nlohmann_json
];
# Common CMake flags
cmakeFlags = [ "-GNinja" ]
# Qt splits its host TOOLS (repc, moc, qmltyperegistrar) into separate
# packages that must RUN on the build machine; logos-nix's Windows overlay
# exposes the flags that point Qt at them. Absent -- and so empty -- on a
# native build, which is why this needs no isWindows guard.
++ (pkgs.logosQtCrossCmakeFlags or [ ]);
# Metadata
meta = with pkgs.lib; {
description = "Logos protocol — transports, token exchange and the language-neutral lp_* C ABI";
platforms = platforms.unix ++ platforms.windows;
};
}