mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-07-25 00:03:11 +00:00
build(amm): link amm_client_ffi into the AMM UI module
This commit is contained in:
parent
f3a14f051a
commit
cfb62e4d2f
@ -26,4 +26,6 @@ logos_module(
|
||||
LINK_LIBRARIES
|
||||
Qt6::Gui
|
||||
Qt6::Network
|
||||
EXTERNAL_LIBS
|
||||
amm_client_ffi
|
||||
)
|
||||
|
||||
@ -20,7 +20,7 @@ honors), and its config (`wallet_config.json`) self-initializes.
|
||||
|
||||
Account/keystore sharing follows the runtime:
|
||||
|
||||
- **Standalone** (`nix run .`): own core-module instance, but the canonical
|
||||
- **Standalone** (`nix run .#amm-ui`): own core-module instance, but the canonical
|
||||
`~/.lee/wallet` keystore is shared with the LEZ wallet UI and any other LEZ
|
||||
app on the machine. A previously-created wallet auto-opens on launch.
|
||||
- **Inside Basecamp**: the core wallet module is a single shared instance, so on
|
||||
@ -50,14 +50,20 @@ This makes `lgpm` available as a global command.
|
||||
|
||||
## Running the UI standalone
|
||||
|
||||
Start the UI with:
|
||||
The app is built from the **repository-root** flake (which also provides the
|
||||
`amm_client_ffi` library it links). From the repo root, launch it with its named
|
||||
attribute:
|
||||
|
||||
```bash
|
||||
nix run .
|
||||
nix run .#amm-ui
|
||||
```
|
||||
|
||||
This builds and runs the application in development mode. The Logos bridge is unavailable in standalone mode, but the UI layout and mock data are fully functional.
|
||||
|
||||
Build just the FFI crate with `nix build .#amm_client_ffi`. (Each UI is exposed
|
||||
under its own name, so future apps are `nix run .#<name>` — there is no bare
|
||||
`nix run .` default.)
|
||||
|
||||
## Running inside Logos Basecamp
|
||||
|
||||
This app is a UI plugin that depends on the **core wallet module**
|
||||
|
||||
@ -11,6 +11,15 @@
|
||||
logos_execution_zone.url = "github:logos-blockchain/logos-execution-zone-module?rev=d2e9400ac06c3cdbfc2405b4f153fff9841a453c";
|
||||
};
|
||||
|
||||
# NOTE: this flake is no longer built standalone. The amm_client_ffi crate
|
||||
# (the Rust C FFI library the AmmUiBackend C++ code links against) lives in
|
||||
# the repo-root flake, and referencing it from here would require either a
|
||||
# hardcoded absolute `git+file://` path or a `path:../..` input — the latter
|
||||
# fails flake evaluation because the app directory is copied into the Nix
|
||||
# store as its own flake root, so `../..` can't escape it there. Instead,
|
||||
# the repo-root flake.nix builds this module directly (src = ./apps/amm)
|
||||
# and resolves amm_client_ffi via `self`. Build/run the app from the repo
|
||||
# root, e.g. `nix build .#packages.<system>.default` or `nix run .`.
|
||||
outputs = inputs@{ logos-module-builder, ... }:
|
||||
logos-module-builder.lib.mkLogosQmlModule {
|
||||
src = ./.;
|
||||
|
||||
@ -14,11 +14,13 @@
|
||||
"build": [],
|
||||
"runtime": ["qt6.qtdeclarative", "zstd", "krb5", "abseil-cpp"]
|
||||
},
|
||||
"external_libraries": [],
|
||||
"external_libraries": [
|
||||
{ "name": "amm_client_ffi" }
|
||||
],
|
||||
"cmake": {
|
||||
"find_packages": [],
|
||||
"extra_sources": [],
|
||||
"extra_include_dirs": [],
|
||||
"extra_include_dirs": ["lib"],
|
||||
"extra_link_libraries": []
|
||||
}
|
||||
}
|
||||
|
||||
39390
flake.lock
generated
39390
flake.lock
generated
File diff suppressed because it is too large
Load Diff
63
flake.nix
63
flake.nix
@ -9,11 +9,25 @@
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# The AMM QML UI module (apps/amm) is built from this same flake so it can
|
||||
# reference the amm_client_ffi crate package via `self` — no filesystem
|
||||
# path or git-remote reference to this repo is needed (see apps/amm/flake.nix
|
||||
# history: a `git+file://` URL pointing at a local checkout is
|
||||
# machine-specific and not portable).
|
||||
logos-module-builder.url = "github:logos-co/logos-module-builder";
|
||||
|
||||
# Core wallet module (the LEZ wallet FFI Qt plugin). The input name must
|
||||
# match the metadata.json `dependencies` entry so the builder can resolve
|
||||
# it as a module dependency. This rev pins LEZ (lssa) at fb8cbac4, which
|
||||
# includes the macOS Metal-build fix, so no `--override-input` is needed.
|
||||
logos_execution_zone.url = "github:logos-blockchain/logos-execution-zone-module?rev=d2e9400ac06c3cdbfc2405b4f153fff9841a453c";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs, flake-utils, crane, rust-overlay }:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
inputs@{ self, nixpkgs, flake-utils, crane, rust-overlay, logos-module-builder, logos_execution_zone, ... }:
|
||||
let
|
||||
crateOutputs = flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
@ -69,4 +83,49 @@
|
||||
packages.amm_client_ffi = ammClientFfi;
|
||||
}
|
||||
);
|
||||
|
||||
# The AMM QML UI module (apps/amm). Its external_libraries entry
|
||||
# (amm_client_ffi) is resolved to `self.packages.${system}.amm_client_ffi`
|
||||
# above — the module builder's resolveExtInput reads
|
||||
# `flakeInput.packages.${system}.${pkgName}`, and passing `self` here
|
||||
# works because `self` is this very flake, which already exposes that
|
||||
# package per crateOutputs above.
|
||||
appOutputs = logos-module-builder.lib.mkLogosQmlModule {
|
||||
src = ./apps/amm;
|
||||
configFile = ./apps/amm/metadata.json;
|
||||
flakeInputs = inputs;
|
||||
externalLibInputs = {
|
||||
amm_client_ffi = { input = self; packages.default = "amm_client_ffi"; };
|
||||
};
|
||||
};
|
||||
|
||||
# Expose the AMM QML UI as a NAMED app/package (`amm-ui`) rather than
|
||||
# `<sys>.default` — the repo is expected to grow more UIs over time,
|
||||
# each runnable via `nix run .#<name>`. `appOutputs.apps.<sys>.default`
|
||||
# and `appOutputs.packages.<sys>.default` (the UI launcher and its
|
||||
# bundle, respectively) are renamed to `amm-ui`; no `default` survives
|
||||
# for either attribute set.
|
||||
appApps = appOutputs.apps or { };
|
||||
appPkgs = appOutputs.packages or { };
|
||||
|
||||
renamedApps = builtins.mapAttrs (
|
||||
system: attrs:
|
||||
(builtins.removeAttrs attrs [ "default" ]) // (if attrs ? default then { amm-ui = attrs.default; } else { })
|
||||
) appApps;
|
||||
|
||||
mergedPackages = builtins.mapAttrs (
|
||||
system: cratePkgs:
|
||||
let
|
||||
appSysPkgs = appPkgs.${system} or { };
|
||||
in
|
||||
(builtins.removeAttrs cratePkgs [ "default" ])
|
||||
// (builtins.removeAttrs appSysPkgs [ "default" ])
|
||||
// (if appSysPkgs ? default then { amm-ui = appSysPkgs.default; } else { })
|
||||
) crateOutputs.packages;
|
||||
in
|
||||
(builtins.removeAttrs appOutputs [ "apps" "packages" ])
|
||||
// {
|
||||
apps = renamedApps;
|
||||
packages = mergedPackages;
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user