refactor(nwc): dedupe NWC tooling — use Sovran_Bitcoin's sovran-nwc
The Hub vendored a second copy of the NWC stack (app/sovran_systemsos_web/nwc_hub_manager.py, nwc_audit.py, nwc_lnurl_service.py, nwc_wallet_cli.py) and built its own nwc-wallet / nwc-lnurl binaries from it. That copy drifted from the pinned Alby Hub API contract (appId vs toAppId) and duplicated code that Sovran_Bitcoin already ships and fixes. Changes: - Delete the four vendored modules; server.py now imports the canonical implementation directly (from sovran_nwc import nwc_hub_manager) from the sovran-nwc package (pkgs.sovran-bitcoin.nwc). API fixes in Sovran_Bitcoin now propagate to the Hub web app automatically. - sovran-hub-web launcher: add <sovran-nwc>/lib/sovran-nwc to sys.path so the import resolves. - Stop shipping nwc-wallet / nwc-lnurl binaries from sovran-hub-web: the flake already provides them (env-wrapped nwc-wallet with NWC_* vars via albyhub.nix, and nwc-lnurl.service via lnurl.nix). Requires a Sovran_Bitcoin rev containing the toAppId fix (and the LNURL module audit-log fix); bump the flake input afterwards: nix flake update sovran-bitcoin Test: - nixos-rebuild switch - Hub Wallet Connections tab still lists/creates wallets - nwc-wallet list works from the operator shell - journalctl -u nwc-lnurl shows no import/contract errors
This commit is contained in:
@@ -405,6 +405,9 @@ DESKTOP
|
||||
import os, sys
|
||||
base = os.path.join("$out", "lib", "sovran-hub-web")
|
||||
sys.path.insert(0, base)
|
||||
# Canonical NWC implementation — single source of truth from the
|
||||
# Sovran_Bitcoin flake (imported directly by server.py).
|
||||
sys.path.insert(0, os.path.join("${pkgs.sovran-bitcoin.nwc}", "lib", "sovran-nwc"))
|
||||
os.environ["SOVRAN_HUB_CONFIG"] = os.path.join(base, "config.json")
|
||||
os.environ["SOVRAN_HUB_VERSIONS"] = os.path.join(base, "versions.json")
|
||||
os.environ["SOVRAN_HUB_ICONS"] = os.path.join("$out", "share", "sovran-hub", "icons")
|
||||
@@ -418,26 +421,9 @@ uvicorn.run(
|
||||
LAUNCHER
|
||||
chmod +x $out/bin/sovran-hub-web
|
||||
|
||||
cat > $out/bin/nwc-wallet <<LAUNCHER
|
||||
#!${pkgs.python3}/bin/python3
|
||||
import os, sys
|
||||
base = os.path.join("$out", "lib", "sovran-hub-web")
|
||||
sys.path.insert(0, base)
|
||||
from sovran_systemsos_web.nwc_wallet_cli import main
|
||||
sys.exit(main())
|
||||
LAUNCHER
|
||||
chmod +x $out/bin/nwc-wallet
|
||||
|
||||
cat > $out/bin/nwc-lnurl <<LAUNCHER
|
||||
#!${pkgs.python3}/bin/python3
|
||||
import os, sys
|
||||
base = os.path.join("$out", "lib", "sovran-hub-web")
|
||||
sys.path.insert(0, base)
|
||||
from sovran_systemsos_web.nwc_lnurl_service import main
|
||||
main()
|
||||
LAUNCHER
|
||||
chmod +x $out/bin/nwc-lnurl
|
||||
|
||||
# nwc-wallet / nwc-lnurl binaries are no longer shipped here: the
|
||||
# Sovran_Bitcoin flake provides them (env-wrapped nwc-wallet via
|
||||
# albyhub.nix, nwc-lnurl.service via lnurl.nix) — single source of truth.
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user