Files
logos-liblogos/flake.nix
T
Dario LipicarandClaude Opus 5 93207e4141 chore(deps): track protocol and plugin-qt master (#177)
* fix(windows): point the shared-runtime .def at logos-qt-host, and fail loudly

The Windows single-provider scheme makes liblogos_core.dll the one provider of
the shared C++ runtime, and it names its inputs by CMake TARGET. logos-qt-sdk no
longer carries an archive — the Qt host runtime moved to logos-qt-host — so
$<TARGET_FILE:logos-qt-sdk::logos_qt_sdk> no longer resolves and the whole
mechanism had to be repointed.

More importantly, the old shape failed OPEN. The guard was

  if(WIN32 AND TARGET logos-protocol::... AND TARGET logos-qt-sdk::logos_qt_sdk)

so a missing target did not error — the condition simply went false and the
--whole-archive link, the nm scan and the generated .def were all skipped
SILENTLY. The result is the split-brain this file exists to prevent: main_ui and
ui-host each end up with their own TokenManager and every cross-module call is
refused. The code already fails loudly when `nm` is missing, for exactly this
reason; it had no equivalent guard for the target being absent.

Now the target tests are a foreach + FATAL_ERROR inside if(WIN32), so a missing
provider stops the configure instead of quietly restoring the split-brain.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* feat(access-policy): say ON/OFF out loud, and pin the flag both directions

Deny-by-default enforcement already existed here: `mode: "enforce"` is the
switch, and under it computeDerivedAllowedCallersLocked derives each target's
allowed callers from the declared dependency graph. Nothing about that
changes — this makes the switch legible and pins its contract.

setAccessPolicy now states which side it landed on for every input (no
policy / unparseable / non-enforce mode / enforce). Enforcement that silently
failed to arm is the dangerous outcome: it looks identical to enforcement
that is working and simply has nothing to deny, so an operator who mistyped
`"mode":"enforced"` previously got a wide-open runtime and a clean log.

DenyByDefaultFlagTest drives one scenario through the flip: `declared`
declares `target`, `undeclared` declares nothing. Flag off, the target has no
restriction at all (today's behaviour). Flag on, `declared` is on the list and
`undeclared` is not. The declared half carries the weight — an implementation
that refused everything would pass the denial half on its own.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* feat(b4): link the Qt host runtime from logos-qt-host, not logos-qt-sdk

B1 moved LogosAPI / LogosAPIProvider / LogosProviderBase / PluginInterface
out of logos-qt-sdk into logos-plugin-qt, published as the CMake target
logos-qt-host::logos_qt_host. This repoints liblogos at that target so B2b
can delete logos-qt-sdk's forwarders.

The host runtime is found DIRECTLY: add logos-plugin-qt as an input (pinned
to the B1 rev, since logos-qt-host is not on its master yet) with
logos-protocol / logos-nix / nixpkgs following, and find_package it against
a new LOGOS_QT_HOST_ROOT. It is deliberately not inherited through
find_package(logos-qt-sdk) -- qt-sdk does not carry a dependency on the host
runtime today, and will carry even less of one after B2b.

That also repairs the Windows single-provider block. It already named
logos-qt-host::logos_qt_host, but its comment claimed the target arrived via
find_package(logos-qt-sdk), which was false -- so its FATAL_ERROR guard would
have fired on the first real Windows build. The guard is unchanged (still a
hard error, never a silent skip); its premise is now true.

logos-qt-sdk stays an input, for the developer headers nix/include.nix
re-exports (logos_ui_plugin_context.h and friends) -- not for the host
runtime. Its now-unused -DLOGOS_QT_SDK_ROOT flag is dropped so CMake does not
warn about an unused variable; the env entry stays.

Two silent skips converted to hard errors along the way:

  - tests/CMakeLists.txt guarded its SDK include dirs with `if(EXISTS ...)`,
    so a bad root compiled the tests against a different copy of LogosAPI
    than they link. Now FATAL.
  - nix/include.nix copies the host headers over the qt-sdk ones so consumers
    of this prefix see the declaration liblogos_core actually links (qt-host's
    carries LOGOS_SHARED_API, the dllimport that keeps Windows on one
    TokenManager). Everything copied before it is mode 0444 out of the store,
    so a plain `cp -r` fails with EACCES and the existing `|| true` would have
    swallowed it -- hence chmod + `cp -rf`, plus an assertion that the
    installed logos_api.h really is qt-host's.

Verified on aarch64-darwin with local overrides for cpp-sdk, qt-sdk, protocol
and plugin-qt: logos-liblogos-lib, -include, -tests, default and portable all
build; the `tests` check runs 185 tests, 0 failures. Pointing
LOGOS_QT_HOST_ROOT at a nonexistent path fails the build with the intended
FATAL_ERROR rather than falling back. The header prefix is a strict superset
of the previous one (58 -> 63 files, none removed).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(deps): raise logos-protocol to the rev logos-qt-host actually needs

b3b2e50 repointed this repo from logos-qt-sdk's archive to logos-plugin-qt's
logos-qt-host, but left logos-protocol on master (03842db). That made the
repoint INERT: the tree did not build at all.

    cpp/logos_api.cpp:38:52: error: no member named 'forIdentity' in 'TokenManager'
    cpp/logos_api.cpp:48:24: error: no member named 'isolateIdentity' in 'TokenManager'
    cpp/logos_api.cpp:57:50: error: no member named 'forIdentity' in 'TokenManager'

logos-qt-host's LogosAPI is built on the per-identity token store, and protocol
master has none of it -- 03842db's TokenManager carries only instance(),
m_tokens and m_mutex. The identity API arrives in c8bab12
(feat/per-client-token-store), so that is the floor for consuming qt-host at
all. The rev is pinned in the url, not just the lock, for the same reason
logos-plugin-qt already is: it is not on master, so a bare url would let
`nix flake update` silently walk this back to three compile errors.

The rev is also not merely "new enough". It is the SAME rev logos-basecamp and
logos-standalone-app pin, and that identity is the point. liblogos_core, the
app image and every in-process UI plugin share one TokenManager; two protocol
generations across that boundary give two token stores, which is the
"ModuleProxy: rejecting unauthorized call ... auth token not recognized"
failure the Windows .def block in src/CMakeLists.txt exists to prevent. On PE
that shows up as duplicate definitions; on Mach-O the second store is simply
linked into whichever image referenced a symbol liblogos_core failed to export.
Which is exactly what was happening here: with no forIdentity to import, a
consumer drags logos_api.cpp.o out of the static archive and token_manager.cpp.o
comes with it.

Only logos-protocol moves. logos-cpp-sdk, logos-qt-sdk, logos-plugin-qt and
default-module-loader already `follows` it, so all four now compile against
c8bab12 and the lock diff is one node.

Verified on aarch64-darwin, every package and check built by name, all EXIT=0:
default, logos-liblogos, -bin, -include, -lib, -modules, -tests, portable, and
the `tests` check -- 185 tests, 0 failures. The acceptance measurement on the
built library:

    nm -gU lib/liblogos_core.dylib | grep -c LogosAPI11forIdentity   -> 1  (was: no build)
    nm -gU lib/liblogos_core.dylib | grep -c TokenManager8instanceEv -> 1  (still the provider)

liblogos_core now exports the whole identity surface -- LogosAPI::forIdentity,
TokenManager::forIdentity / isolateIdentity / isIsolated / seedBootstrapTokens
-- so consumers import them instead of re-linking a second copy.

NOT fixed here, and blocking on other repos:

  - packages.x86_64-windows does not evaluate on this branch:
    `attribute 'x86_64-windows' missing` at logos-plugin-qt.packages.<system>.
    logos-qt-host. logos-qt-sdk exposes a windows pseudo-system via
    forAllTargets/mkWindowsPkgs; logos-plugin-qt has only forAllSystems over the
    four real systems. So b3b2e50 traded a Windows-capable provider for one that
    is not, and the Windows single-provider machinery this repo owns cannot be
    evaluated, let alone measured, until logos-plugin-qt grows that target.
    liblogos master (5035877) still evaluates it.

  - the consumer half of the single-provider scheme still fails open:
    logos-basecamp/cmake/LogosSharedFromDll.cmake's
    logos_use_shared_runtime_from_dll() skips names that are not targets with no
    else, so a rename there is a silent no-op rather than an error. Its callers
    pass the right names today, so the hazard is latent rather than active.
    logos-qt-sdk's comment claims that file is duplicated into
    logos-logoscore-cli; at that repo's current HEAD (df31c82) it is not --
    there are no .cmake files there at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* chore(deps): raise logos-plugin-qt to the pushed qt-host branch tip

8ccb1fc -> cc24fa1c, the tip of logos-plugin-qt's
feat/b4-qt-host-windows-target, which is now on origin.

This is not a routine refresh. 8ccb1fc keyed `packages` off forAllSystems and
so had no x86_64-windows attribute at all, while this flake reads
logos-plugin-qt.packages.${system}.logos-qt-host from forAllTargets. Against
the old rev, packages.x86_64-windows.default did not merely fail to build, it
failed to EVALUATE:

    error: attribute 'x86_64-windows' missing
    at flake.nix:145:25
        logosQtHost = logos-plugin-qt.packages.${system}.logos-qt-host;

Against cc24fa1c it evaluates to a derivation. Both directions were confirmed
with --override-input rather than assumed.

cc24fa1c rather than the sibling feat/b4-qt-host-windows-target-8ccb1fc
(989f6ae): the two branches carry the same work and their nix/qt-host.nix is
byte-identical, so they build the same runtime. The tiebreak is that
logos-qt-sdk pins cc24fa1c. This flake deliberately does not make
logos-qt-sdk's logos-plugin-qt follow this one, so pinning the other tip would
put two logos-qt-host builds in a single closure -- two LogosAPI/TokenManager
copies in one process, which is exactly the split-brain the .def block in
src/CMakeLists.txt exists to prevent.

Nothing else in the lock moved, deliberately. logos-protocol was already at
c8bab12; logos-cpp-sdk, logos-qt-sdk and logos-capability-module stay on
master, which is what this branch was written against -- include.nix already
copies qt-host's headers OVER qt-sdk's forwarders and asserts on
LOGOS_SHARED_API, so the surviving forwarders are handled rather than merely
tolerated. That assertion passes.

Verified on aarch64-darwin: all 8 packages plus checks.tests build, exit 0
each; the test suite reports 185 tests, 0 failures, 0 errors.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(windows): export the lp_* C ABI from liblogos_core.dll

The generated .def kept Itanium-mangled C++ only:

    if (name !~ /^_Z/) next

Every lp_* symbol is `extern "C"`, hence unmangled, so the filter dropped the
entire logos-protocol C ABI from the export table by construction. Measured on
the built PE before this change: 3050 exports, of which lp_* = 0 — not
exported, and not even defined in the image.

It stayed invisible because until B5 only C++ callers reached the shared
runtime. B5 re-emits every Qt-typed dependency wrapper as a VENEER over the lp
path, so a consumer that compiles such a wrapper into its own image now calls
lp_invoke / lp_client_create / lp_token_save directly. logos-basecamp compiles
package_manager_api.cpp into LogosBasecamp.exe, and the link failed with plain
`undefined reference to 'lp_invoke'` — no diagnostic pointing at the .def.

Exporting is the correct fix rather than letting the consumer link
liblogos_protocol.a itself: lp_token_save and friends operate on the
TokenManager singleton, so a static copy in the exe would reinstate exactly the
split-brain token store this whole .def scheme exists to prevent. Module plugins
are separate processes and keep their own per-image copy by design.

The prefix is deliberately tight — `lp_` only, not "anything unmangled" — so the
toolchain bookkeeping the ^_Z test was there to exclude (qt_version_tag_*, which
every image legitimately defines) stays excluded.

Delta is fully attributed: 3050 -> 3080 exports, exactly the 30 lp_* symbols,
with TokenManager (45) and LogosAPI (123) unchanged. LogosBasecamp.exe then
links, and still defines 0 TokenManager::instance while importing it from
liblogos_core.dll.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* chore(deps): track protocol and plugin-qt master

logos-protocol#59 and logos-plugin-qt#19 merged, so both rev pins are retired and
their rationales rewritten to name the PRs that closed the gaps.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 17:56:37 -03:00

272 lines
15 KiB
Nix

{
description = "Logos liblogos core library";
inputs = {
logos-nix.url = "github:logos-co/logos-nix";
nixpkgs.follows = "logos-nix/nixpkgs";
logos-cpp-sdk.url = "github:logos-co/logos-cpp-sdk";
logos-cpp-sdk.inputs.logos-protocol.follows = "logos-protocol";
# Tracks master again. The rev pin here (c8bab12) existed only because
# logos-qt-host's logos_api.cpp calls TokenManager::forIdentity and
# ::isolateIdentity, and master's TokenManager had neither -- three hard
# compile errors, not a subtle ABI skew. logos-protocol#59 ("per-client token
# store, the host-services C ABI, and a container shape-check") MERGED and
# closed that gap: master carries forIdentity/isolateIdentity in
# cpp/token_manager.h and lp_grant_host_services/lp_token_keys in
# cpp/logos_protocol.h. Note #59 was SQUASH-merged, so the old rev is not an
# ancestor of master even though every line of it is in master -- check files,
# not `git merge-base --is-ancestor`.
#
# What has NOT changed is why every in-process consumer must agree on ONE
# logos-protocol: a single process holds liblogos_core plus the app image plus
# every UI plugin, and they share TokenManager. Two revs across that boundary
# give two TokenManager generations, hence two token stores, hence
# "ModuleProxy: rejecting unauthorized call ... auth token not recognized".
# That invariant is now maintained by the `follows` lines below rather than by
# a rev, so keep them.
logos-protocol.url = "github:logos-co/logos-protocol";
logos-qt-sdk.url = "github:logos-co/logos-qt-sdk";
logos-qt-sdk.inputs.logos-protocol.follows = "logos-protocol";
logos-qt-sdk.inputs.logos-cpp-sdk.follows = "logos-cpp-sdk";
# The Qt HOST RUNTIME this library links: LogosAPI (the object handed to
# initLogos), LogosAPIProvider, LogosProviderBase and the legacy
# PluginInterface. It used to be compiled into logos-qt-sdk; the CODE now
# lives in logos-plugin-qt, which owns the Qt plugin backend, and liblogos
# takes it from there instead of through logos-qt-sdk's forwarding shim.
#
# logos-qt-sdk stays an input regardless: it still owns the DEVELOPER layer
# this repo re-exports through nix/include.nix (logos_ui_plugin_context.h,
# logos_qt_lp_bridge.h, logos_qt_wire.h) plus the Qt code generator. That
# dependency is about headers, not about the host runtime.
#
# logos-protocol MUST follow. logos_qt_host and liblogos_core share
# TokenManager and the transport ABI in ONE process, so two protocol revs
# across that boundary is exactly the split-brain the Windows .def block in
# src/CMakeLists.txt exists to prevent. logos-nix/nixpkgs follow so the Qt
# the host runtime is compiled against is the Qt liblogos_core links.
#
# Tracks master again. This was pinned to cc24fa1c (a branch tip) for two
# reasons, and logos-plugin-qt#19 ("the Qt host runtime and cdylib-glue
# generator") MERGED as 9b2c64e retired both:
#
# * logos-qt-host did not exist on master at all. It does now -- master's
# flake.nix publishes it (9 references) out of nix/qt-host.nix.
#
# * master keyed `packages` off forAllSystems, so it had no x86_64-windows
# attribute, and this flake reaches for
# logos-plugin-qt.packages.x86_64-windows.logos-qt-host from
# forAllTargets -- an EVALUATION failure ("attribute 'x86_64-windows'
# missing"), not a link-time one. master now keys `packages` off
# forAllTargets, so that attribute resolves.
#
# The old note about matching whatever rev logos-qt-sdk pins is obsolete:
# logos-qt-sdk's master (c6be61d0) has no logos-plugin-qt input at all, so
# there is no second logos-qt-host to collide with. #19 was SQUASH-merged, so
# cc24fa1c is not an ancestor of master; the files are what settle it.
logos-plugin-qt.url = "github:logos-co/logos-plugin-qt";
logos-plugin-qt.inputs.logos-nix.follows = "logos-nix";
logos-plugin-qt.inputs.nixpkgs.follows = "nixpkgs";
logos-plugin-qt.inputs.logos-protocol.follows = "logos-protocol";
logos-capability-module.url = "github:logos-co/logos-capability-module";
logos-module.url = "github:logos-co/logos-module";
process-stats.url = "github:logos-co/process-stats";
logos-container.url = "github:logos-co/logos-container";
logos-module-loader.url = "github:logos-co/logos-module-loader";
# The built-in default container + format-loader implementations. Named for
# their ROLE rather than the backing repo, so `--override-input
# default-container <other>` reads clearly. They point at the subprocess /
# qt-plugin repos by default; swap the url (or override the input) to change
# the default implementation.
default-container.url = "github:logos-co/logos-container-subprocess";
default-module-loader.url = "github:logos-co/logos-module-loader-qt";
# The host transport (logos_host_qt) must be built against the SAME
# logos-protocol as liblogos_core; otherwise the QtRO capability-token
# handshake fails across the host<->plugin boundary. Pin it via follows so a
# protocol bump here rebuilds the bundled host instead of leaving it on a
# stale rev.
default-module-loader.inputs.logos-protocol.follows = "logos-protocol";
default-module-loader.inputs.logos-cpp-sdk.follows = "logos-cpp-sdk";
default-module-loader.inputs.logos-qt-sdk.follows = "logos-qt-sdk";
logos-package-manager.url = "github:logos-co/logos-package-manager";
};
outputs = { self, nixpkgs, logos-nix, logos-cpp-sdk, logos-protocol, logos-qt-sdk, logos-plugin-qt, logos-capability-module, logos-module, logos-package-manager, process-stats, logos-container, default-container, logos-module-loader, default-module-loader }:
let
systems = [ "aarch64-darwin" "x86_64-darwin" "aarch64-linux" "x86_64-linux" ];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f {
inherit system;
pkgs = import nixpkgs { inherit system; };
logosSdk = logos-cpp-sdk.packages.${system}.default;
logosProtocolPkg = logos-protocol.packages.${system}.default;
logosQtSdk = logos-qt-sdk.packages.${system}.default;
logosQtHost = logos-plugin-qt.packages.${system}.logos-qt-host;
capabilityModule = logos-capability-module.packages.${system}.default;
logosModule = logos-module.packages.${system}.default;
processStats = process-stats.packages.${system}.default;
logosContainer = logos-container.packages.${system}.default;
logosModuleLoader = logos-module-loader.packages.${system}.default;
defaultContainer = default-container.packages.${system}.default;
defaultModuleLoader = default-module-loader.packages.${system}.default;
logosPackageManager = logos-package-manager.packages.${system}.lib;
logosPackageManagerPortable = logos-package-manager.packages.${system}.lib-portable;
});
# Same as forAllSystems, plus the "x86_64-windows" pseudo-system. This
# cannot just be logos-nix.lib.forAllTargets, because that only supplies
# { system, pkgs } and this flake threads a dozen per-system dependencies
# through.
#
# Every dependency below is a TARGET-side artifact (headers, archives, or
# DLLs linked into logos_core, plus the host binary / plugin that are
# merely re-exported). liblogos runs NO code generator at build time
# (verified: no logos-cpp-generator / qt-generator anywhere in this repo),
# so nothing here needs to come from the build platform's package set.
#
# Applied to `packages` ONLY: `checks` would have to execute PE test
# binaries on the Linux builder, and a cross devShell offers no way to run
# what it produces.
windowsBuildSystem = "x86_64-linux";
forAllTargets = f:
nixpkgs.lib.genAttrs (systems ++ [ "x86_64-windows" ]) (system: f {
inherit system;
pkgs =
if system == "x86_64-windows"
then logos-nix.lib.mkWindowsPkgs { buildSystem = windowsBuildSystem; }
else import nixpkgs { inherit system; };
logosSdk = logos-cpp-sdk.packages.${system}.default;
logosProtocolPkg = logos-protocol.packages.${system}.default;
logosQtSdk = logos-qt-sdk.packages.${system}.default;
logosQtHost = logos-plugin-qt.packages.${system}.logos-qt-host;
capabilityModule = logos-capability-module.packages.${system}.default;
logosModule = logos-module.packages.${system}.default;
processStats = process-stats.packages.${system}.default;
logosContainer = logos-container.packages.${system}.default;
logosModuleLoader = logos-module-loader.packages.${system}.default;
defaultContainer = default-container.packages.${system}.default;
defaultModuleLoader = default-module-loader.packages.${system}.default;
logosPackageManager = logos-package-manager.packages.${system}.lib;
logosPackageManagerPortable = logos-package-manager.packages.${system}.lib-portable;
});
in
{
packages = forAllTargets ({ pkgs, system, logosSdk, logosProtocolPkg, logosQtSdk, logosQtHost, capabilityModule, logosModule, processStats, logosContainer, logosModuleLoader, defaultContainer, defaultModuleLoader, logosPackageManager, logosPackageManagerPortable }:
let
# The built-in default container + format-loader implementations — the
# single place the default is chosen. Each is just the package; it
# ships a generic CMake config (LogosContainerImpl / LogosFormatLoaderImpl)
# that carries its library and deps, which liblogos find_package's. Swap
# an entry to change the default — no C++, CMake, or nix-flag change.
containerImpl = defaultContainer;
formatLoaderImpl = defaultModuleLoader;
# Common configuration (dev, default)
common = import ./nix/default.nix {
inherit pkgs logosSdk logosProtocolPkg logosQtSdk logosQtHost logosModule processStats logosContainer logosModuleLoader logosPackageManager containerImpl formatLoaderImpl;
};
# Common configuration (portable)
commonPortable = import ./nix/default.nix {
inherit pkgs logosSdk logosProtocolPkg logosQtSdk logosQtHost logosModule processStats logosContainer logosModuleLoader containerImpl formatLoaderImpl;
logosPackageManager = logosPackageManagerPortable;
portableBuild = true;
};
src = ./.;
# Shared build that compiles everything (dev)
build = import ./nix/build.nix { inherit pkgs common src; };
# Shared build (portable)
buildPortable = import ./nix/build.nix { inherit pkgs src; common = commonPortable; };
# Individual package components (reference the shared build)
lib = import ./nix/lib.nix { inherit pkgs common build; };
modules = import ./nix/modules.nix { inherit pkgs common capabilityModule; };
modulesPortable = import ./nix/modules.nix { inherit pkgs capabilityModule; common = commonPortable; portableBuild = true; };
bin = import ./nix/bin.nix { inherit pkgs common build lib modules formatLoaderImpl; };
include = import ./nix/include.nix { inherit pkgs common src logosSdk; inherit logosProtocolPkg logosQtSdk logosQtHost; };
tests = import ./nix/tests.nix { inherit pkgs common build; };
# Portable package components
libPortable = import ./nix/lib.nix { inherit pkgs; common = commonPortable; build = buildPortable; };
binPortable = import ./nix/bin.nix { inherit pkgs formatLoaderImpl; common = commonPortable; build = buildPortable; lib = libPortable; modules = modulesPortable; };
includePortable = import ./nix/include.nix { inherit pkgs src logosSdk; inherit logosProtocolPkg logosQtSdk logosQtHost; common = commonPortable; };
# Combined package (dev)
liblogos = pkgs.symlinkJoin {
name = "logos-liblogos";
paths = [ bin lib include ];
};
# Combined package (portable)
liblogosPortable = pkgs.symlinkJoin {
name = "logos-liblogos-portable";
paths = [ binPortable libPortable includePortable ];
};
in
{
# Individual outputs
logos-liblogos-bin = bin;
logos-liblogos-lib = lib;
logos-liblogos-include = include;
logos-liblogos-modules = modules;
# Combined output
logos-liblogos = liblogos;
# Portable output (compiled with LOGOS_PORTABLE_BUILD)
portable = liblogosPortable;
# Default package (dev)
default = liblogos;
}
# The test suite is POSIX-only (posix_spawn/waitpid/kill, /bin/sh) and
# CMake gates it off for a Windows host, so `ninja logos_core_tests`
# would have no such target. Not exposing the output at all beats
# shipping one that cannot be built.
// pkgs.lib.optionalAttrs (!pkgs.stdenv.hostPlatform.isWindows) {
logos-liblogos-tests = tests;
}
);
checks = forAllSystems ({ pkgs, system, ... }:
let
testsPkg = self.packages.${system}.logos-liblogos-tests;
# Real Qt plugin used by RealPluginRegistryTest (TEST_PLUGIN env var).
# capability_module is already a flake input and builds a real plugin.
capabilityModulePkg = logos-capability-module.packages.${system}.default;
pluginExt = if pkgs.stdenv.isDarwin then "dylib" else "so";
in {
tests = pkgs.runCommand "logos-liblogos-tests" {
nativeBuildInputs = [ testsPkg ] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [ pkgs.qt6.qtbase ];
} ''
export QT_QPA_PLATFORM=offscreen
${pkgs.lib.optionalString pkgs.stdenv.isLinux ''
export QT_PLUGIN_PATH="${pkgs.qt6.qtbase}/${pkgs.qt6.qtbase.qtPluginPrefix}"
''}
export TEST_PLUGIN="${capabilityModulePkg}/lib/capability_module_plugin.${pluginExt}"
mkdir -p $out
echo "Running logos-liblogos tests..."
echo "TEST_PLUGIN=$TEST_PLUGIN"
${testsPkg}/bin/logos_core_tests --gtest_output=xml:$out/test-results.xml
'';
}
);
devShells = forAllSystems ({ pkgs, ... }: {
default = pkgs.mkShell {
nativeBuildInputs = [
pkgs.cmake
pkgs.ninja
pkgs.pkg-config
];
buildInputs = [
pkgs.qt6.qtbase
pkgs.qt6.qtremoteobjects
pkgs.zstd
pkgs.spdlog
];
};
});
};
}