mirror of
https://github.com/logos-co/logos-module-builder.git
synced 2026-08-30 19:51:07 +00:00
Remove module.yaml and use metadata.json exclusively for both runtime and Nix build configuration. The nix block in metadata.json replaces module.yaml for build-time settings. Updates all docs, skills, templates, lib/*.nix files, and the waku-module-migrated example.
41 lines
1.7 KiB
Nix
41 lines
1.7 KiB
Nix
# Parse metadata.json as the single source of truth for a module.
|
|
# Runtime fields (name, type, dependencies, icon, main…) live at the top level
|
|
# and are read by Qt, logos-standalone-app, the nix bundler and the Nix build system.
|
|
# Nix/build-only fields live under the "nix" key and are ignored at runtime.
|
|
{ lib }:
|
|
|
|
{
|
|
parseModuleConfig = jsonContent:
|
|
let
|
|
raw = builtins.fromJSON jsonContent;
|
|
nix = raw.nix or {};
|
|
safeList = val: if builtins.isList val then val else [];
|
|
in {
|
|
# Runtime fields
|
|
name = raw.name or (throw "metadata.json must specify 'name'");
|
|
version = raw.version or "1.0.0";
|
|
type = raw.type or "core";
|
|
category = raw.category or "general";
|
|
description = raw.description or "A Logos module";
|
|
main = raw.main or null;
|
|
icon = raw.icon or null;
|
|
dependencies = safeList (raw.dependencies or []);
|
|
include = safeList (raw.include or []);
|
|
|
|
# Nix/build-only fields (nested under "nix" in metadata.json)
|
|
nix_packages = {
|
|
build = safeList ((nix.packages or {}).build or []);
|
|
runtime = safeList ((nix.packages or {}).runtime or []);
|
|
};
|
|
external_libraries = safeList (nix.external_libraries or []);
|
|
cmake = {
|
|
find_packages = safeList ((nix.cmake or {}).find_packages or []);
|
|
extra_sources = safeList ((nix.cmake or {}).extra_sources or []);
|
|
extra_include_dirs = safeList ((nix.cmake or {}).extra_include_dirs or []);
|
|
extra_link_libraries = safeList ((nix.cmake or {}).extra_link_libraries or []);
|
|
};
|
|
|
|
_raw = raw;
|
|
};
|
|
}
|