fix(machine): live USB ISO with native modules and debug mode
Enable debugMode by default (simulated bill buttons) until real hardware validator is connected. Fix live.nix to include native node_modules (better-sqlite3, bindings) from pnpm virtual store, add LD_LIBRARY_PATH for NixOS, bake aiolabs.dev endpoints into env template, and enable Electron renderer logging in journalctl. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3634509ed4
commit
658c3c2b4d
3 changed files with 26 additions and 19 deletions
|
|
@ -12,34 +12,38 @@ let
|
|||
# Build first: pnpm run build --filter=@lamassu/machine
|
||||
# Requires --impure: reads MACHINE_DIR env var to find build artifacts (dist/ is gitignored)
|
||||
machineDir = builtins.getEnv "MACHINE_DIR";
|
||||
# Resolve pnpm virtual store paths for native modules
|
||||
pnpmStore = machineDir + "/../../node_modules/.pnpm";
|
||||
betterSqliteStore = pnpmStore + "/better-sqlite3@11.10.0/node_modules";
|
||||
bindingsStore = pnpmStore + "/bindings@1.5.0/node_modules";
|
||||
fileUriStore = pnpmStore + "/file-uri-to-path@1.0.0/node_modules";
|
||||
|
||||
atm-app = assert machineDir != ""
|
||||
|| throw "MACHINE_DIR env var must be set (use build-iso.sh or: export MACHINE_DIR=/path/to/apps/machine)";
|
||||
pkgs.runCommand "lamassu-atm-app" { } ''
|
||||
mkdir -p $out
|
||||
mkdir -p $out/node_modules
|
||||
cp -r ${builtins.path { path = machineDir + "/dist"; name = "dist"; }} $out/dist
|
||||
cp -r ${builtins.path { path = machineDir + "/dist-electron"; name = "dist-electron"; }} $out/dist-electron
|
||||
cp ${builtins.path { path = machineDir + "/package.json"; name = "package.json"; }} $out/package.json
|
||||
# Native modules required at runtime (not bundled by Vite)
|
||||
# Resolved from pnpm virtual store to get real files (not symlinks)
|
||||
cp -rL ${builtins.path { path = betterSqliteStore + "/better-sqlite3"; name = "better-sqlite3"; }} $out/node_modules/better-sqlite3
|
||||
cp -rL ${builtins.path { path = bindingsStore + "/bindings"; name = "bindings"; }} $out/node_modules/bindings
|
||||
cp -rL ${builtins.path { path = fileUriStore + "/file-uri-to-path"; name = "file-uri-to-path"; }} $out/node_modules/file-uri-to-path
|
||||
'';
|
||||
|
||||
# .env template with regtest defaults pointing to the dev machine
|
||||
envTemplate = pkgs.writeText "lamassu-atm-env" ''
|
||||
# Lamassu ATM Live USB Configuration
|
||||
# Run provision-atm.sh from your dev machine, or edit manually:
|
||||
# sudo nano /var/lib/lamassu-atm/.env && sudo systemctl restart lamassu-atm
|
||||
|
||||
VITE_RELAY_URL=ws://192.168.1.190:7777
|
||||
VITE_LIGHTNING_PUB_API_URL=http://192.168.1.190:1776
|
||||
VITE_EXTENSION_API_URL=http://192.168.1.190:1777
|
||||
|
||||
VITE_LIGHTNING_PUB_PUBKEY=
|
||||
VITE_ATM_PRIVATE_KEY=
|
||||
VITE_ADMIN_TOKEN=
|
||||
VITE_APP_ID=
|
||||
VITE_APP_TOKEN=
|
||||
|
||||
VITE_RELAY_URL=wss://relay.atm.aiolabs.dev
|
||||
VITE_LIGHTNING_PUB_PUBKEY=64b0d9b1af689e99e4b8a23ee7b77715b394740a6830bdccf4718a060a53649a
|
||||
VITE_LIGHTNING_PUB_API_URL=https://lp.atm.aiolabs.dev
|
||||
VITE_ADMIN_TOKEN=lamassu-dev-admin-token
|
||||
VITE_ATM_PRIVATE_KEY=f391a2c3fc734f443b0f685688a0441b5fb9805853c0023f570c5a3c6412b136
|
||||
VITE_EXTENSION_API_URL=https://lp-ext.atm.aiolabs.dev
|
||||
VITE_APP_ID=6016dadc6c677f131bc82cc0cb780d2b1090b83b8b7d0c972e469010270a4208
|
||||
VITE_LNDCONNECT_URL=lndconnect://lnd.atm.aiolabs.dev:443?cert=&macaroon=AgEDbG5kAvgBAwoQjLYgcUni_8EKmwpX_vwOWxIBMBoWCgdhZGRyZXNzEgRyZWFkEgV3cml0ZRoTCgRpbmZvEgRyZWFkEgV3cml0ZRoXCghpbnZvaWNlcxIEcmVhZBIFd3JpdGUaIQoIbWFjYXJvb24SCGdlbmVyYXRlEgRyZWFkEgV3cml0ZRoWCgdtZXNzYWdlEgRyZWFkEgV3cml0ZRoXCghvZmZjaGFpbhIEcmVhZBIFd3JpdGUaFgoHb25jaGFpbhIEcmVhZBIFd3JpdGUaFAoFcGVlcnMSBHJlYWQSBXdyaXRlGhgKBnNpZ25lchIIZ2VuZXJhdGUSBHJlYWQAAAYgClsDux9_gPaKUK7PI54y-sTwt5WGmSzrzfKaKamwvK0
|
||||
VITE_LAMASSU_MACHINE_MODEL=sintra
|
||||
VITE_LAMASSU_FIAT_CODE=USD
|
||||
|
||||
ELECTRON_FORCE_PROD=1
|
||||
DISPLAY=:0
|
||||
'';
|
||||
|
|
@ -138,8 +142,11 @@ in
|
|||
systemd.services.lamassu-atm = {
|
||||
serviceConfig = {
|
||||
EnvironmentFile = lib.mkForce "/var/lib/lamassu-atm/.env";
|
||||
# Native modules need libstdc++ on NixOS
|
||||
Environment = "LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib";
|
||||
# Electron needs --no-sandbox in the live/testing environment
|
||||
ExecStart = lib.mkForce "${pkgs-unstable.electron}/bin/electron --no-sandbox --disable-gpu-sandbox ${atm-app}";
|
||||
# --enable-logging makes renderer console.log visible in journalctl
|
||||
ExecStart = lib.mkForce "${pkgs-unstable.electron}/bin/electron --no-sandbox --disable-gpu-sandbox --enable-logging ${atm-app}";
|
||||
# Disable all security hardening that conflicts with Electron
|
||||
NoNewPrivileges = lib.mkForce false;
|
||||
ProtectSystem = lib.mkForce false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue