logos-tutorial
Tutorial series and reference documentation for building Logos modules.
Start Here
New to Logos? Start with the developer guide -- it walks through creating, building, packaging, and running your first module:
Next Tutorials
Step-by-step tutorials that build on each other. Each creates a working module you can run.
-
Part 1: Wrapping a C Library -- build
calc_module, a core module that wraps a C library (libcalc). Covers external library configuration, CMake integration, building, inspecting withlm, testing withlogoscore, and packaging withnix-bundle-lgx. -
Part 2: Building a QML UI App -- build
calc_ui, a QML-onlyui_qmlmodule that callscalc_modulethrough thelogos.callModule()bridge. No compilation needed. Scaffold:nix flake init -t ...#ui-qml -
Part 3: Building a C++ UI Module (Process-Isolated) — build
calc_ui_cpp, aui_qmlmodule with a C++ backend that runs in a separateui-hostprocess. Define the remote interface in a.repfile; the C++ backend inherits from the generatedSimpleSource; QML accesses it via a typed replica usinglogos.module()andQtRemoteObjects.watch(). Scaffold:nix flake init -t ...#ui-qml-backend
Example Modules
Working module source code used by the tutorials:
| Directory | Module | Type | Tutorial |
|---|---|---|---|
logos-calc-module/ |
calc_module |
core (wraps libcalc) |
Part 1 |
logos-calc-ui/ |
calc_ui |
ui_qml (QML-only) |
Part 2 |
logos-calc-ui-cpp/ |
calc_ui_cpp |
ui_qml (C++ backend + QML view) |
Part 3 |
Running Tutorial Tests
The tests/ directory contains automated tutorial verification tests. Each test replays a tutorial from scratch — scaffolding, writing files, building, inspecting, and optionally verifying in Logos Basecamp.
Prerequisites
- Nix with flakes enabled
yq(YAML processor) andnodejs— provided vianix-shell -p yq-go nodejs- For basecamp UI tests: a built
LogosBasecampbinary andlogos-qt-mcppackage
Quick Start
# Run a single tutorial test (scaffold + files + build + inspect phases)
nix-shell -p yq-go nodejs --run "./tests/run-tutorial-test.sh tests/tutorial-wrapping-c-library.test.yaml"
# Run with a specific working directory (must exist)
mkdir -p /tmp/tutorial-test
nix-shell -p yq-go nodejs --run "./tests/run-tutorial-test.sh tests/tutorial-wrapping-c-library.test.yaml --workdir /tmp/tutorial-test"
# Run specific phases only
nix-shell -p yq-go nodejs --run "./tests/run-tutorial-test.sh tests/tutorial-qml-ui-app.test.yaml --phase scaffold,files,build"
# Verbose output
nix-shell -p yq-go nodejs --run "./tests/run-tutorial-test.sh tests/tutorial-wrapping-c-library.test.yaml --verbose"
Running with Basecamp UI Verification
To test that a tutorial's module works in Logos Basecamp, provide the basecamp binary and qt-mcp framework:
# First, build basecamp and qt-mcp from the logos-basecamp repo
cd /path/to/logos-basecamp
nix build -o result-basecamp
nix build '.#logos-qt-mcp' -o result-mcp
# Then run the tutorial test with basecamp phase
cd /path/to/logos-tutorial
mkdir -p /tmp/tutorial-test
nix-shell -p yq-go nodejs --run "./tests/run-tutorial-test.sh tests/tutorial-wrapping-c-library.test.yaml \
--workdir /tmp/tutorial-test \
--basecamp-bin /path/to/logos-basecamp/result-basecamp/bin/LogosBasecamp \
--qt-mcp /path/to/logos-basecamp/result-mcp \
--verbose"
Available Test Specs
| Test File | Tutorial | Phases |
|---|---|---|
tests/tutorial-wrapping-c-library.test.yaml |
Part 1: Wrapping a C Library | scaffold, files, build, inspect, logoscore, basecamp |
tests/tutorial-qml-ui-app.test.yaml |
Part 2: QML UI App | scaffold, files, build, inspect, basecamp |
tests/tutorial-cpp-ui-app.test.yaml |
Part 3: C++ UI Module | scaffold, files, build, inspect, basecamp |
Options
| Flag | Description |
|---|---|
--workdir <path> |
Working directory (must exist; default: creates temp dir) |
--phase <phases> |
Comma-separated phases to run (default: all) |
--basecamp-bin <path> |
Path to LogosBasecamp binary |
--qt-mcp <path> |
Path to logos-qt-mcp package |
--verbose |
Show detailed output |
Notes
- The
logoscorephase requires thelogoscoreCLI to be on PATH (provided by the workspacescripts/directory) - The basecamp phase runs in offscreen mode (
QT_QPA_PLATFORM=offscreen) — no display required - Tests use a temporary directory by default; pass
--workdirto preserve build artifacts for debugging - UI tutorial tests (
tutorial-qml-ui-app,tutorial-cpp-ui-app) automatically install their core module dependencies before launching basecamp