Merge pull request #17 from logos-co/fix/improvements

fix: improvements
This commit is contained in:
Khushboo-dev-cpp
2026-03-26 12:06:05 +01:00
committed by GitHub
15 changed files with 1740 additions and 673 deletions
+2
View File
@@ -15,6 +15,8 @@ logos_module(
src/calc_ui_cpp_plugin.cpp
src/calc_backend.h
src/calc_backend.cpp
INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/interfaces
)
find_package(Qt6 REQUIRED COMPONENTS Widgets Quick QuickWidgets)
+706 -306
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -4,6 +4,7 @@
inputs = {
logos-module-builder.url = "github:logos-co/logos-module-builder";
logos-standalone-app.url = "github:logos-co/logos-standalone-app";
nix-bundle-lgx.url = "github:logos-co/nix-bundle-lgx";
calc_module.url = "github:logos-co/logos-tutorial?dir=logos-calc-module";
};
+17
View File
@@ -0,0 +1,17 @@
#pragma once
#include <QObject>
#include <QWidget>
#include <QtPlugin>
class LogosAPI;
class IComponent {
public:
virtual ~IComponent() = default;
virtual QWidget* createWidget(LogosAPI* logosAPI = nullptr) = 0;
virtual void destroyWidget(QWidget* widget) = 0;
};
#define IComponent_iid "com.logos.component.IComponent"
Q_DECLARE_INTERFACE(IComponent, IComponent_iid)
+1 -1
View File
@@ -17,7 +17,7 @@
"cmake": {
"find_packages": [],
"extra_sources": [],
"extra_include_dirs": [],
"extra_include_dirs": ["interfaces"],
"extra_link_libraries": []
}
}
@@ -0,0 +1,17 @@
#ifndef CALC_UI_CPP_INTERFACE_H
#define CALC_UI_CPP_INTERFACE_H
#include <QObject>
#include <QString>
#include "interface.h"
class CalcUiCppInterface : public PluginInterface
{
public:
virtual ~CalcUiCppInterface() = default;
};
#define CalcUiCppInterface_iid "org.logos.CalcUiCppInterface"
Q_DECLARE_INTERFACE(CalcUiCppInterface, CalcUiCppInterface_iid)
#endif // CALC_UI_CPP_INTERFACE_H
+4 -5
View File
@@ -4,15 +4,14 @@
#include <QObject>
#include <QWidget>
#include <QVariantList>
#include <IComponent.h>
#include "calc_ui_cpp_interface.h"
class LogosAPI;
class CalcUiCppPlugin : public QObject, public CalcUiCppInterface
class CalcUiCppPlugin : public QObject, public CalcUiCppInterface, public IComponent
{
Q_OBJECT
Q_PLUGIN_METADATA(IID CalcUiCppInterface_iid FILE "metadata.json")
Q_INTERFACES(CalcUiCppInterface PluginInterface)
Q_PLUGIN_METADATA(IID IComponent_iid FILE "metadata.json")
Q_INTERFACES(CalcUiCppInterface PluginInterface IComponent)
public:
explicit CalcUiCppPlugin(QObject* parent = nullptr);
+180 -4
View File
@@ -60,11 +60,11 @@
]
},
"locked": {
"lastModified": 1774468631,
"narHash": "sha256-pwv7KVUbGMidRQ2Omt7mTORJDtaAxynD9bvC5zRpJaQ=",
"lastModified": 1774521784,
"narHash": "sha256-/rmNYffGTK+FTwJUr8dz7vsJz0Tq/sZH3mQ5yt1LCZA=",
"owner": "logos-co",
"repo": "logos-module-builder",
"rev": "1b8929cd8b57abe4a7e5450d7ac4877942b49b50",
"rev": "c55dfaaade0f1d0d971946f7d24733134c56d5a4",
"type": "github"
},
"original": {
@@ -127,6 +127,133 @@
"type": "github"
}
},
"logos-nix_4": {
"inputs": {
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1773955630,
"narHash": "sha256-KqzMoWYIVp2xMgphs7v02T/BE54RKMFxpdC2duhJKG0=",
"owner": "logos-co",
"repo": "logos-nix",
"rev": "0e9e6d66ab8eb34f59e45ed448f7dc29130feb88",
"type": "github"
},
"original": {
"owner": "logos-co",
"repo": "logos-nix",
"type": "github"
}
},
"logos-nix_5": {
"inputs": {
"nixpkgs": "nixpkgs_5"
},
"locked": {
"lastModified": 1773955630,
"narHash": "sha256-KqzMoWYIVp2xMgphs7v02T/BE54RKMFxpdC2duhJKG0=",
"owner": "logos-co",
"repo": "logos-nix",
"rev": "0e9e6d66ab8eb34f59e45ed448f7dc29130feb88",
"type": "github"
},
"original": {
"owner": "logos-co",
"repo": "logos-nix",
"type": "github"
}
},
"logos-nix_6": {
"inputs": {
"nixpkgs": "nixpkgs_6"
},
"locked": {
"lastModified": 1773955630,
"narHash": "sha256-KqzMoWYIVp2xMgphs7v02T/BE54RKMFxpdC2duhJKG0=",
"owner": "logos-co",
"repo": "logos-nix",
"rev": "0e9e6d66ab8eb34f59e45ed448f7dc29130feb88",
"type": "github"
},
"original": {
"owner": "logos-co",
"repo": "logos-nix",
"type": "github"
}
},
"logos-package": {
"inputs": {
"logos-nix": "logos-nix_5",
"nixpkgs": [
"nix-bundle-lgx",
"logos-package",
"logos-nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1773965173,
"narHash": "sha256-toDnGXUthRcQm7vcEYzb2bLI7FE1tbfzH8Ie2Cnb9mk=",
"owner": "logos-co",
"repo": "logos-package",
"rev": "9e3730d5c0e3ec955761c05b50e3a6047ee4030b",
"type": "github"
},
"original": {
"owner": "logos-co",
"repo": "logos-package",
"type": "github"
}
},
"nix-bundle-dir": {
"inputs": {
"logos-nix": "logos-nix_6",
"nixpkgs": [
"nix-bundle-lgx",
"nix-bundle-dir",
"logos-nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1773961179,
"narHash": "sha256-bpaTvz//R8WFP5xnnDLv3a9l7unDmBwJjCewx3wCjzM=",
"owner": "logos-co",
"repo": "nix-bundle-dir",
"rev": "cd214dbf15487d80967389847ae2210468be6ebf",
"type": "github"
},
"original": {
"owner": "logos-co",
"repo": "nix-bundle-dir",
"type": "github"
}
},
"nix-bundle-lgx": {
"inputs": {
"logos-nix": "logos-nix_4",
"logos-package": "logos-package",
"nix-bundle-dir": "nix-bundle-dir",
"nixpkgs": [
"nix-bundle-lgx",
"logos-nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1774455541,
"narHash": "sha256-ku5gG6qKIZeWzJ/jNOxfsx1rwJ3kPrCw8/wnBKq1Uyw=",
"owner": "logos-co",
"repo": "nix-bundle-lgx",
"rev": "9d6f9016c865b9d2793672bc3c45a50b59753c78",
"type": "github"
},
"original": {
"owner": "logos-co",
"repo": "nix-bundle-lgx",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1759036355,
@@ -175,9 +302,58 @@
"type": "github"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1759036355,
"narHash": "sha256-0m27AKv6ka+q270dw48KflE0LwQYrO7Fm4/2//KCVWg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e9f00bd893984bc8ce46c895c3bf7cac95331127",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_5": {
"locked": {
"lastModified": 1759036355,
"narHash": "sha256-0m27AKv6ka+q270dw48KflE0LwQYrO7Fm4/2//KCVWg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e9f00bd893984bc8ce46c895c3bf7cac95331127",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_6": {
"locked": {
"lastModified": 1759036355,
"narHash": "sha256-0m27AKv6ka+q270dw48KflE0LwQYrO7Fm4/2//KCVWg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e9f00bd893984bc8ce46c895c3bf7cac95331127",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"logos-module-builder": "logos-module-builder"
"logos-module-builder": "logos-module-builder",
"nix-bundle-lgx": "nix-bundle-lgx"
}
}
},
+1
View File
@@ -3,6 +3,7 @@
inputs = {
logos-module-builder.url = "github:logos-co/logos-module-builder";
nix-bundle-lgx.url = "github:logos-co/nix-bundle-lgx";
};
outputs = inputs@{ logos-module-builder, ... }:
+706 -306
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -4,6 +4,7 @@
inputs = {
logos-module-builder.url = "github:logos-co/logos-module-builder";
logos-standalone-app.url = "github:logos-co/logos-standalone-app";
nix-bundle-lgx.url = "github:logos-co/nix-bundle-lgx";
calc_module.url = "github:logos-co/logos-tutorial?dir=logos-calc-module";
};
+63 -14
View File
@@ -18,7 +18,9 @@ A comprehensive guide to creating, building, testing, packaging, and distributin
- [2.2 The logos-module-viewer](#22-the-logos-module-viewer)
- [Part 3: Packaging Your Module](#part-3-packaging-your-module)
- [3.1 The LGX Package Format](#31-the-lgx-package-format)
- [3.2 Bundling with nix-bundle-lgx](#32-bundling-with-nix-bundle-lgx)
- [3.2 Building LGX Packages](#32-building-lgx-packages)
- [Built-in Nix Derivation (Preferred)](#built-in-nix-derivation-preferred)
- [Using nix bundle (Alternative)](#using-nix-bundle-alternative)
- [Part 4: Installing and Managing Modules](#part-4-installing-and-managing-modules)
- [4.1 The lgpm CLI](#41-the-lgpm-cli)
- [4.2 Installing from Local Files](#42-installing-from-local-files)
@@ -379,8 +381,7 @@ cmake --build build
```
result/
├── lib/
── my_module_plugin.so # (or .dylib on macOS)
│ └── metadata.json # Runtime metadata
── my_module_plugin.so # (or .dylib on macOS)
└── include/
├── my_module_api.h # Generated type-safe wrapper header
└── my_module_api.cpp # Generated wrapper implementation
@@ -498,15 +499,54 @@ mymodule.lgx (tar.gz)
The **manifest.json** is auto-generated from your module's `metadata.json` by the bundler. It maps each variant to its main entry point.
### 3.2 Bundling with nix-bundle-lgx
### 3.2 Building LGX Packages
The recommended way to create `.lgx` packages is using **nix-bundle-lgx**, which automatically bundles your `nix build` output into an `.lgx` file with the correct manifest and variant structure.
There are two ways to create `.lgx` packages. The preferred approach uses the built-in Nix derivation that comes with `logos-module-builder`. Alternatively, you can use the `nix bundle` command directly.
#### Built-in Nix Derivation (Preferred)
When your module's `flake.nix` includes `nix-bundle-lgx` as an input (which all `logos-module-builder` templates do by default), LGX package outputs are automatically available as part of your flake:
```bash
# Dev variant (uses /nix/store references, for local development)
nix bundle --bundler github:logos-co/nix-bundle-lgx .#lib
nix build .#lgx
# Portable variant (self-contained, all dependencies bundled)
nix build .#lgx-portable
# Dual variant (both dev and portable in one .lgx file)
nix build .#lgx-dual
```
This produces a `my_module-<version>.lgx` file in the `result/` directory.
This works because `logos-module-builder.lib.mkLogosModule` detects the `nix-bundle-lgx` input in your `flakeInputs` and automatically creates the `lgx`, `lgx-portable`, and `lgx-dual` package outputs. No extra configuration is needed — it is part of the standard module template:
```nix
{
inputs = {
logos-module-builder.url = "github:logos-co/logos-module-builder";
nix-bundle-lgx.url = "github:logos-co/nix-bundle-lgx";
};
outputs = inputs@{ logos-module-builder, ... }:
logos-module-builder.lib.mkLogosModule {
src = ./.;
configFile = ./metadata.json;
flakeInputs = inputs;
};
}
```
#### Using `nix bundle` (Alternative)
You can also create `.lgx` packages using the `nix bundle` command directly. This is useful if your module does not use `logos-module-builder` or if you need the `dual` bundling mode (both dev and portable in a single `.lgx` file):
```bash
# Dev variant
nix bundle --bundler github:logos-co/nix-bundle-lgx .#lib
# Portable variant
nix bundle --bundler github:logos-co/nix-bundle-lgx#portable .#lib
# Dual variant (both dev and portable in one .lgx file)
@@ -517,11 +557,11 @@ This produces a `my_module-<version>.lgx` file in the current directory.
**Bundling modes:**
| Mode | Command | Variant Created | Use Case |
|------|---------|----------------|----------|
| **Dev** | `nix bundle --bundler ...#default .#lib` | `darwin-arm64-dev` | Local development (requires Nix store) |
| **Portable** | `nix bundle --bundler ...#portable .#lib` | `darwin-arm64` | Distribution (self-contained, no Nix needed) |
| **Dual** | `nix bundle --bundler ...#dual .#lib` | Both dev and portable | One package for both environments |
| Mode | Built-in Command | `nix bundle` Command | Variant Created | Use Case |
|------|-----------------|---------------------|----------------|----------|
| **Dev** | `nix build .#lgx` | `nix bundle --bundler ...#default .#lib` | `darwin-arm64-dev` | Local development (requires Nix store) |
| **Portable** | `nix build .#lgx-portable` | `nix bundle --bundler ...#portable .#lib` | `darwin-arm64` | Distribution (self-contained, no Nix needed) |
| **Dual** | `nix build .#lgx-dual` | `nix bundle --bundler ...#dual .#lib` | Both dev and portable | One package for both environments |
**Variant naming:**
@@ -1044,6 +1084,12 @@ logos-cpp-generator --metadata <metadata.json> --general-only [--output-dir <dir
### `nix-bundle-lgx` -- LGX Bundler
```bash
# Preferred: built-in derivation (when using logos-module-builder with nix-bundle-lgx input)
nix build .#lgx # Dev variant
nix build .#lgx-portable # Portable variant
nix build .#lgx-dual # Both variants
# Alternative: nix bundle command
nix bundle --bundler github:logos-co/nix-bundle-lgx .#lib # Dev variant
nix bundle --bundler github:logos-co/nix-bundle-lgx#portable .#lib # Portable variant
nix bundle --bundler github:logos-co/nix-bundle-lgx#dual .#lib # Both variants
@@ -1131,14 +1177,17 @@ If a module installs but fails to load, the variant type may not match:
- **Dev build** of logos-basecamp needs **dev** LGX variants (`darwin-arm64-dev`)
- **Portable build** needs **portable** variants (`darwin-arm64`)
- Use `nix bundle --bundler github:logos-co/nix-bundle-lgx#dual .#lib` to produce packages with both variants
- Use `nix build .#lgx` and `nix build .#lgx-portable` to produce each variant separately, `nix build .#lgx-dual` for a single package with both, or `nix bundle --bundler github:logos-co/nix-bundle-lgx#dual .#lib` via the standalone bundler
### Cross-platform builds
Build on each target platform separately, then use `nix-bundle-lgx` to create `.lgx` packages:
Build on each target platform separately to create `.lgx` packages:
```bash
# On each platform, bundle produces the correct variant automatically:
# On each platform, the built-in derivation produces the correct variant automatically:
nix build .#lgx-portable
# Or using nix bundle for dual variant:
nix bundle --bundler github:logos-co/nix-bundle-lgx#dual .#lib
# Then merge platform-specific .lgx files into one:
+13 -13
View File
@@ -596,6 +596,7 @@ Pass `logosStandalone` to `mkLogosModule` and you get `apps.default` (i.e. `nix
inputs = {
logos-module-builder.url = "github:logos-co/logos-module-builder";
logos-standalone-app.url = "github:logos-co/logos-standalone-app";
nix-bundle-lgx.url = "github:logos-co/nix-bundle-lgx";
calc_module.url = "github:logos-co/logos-tutorial?dir=logos-calc-module";
};
@@ -643,20 +644,17 @@ The widget opens. No backend connected yet, so button clicks will silently retur
### 10.3 Full functionality (with modules)
The `capability_module` is loaded automatically by the standalone app. You only need to install `calc_module`:
```bash
nix build 'github:logos-co/logos-package-manager-module#cli' --out-link ./pm
mkdir -p modules
# Install capability_module
nix bundle --bundler 'github:logos-co/nix-bundle-lgx' \
'github:logos-co/logos-capability-module' -o lgx-capability
./pm/bin/lgpm --modules-dir ./modules install --file lgx-capability/*.lgx
# Bundle and install calc_module (from Part 1)
cd ../logos-calc-module
nix bundle --bundler 'github:logos-co/nix-bundle-lgx' '.#lib' -o lgx-result
nix build '.#lgx'
cd ../logos-calc-ui-cpp
./pm/bin/lgpm --modules-dir ./modules install --file ../logos-calc-module/lgx-result/*.lgx
./pm/bin/lgpm --modules-dir ./modules install --file ../logos-calc-module/result/*.lgx
nix run . --override-input calc_module path:../logos-calc-module -- --modules-dir ./modules
```
@@ -670,13 +668,15 @@ nix run . --override-input calc_module path:../logos-calc-module -- --modules-di
```bash
# Package calc_module (from Part 1)
cd ../logos-calc-module
nix bundle --bundler 'github:logos-co/nix-bundle-lgx#dual' '.#lib' -o lgx-calc-module
nix build '.#lgx-dual'
# Package the C++ UI plugin
cd ../logos-calc-ui-cpp
nix bundle --bundler 'github:logos-co/nix-bundle-lgx#dual' '.' -o lgx-calc-ui-cpp
nix build '.#lgx-dual'
```
> For more bundling options (standalone bundler syntax, cross-platform packaging), see the [Developer Guide — Bundling with nix-bundle-lgx](logos-developer-guide.md#32-bundling-with-nix-bundle-lgx).
### 11.2 Build and run logos-basecamp
Build logos-basecamp, launch it once to preinstall its bundled modules, then install your modules.
@@ -711,11 +711,11 @@ nix build 'github:logos-co/logos-package-manager-module#cli' --out-link ./pm
# Install core module
./pm/bin/lgpm --modules-dir BASECAMP_DIR/modules \
install --file ../logos-calc-module/lgx-calc-module/*.lgx
install --file ../logos-calc-module/result/*.lgx
# Install UI plugin
./pm/bin/lgpm --modules-dir BASECAMP_DIR/plugins \
install --file lgx-calc-ui-cpp/*.lgx
install --file result/*.lgx
# Launch basecamp -- your modules appear alongside the built-in ones
./basecamp-result/bin/logos-basecamp
@@ -728,8 +728,8 @@ Instead of using `lgpm` on the command line, you can install modules through the
1. Launch `logos-basecamp`
2. Go to **Package Manager**
3. Click **Install from file**
4. Select `lgx-calc-module/*.lgx` — installs `calc_module`
5. Repeat for `lgx-calc-ui-cpp/*.lgx` — installs `calc_ui_cpp`
4. Select `../logos-calc-module/result/*.lgx` — installs `calc_module`
5. Repeat for `result/*.lgx` — installs `calc_ui_cpp`
The "Calculator" tab appears in the sidebar.
+13 -15
View File
@@ -233,6 +233,7 @@ The template already has everything wired up. Update the description and add `ca
inputs = {
logos-module-builder.url = "github:logos-co/logos-module-builder";
logos-standalone-app.url = "github:logos-co/logos-standalone-app";
nix-bundle-lgx.url = "github:logos-co/nix-bundle-lgx";
calc_module.url = "github:logos-co/logos-tutorial?dir=logos-calc-module"; # must match dependency name in metadata.json
};
@@ -263,22 +264,17 @@ The app opens immediately. No modules are loaded, so clicking buttons shows "Log
### 5.2 Full functionality (with modules)
To test actual calls to `calc_module`, you need a modules directory with `capability_module` (required by all UI plugins) and `calc_module` installed via `lgpm`. Do this once:
To test actual calls to `calc_module`, you need a modules directory with `calc_module` installed via `lgpm`. The `capability_module` is loaded automatically by the standalone app. Do this once:
```bash
nix build 'github:logos-co/logos-package-manager-module#cli' --out-link ./pm
mkdir -p modules
# Install capability_module (required by all UI plugins)
nix bundle --bundler 'github:logos-co/nix-bundle-lgx' \
'github:logos-co/logos-capability-module' -o lgx-capability
./pm/bin/lgpm --modules-dir ./modules install --file lgx-capability/*.lgx
# Bundle and install calc_module (from Part 1)
cd ../logos-calc-module
nix bundle --bundler 'github:logos-co/nix-bundle-lgx' '.#lib' -o lgx-result
nix build '.#lgx'
cd ../logos-calc-ui
./pm/bin/lgpm --modules-dir ./modules install --file ../logos-calc-module/lgx-result/*.lgx
./pm/bin/lgpm --modules-dir ./modules install --file ../logos-calc-module/result/*.lgx
```
Then run with the modules directory:
@@ -336,18 +332,20 @@ Available theme tokens via `Theme.palette`:
### 7.1 Bundle as LGX packages
Create `.lgx` packages using the `#dual` bundler (includes both dev and portable variants, so they work with any basecamp build):
Create `.lgx` packages using the dual variant (includes both dev and portable variants, so they work with any basecamp build):
```bash
# Package calc_module (from Part 1)
cd ../logos-calc-module
nix bundle --bundler 'github:logos-co/nix-bundle-lgx#dual' '.#lib' -o lgx-calc-module
nix build '.#lgx-dual'
# Package the QML UI plugin
cd ../logos-calc-ui
nix bundle --bundler 'github:logos-co/nix-bundle-lgx#dual' '.#lib' -o lgx-calc-ui
nix build '.#lgx-dual'
```
> For more bundling options (standalone bundler syntax, cross-platform packaging), see the [Developer Guide — Bundling with nix-bundle-lgx](logos-developer-guide.md#32-bundling-with-nix-bundle-lgx).
### 7.2 Build and run logos-basecamp
Build logos-basecamp, launch it once to preinstall its bundled modules, then install your modules.
@@ -382,11 +380,11 @@ nix build 'github:logos-co/logos-package-manager-module#cli' --out-link ./pm
# Install core module
./pm/bin/lgpm --modules-dir BASECAMP_DIR/modules \
install --file ../logos-calc-module/lgx-calc-module/*.lgx
install --file ../logos-calc-module/result/*.lgx
# Install UI plugin
./pm/bin/lgpm --modules-dir BASECAMP_DIR/plugins \
install --file lgx-calc-ui/*.lgx
install --file result/*.lgx
# Launch basecamp -- your modules appear alongside the built-in ones
./basecamp-result/bin/logos-basecamp
@@ -399,8 +397,8 @@ Instead of using `lgpm` on the command line, you can install modules through the
1. Launch `logos-basecamp`
2. Go to **Package Manager**
3. Click **Install from file**
4. Select `lgx-calc-module/*.lgx` -- installs `calc_module`
5. Repeat for `lgx-calc-ui/*.lgx` -- installs `calc_ui`
4. Select `../logos-calc-module/result/*.lgx` -- installs `calc_module`
5. Repeat for `result/*.lgx` -- installs `calc_ui`
The "Calculator UI" tab appears in the sidebar. Clicking it loads your `Main.qml`.
+15 -9
View File
@@ -282,6 +282,7 @@ The `if/elseif/else` block above it is boilerplate — don't change it.
inputs = {
logos-module-builder.url = "github:logos-co/logos-module-builder";
nix-bundle-lgx.url = "github:logos-co/nix-bundle-lgx";
};
outputs = inputs@{ logos-module-builder, ... }:
@@ -505,15 +506,13 @@ You should see two files (extensions depend on your platform):
# Linux
calc_module_plugin.so # Your Logos module plugin
libcalc.so # The C library (copied alongside)
metadata.json # Runtime metadata
# macOS
calc_module_plugin.dylib
libcalc.dylib
metadata.json
```
Both library files are placed together so the plugin can find the C library at runtime via RPATH. The `metadata.json` is copied alongside for runtime discovery by `logoscore` and `logos-basecamp`.
Both library files are placed together so the plugin can find the C library at runtime via RPATH.
---
@@ -637,16 +636,16 @@ nix build 'github:logos-co/logos-logoscore-cli' --out-link ./logos
### 5.2 Set up the modules directory
`logoscore` expects modules in subdirectories, each with a `manifest.json`. Rather than copying files and writing the manifest manually, use the Nix bundler to create an LGX package and install it with the package manager:
`logoscore` expects modules in subdirectories, each with a `manifest.json`. Rather than copying files and writing the manifest manually, use the Nix derivation to create an LGX package and install it with the package manager:
```bash
# Bundle the module into an LGX package
nix bundle --bundler 'github:logos-co/nix-bundle-lgx' '.#lib' -o lgx-result
nix build '.#lgx'
# Install it into a modules directory using the Logos Package Manager
nix build 'github:logos-co/logos-package-manager-module#cli' --out-link ./pm
mkdir -p modules
./pm/bin/lgpm --modules-dir ./modules install --file lgx-result/*.lgx
./pm/bin/lgpm --modules-dir ./modules install --file result/*.lgx
```
This extracts the plugin, external libraries, and manifest into the correct directory structure:
@@ -655,7 +654,6 @@ This extracts the plugin, external libraries, and manifest into the correct dire
modules/calc_module/
├── calc_module_plugin.dylib # (or .so on Linux)
├── libcalc.dylib # (or .so on Linux)
├── metadata.json # Embedded in binary, also on disk
├── manifest.json # Auto-generated by lgx
└── variant # Platform variant identifier
```
@@ -711,14 +709,22 @@ Method call successful. Result: ...
## Step 6: Package for Distribution (Optional)
The LGX package created in Step 5.2 is a **local** package — its libraries still reference `/nix/store` paths, so it only works on the machine that built it. To create a **portable** package that can be distributed to other machines, use the `#portable` bundler:
The LGX package created in Step 5.2 is a **local** package — its libraries still reference `/nix/store` paths, so it only works on the machine that built it. To create a **portable** package that can be distributed to other machines:
```bash
nix bundle --bundler 'github:logos-co/nix-bundle-lgx#portable' '.#lib'
nix build '.#lgx-portable'
```
Portable LGX packages are fully self-contained with no `/nix/store` references at runtime. These are the packages used by the Logos App Package Manager UI and published to [logos-modules](https://github.com/logos-co/logos-modules) releases.
To create a **dual** package containing both dev and portable variants (works with any basecamp build):
```bash
nix build '.#lgx-dual'
```
> For more bundling options (standalone bundler syntax, cross-platform packaging), see the [Developer Guide — Bundling with nix-bundle-lgx](logos-developer-guide.md#32-bundling-with-nix-bundle-lgx).
To install a portable package on another machine:
```bash