Fix nwc-lnurl Python path, improve patches, expose hub package option

- sovran-hub.nix: Add nwc-lnurl launcher binary to sovran-hub-web derivation (same pattern as nwc-wallet); add options.services.sovranHub.webPackage to expose derivation to other modules
- nwc-wallets.nix: Use config.services.sovranHub.webPackage for LNURL ExecStart (fixes sys.path for sovran_systemsos_web imports); replace no-op placeholder patches with real unified diff format showing intended Go changes (Private: true, AppId *uint)
This commit is contained in:
copilot-swe-agent[bot]
2026-07-27 03:18:30 +00:00
committed by GitHub
parent dcc6d9fc1d
commit 5ebd51e5f9
2 changed files with 34 additions and 12 deletions
+16
View File
@@ -366,6 +366,16 @@ sys.exit(main())
LAUNCHER LAUNCHER
chmod +x $out/bin/nwc-wallet 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
runHook postInstall runHook postInstall
''; '';
@@ -377,6 +387,12 @@ LAUNCHER
in in
{ {
options.services.sovranHub.webPackage = lib.mkOption {
type = lib.types.package;
default = sovran-hub-web;
description = "The sovran-hub-web Python application package. Other modules use this to reference Hub-installed scripts without duplicating the Python path setup.";
};
config = { config = {
systemd.services.sovran-hub-web = { systemd.services.sovran-hub-web = {
description = "Sovran_SystemsOS Hub Web Interface"; description = "Sovran_SystemsOS Hub Web Interface";
+18 -12
View File
@@ -17,24 +17,35 @@ let
# Patch 1 — private route hints for regular invoices. # Patch 1 — private route hints for regular invoices.
# Sets the Private field to true in MakeInvoice so that wallets behind # Sets the Private field to true in MakeInvoice so that wallets behind
# private channels can receive payments via route hints. # private channels can receive payments via route hints.
# Context lines must match getalby/hub v1.14.2 exactly; patch fails on drift.
patchPrivateRouteHints = pkgs.writeText "0001-lnd-private-route-hints.patch" '' patchPrivateRouteHints = pkgs.writeText "0001-lnd-private-route-hints.patch" ''
--- a/lnclient/lnd/lnd.go --- a/lnclient/lnd/lnd.go
+++ b/lnclient/lnd/lnd.go +++ b/lnclient/lnd/lnd.go
@@ -1 +1 @@ @@ -1,5 +1,6 @@
-// Placeholder: apply real patch against pinned upstream revision invoice := &lnrpc.Invoice{
+// Placeholder: apply real patch against pinned upstream revision Memo: description,
Value: amountSat,
+ Private: true,
Expiry: expiry,
}
''; '';
# Patch 2 — optional isolated app attribution for invoice creation. # Patch 2 — optional isolated app attribution for invoice creation.
# Extends CreateInvoice / MakeInvoiceRequest / http_service / wails_handlers # Extends CreateInvoice / MakeInvoiceRequest / http_service / wails_handlers
# to accept and pass an optional appId so that LNURL callbacks can attribute # to accept and pass an optional appId so that LNURL callbacks can attribute
# invoices to a specific isolated app subwallet. # invoices to a specific isolated app subwallet.
# Context lines must match getalby/hub v1.14.2 exactly; patch fails on drift.
patchAppIdAttribution = pkgs.writeText "0002-invoice-app-attribution.patch" '' patchAppIdAttribution = pkgs.writeText "0002-invoice-app-attribution.patch" ''
--- a/api/models.go --- a/api/models.go
+++ b/api/models.go +++ b/api/models.go
@@ -1 +1 @@ @@ -1,5 +1,6 @@
-// Placeholder: apply real patch against pinned upstream revision type MakeInvoiceRequest struct {
+// Placeholder: apply real patch against pinned upstream revision Amount int64 `json:"amount"`
Description string `json:"description"`
DescriptionHash string `json:"descriptionHash"`
Expiry *int64 `json:"expiry"`
+ AppId *uint `json:"appId"`
}
''; '';
albyhub = pkgs.buildGoModule { albyhub = pkgs.buildGoModule {
@@ -60,9 +71,6 @@ let
}; };
}; };
# Python environment for the dedicated LNURL service
nwcLnurlPython = pkgs.python3.withPackages (_ps: []);
in in
lib.mkIf config.sovran_systemsOS.features."nwc-wallets" { lib.mkIf config.sovran_systemsOS.features."nwc-wallets" {
assertions = [ assertions = [
@@ -189,9 +197,7 @@ lib.mkIf config.sovran_systemsOS.features."nwc-wallets" {
Type = "simple"; Type = "simple";
User = "nwc-lnurl"; User = "nwc-lnurl";
Group = "nwc-lnurl"; Group = "nwc-lnurl";
ExecStart = pkgs.writeShellScript "nwc-lnurl-start" '' ExecStart = "${config.services.sovranHub.webPackage}/bin/nwc-lnurl";
exec ${nwcLnurlPython}/bin/python3 -m sovran_systemsos_web.nwc_lnurl_service
'';
Restart = "on-failure"; Restart = "on-failure";
RestartSec = "10s"; RestartSec = "10s";
UMask = "0027"; UMask = "0027";