From 24799649dd135fe86915d488f0e512fb35e85830 Mon Sep 17 00:00:00 2001 From: amackillop Date: Mon, 19 Jan 2026 09:13:21 -0800 Subject: [PATCH 01/10] Add Nix build infrastructure with Crane The existing CI relies on system-installed toolchains and Docker images that can stop working unexpectedly, leading to build failures or subtle differences between developer machines and CI. This makes debugging difficult and wastes time chasing environment issues. Nix provides fully reproducible builds by pinning exact versions of the Rust toolchain, system libraries, and all dependencies. Every developer and CI runner builds with identical environments, ensuring that if it builds locally, it builds everywhere. Crane handles Rust-specific concerns like dependency caching and cross-compilation. Combined with the Determinate Systems GitHub Actions, builds are cached efficiently across CI runs. A justfile provides simple commands for developers unfamiliar with Nix syntax, making the transition seamless. --- .cargo/config.toml | 11 +- .envrc | 2 + .github/workflows/nix.yml | 208 +++ .gitignore | 1 - Cargo.lock | 3150 +++++++++++++++++++++++++++++++++++++ Cargo.toml | 5 +- flake.lock | 98 ++ flake.nix | 421 +++++ justfile | 51 + rust-toolchain.toml | 15 + 10 files changed, 3956 insertions(+), 6 deletions(-) create mode 100644 .envrc create mode 100644 .github/workflows/nix.yml create mode 100644 Cargo.lock create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 justfile create mode 100644 rust-toolchain.toml diff --git a/.cargo/config.toml b/.cargo/config.toml index 0651654..62a0783 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,8 @@ -[target.aarch64-unknown-linux-musl] -linker = "aarch64-linux-musl-gcc" -rustflags = ["-C", "target-feature=-crt-static"] +# Native Linux builds: use mold for faster linking +[target.'cfg(target_os = "linux")'] +rustflags = ["-C", "link-arg=-fuse-ld=mold"] + +# Cross-compilation settings for CI (yarn build) +# These are used by GitHub Actions, not by Nix builds [target.x86_64-pc-windows-msvc] -rustflags = ["-C", "target-feature=+crt-static"] \ No newline at end of file +rustflags = ["-C", "target-feature=+crt-static"] diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..e3fecb3 --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +use flake + diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml new file mode 100644 index 0000000..edef922 --- /dev/null +++ b/.github/workflows/nix.yml @@ -0,0 +1,208 @@ +name: Nix + +on: + push: + branches: + - main + paths-ignore: + - "**/*.md" + - LICENSE + - .editorconfig + - docs/** + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + check: + name: Flake Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + + - name: Enable Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + + - name: Check flake + uses: DeterminateSystems/flake-checker-action@main + + - name: Run checks (clippy, rustfmt) + run: nix flake check + + build-linux: + name: Build - ${{ matrix.target }} + runs-on: ubuntu-latest + needs: check + strategy: + fail-fast: false + matrix: + target: + - default + - aarch64_unknown_linux_gnu + - x86_64_unknown_linux_musl + - aarch64_unknown_linux_musl + steps: + - uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + + - name: Enable Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + + - name: Build ${{ matrix.target }} + run: nix build .#${{ matrix.target }} --print-out-paths + + - name: List output + run: | + ls -la result/lib/ + file result/lib/*.node + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: bindings-${{ matrix.target }} + path: result/lib/*.node + if-no-files-found: error + + build-android: + name: Build - ${{ matrix.target }} + runs-on: ubuntu-latest + needs: check + strategy: + fail-fast: false + matrix: + target: + - aarch64_linux_android + - armv7_linux_androideabi + steps: + - uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + with: + extra-conf: | + extra-substituters = https://cache.nixos.org + extra-trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= + + - name: Enable Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + + - name: Build ${{ matrix.target }} + run: nix build .#${{ matrix.target }} --print-out-paths + + - name: List output + run: | + ls -la result/lib/ + file result/lib/*.node + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: bindings-${{ matrix.target }} + path: result/lib/*.node + if-no-files-found: error + + build-macos: + name: Build - macOS ${{ matrix.arch }} + runs-on: ${{ matrix.runner }} + needs: check + strategy: + fail-fast: false + matrix: + include: + - runner: macos-13 + arch: x64 + - runner: macos-14 + arch: arm64 + steps: + - uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + + - name: Enable Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + + - name: Build + run: nix build --print-out-paths + + - name: List output + run: | + ls -la result/lib/ + file result/lib/*.node + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: bindings-darwin-${{ matrix.arch }} + path: result/lib/*.node + if-no-files-found: error + + # Disable publish for now + publish: + if: false + name: Publish + runs-on: ubuntu-latest + needs: + - check + - build-linux + - build-android + - build-macos + steps: + - uses: actions/checkout@v4 + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: yarn + + - name: Install dependencies + run: yarn install + + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + + - name: List downloaded artifacts + run: ls -R artifacts/ + + - name: Move artifacts to npm directories + run: | + # Copy all .node files from artifacts to current directory + # Nix outputs match NAPI-RS naming: lightning-js.{platform}.node + find artifacts -name "*.node" -exec cp {} . \; + + # List what we have + ls -la lightning-js.*.node + + # Run NAPI-RS artifacts command to move files to npm/ subdirectories + yarn artifacts + + - name: List packages + run: ls -R ./npm + + - name: Publish + run: | + npm config set provenance true + if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$"; + then + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + npm publish --access public + elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+"; + then + echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc + npm publish --tag next --access public + else + echo "Not a release, skipping publish" + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index 255bf4e..65c8077 100644 --- a/.gitignore +++ b/.gitignore @@ -117,7 +117,6 @@ dist #Added by cargo /target -Cargo.lock *.node .pnp.* diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..045890a --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,3150 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "async-trait" +version = "0.1.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "aws-lc-rs" +version = "1.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e84ce723ab67259cfeb9877c6a639ee9eb7a27b28123abd71db7f0d5d0cc9d86" +dependencies = [ + "aws-lc-sys", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a442ece363113bd4bd4c8b18977a7798dd4d3c3383f34fb61936960e8f4ad8" +dependencies = [ + "cc", + "cmake", + "dunce", + "fs_extra", +] + +[[package]] +name = "base58ck" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c8d66485a3a2ea485c1913c4572ce0256067a5377ac8c75c4960e1cda98605f" +dependencies = [ + "bitcoin-internals", + "bitcoin_hashes", +] + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bdk_chain" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b5d691fd092aacec7e05046b7d04897d58d6d65ed3152cb6cf65dababcfabed" +dependencies = [ + "bdk_core", + "bitcoin", + "miniscript", + "serde", +] + +[[package]] +name = "bdk_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dbbe4aad0c898bfeb5253c222be3ea3dccfb380a07e72c87e3e4ed6664a6753" +dependencies = [ + "bitcoin", + "hashbrown 0.14.5", + "serde", +] + +[[package]] +name = "bdk_electrum" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b59a3f7fbe678874fa34354097644a171276e02a49934c13b3d61c54610ddf39" +dependencies = [ + "bdk_core", + "electrum-client 0.24.1", +] + +[[package]] +name = "bdk_esplora" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c9f5961444b5f51b9c3937e729a212363d0e4cde6390ded6e01e16292078df4" +dependencies = [ + "async-trait", + "bdk_core", + "esplora-client 0.12.1", + "futures", +] + +[[package]] +name = "bdk_wallet" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b03f1e31ccc562f600981f747d2262b84428cbff52c9c9cdf14d15fb15bd2286" +dependencies = [ + "bdk_chain", + "bip39", + "bitcoin", + "miniscript", + "rand_core 0.6.4", + "serde", + "serde_json", +] + +[[package]] +name = "bech32" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32637268377fc7b10a8c6d51de3e7fba1ce5dd371a96e342b34e6078db558e7f" + +[[package]] +name = "bip21" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe7a7f5928d264879d5b65eb18a72ea1890c57f22d62ee2eba93f207a6a020b" +dependencies = [ + "bitcoin", + "percent-encoding-rfc3986", +] + +[[package]] +name = "bip39" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90dbd31c98227229239363921e60fcf5e558e43ec69094d46fc4996f08d1d5bc" +dependencies = [ + "bitcoin_hashes", + "serde", + "unicode-normalization", +] + +[[package]] +name = "bitcoin" +version = "0.32.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e499f9fc0407f50fe98af744ab44fa67d409f76b6772e1689ec8485eb0c0f66" +dependencies = [ + "base58ck", + "base64 0.21.7", + "bech32", + "bitcoin-internals", + "bitcoin-io", + "bitcoin-units", + "bitcoin_hashes", + "hex-conservative", + "hex_lit", + "secp256k1", + "serde", +] + +[[package]] +name = "bitcoin-internals" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30bdbe14aa07b06e6cfeffc529a1f099e5fbe249524f8125358604df99a4bed2" +dependencies = [ + "serde", +] + +[[package]] +name = "bitcoin-io" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dee39a0ee5b4095224a0cfc6bf4cc1baf0f9624b96b367e53b66d974e51d953" + +[[package]] +name = "bitcoin-payment-instructions" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd1e2069af33b2796a0d81097ffbe42eb0e85f9d9890bfc022f6960433f7399" +dependencies = [ + "bitcoin", + "dnssec-prover", + "getrandom 0.3.4", + "lightning 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "lightning-invoice 0.33.2 (registry+https://github.com/rust-lang/crates.io-index)", + "reqwest 0.11.27", + "serde", + "serde_json", +] + +[[package]] +name = "bitcoin-units" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5285c8bcaa25876d07f37e3d30c303f2609179716e11d688f51e8f1fe70063e2" +dependencies = [ + "bitcoin-internals", + "serde", +] + +[[package]] +name = "bitcoin_hashes" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26ec84b80c482df901772e931a9a681e26a1b9ee2302edeff23cb30328745c8b" +dependencies = [ + "bitcoin-io", + "hex-conservative", + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" + +[[package]] +name = "bumpalo" +version = "3.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" + +[[package]] +name = "cc" +version = "1.2.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "755d2fce177175ffca841e9a06afdb2c4ab0f593d53b4dee48147dfaade85932" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chrono" +version = "0.4.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" +dependencies = [ + "iana-time-zone", + "num-traits", + "serde", + "windows-link", +] + +[[package]] +name = "chunked_transfer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e4de3bc4ea267985becf712dc6d9eed8b04c953b3fcfb339ebc87acd9804901" + +[[package]] +name = "cmake" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75443c44cd6b379beb8c5b45d85d0773baf31cce901fe7bb252f4eff3008ef7d" +dependencies = [ + "cc", +] + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "ctor" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501" +dependencies = [ + "quote", + "syn 2.0.114", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "dnssec-prover" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4f825369fc7134da70ca4040fddc8e03b80a46d249ae38d9c1c39b7b4476bf" +dependencies = [ + "bitcoin_hashes", + "tokio", +] + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "electrum-client" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a0bd443023f9f5c4b7153053721939accc7113cbdf810a024434eed454b3db1" +dependencies = [ + "bitcoin", + "byteorder", + "libc", + "log", + "rustls 0.23.36", + "serde", + "serde_json", + "webpki-roots 0.25.4", + "winapi", +] + +[[package]] +name = "electrum-client" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5059f13888a90486e7268bbce59b175f5f76b1c55e5b9c568ceaa42d2b8507c" +dependencies = [ + "bitcoin", + "byteorder", + "libc", + "log", + "rustls 0.23.36", + "serde", + "serde_json", + "webpki-roots 0.25.4", + "winapi", +] + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "esplora-client" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0da3c186d286e046253ccdc4bb71aa87ef872e4eff2045947c0c4fe3d2b2efc" +dependencies = [ + "bitcoin", + "hex-conservative", + "log", + "reqwest 0.11.27", + "serde", + "tokio", +] + +[[package]] +name = "esplora-client" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0af349d96a5d9ad77ba59f1437aa6f348b03c5865d4f7d6e7a662d60aedce39" +dependencies = [ + "bitcoin", + "hex-conservative", + "log", + "reqwest 0.12.28", + "serde", + "tokio", +] + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fallible-streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "find-msvc-tools" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db" + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasip2", + "wasm-bindgen", +] + +[[package]] +name = "h2" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.12", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "serde", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "hashlink" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" +dependencies = [ + "hashbrown 0.14.5", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "hex-conservative" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda06d18ac606267c40c04e41b9947729bf8b9efe74bd4e82b61a5f26a510b9f" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "hex_lit" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd" + +[[package]] +name = "home" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http 1.4.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http 1.4.0", + "http-body 1.0.1", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http 0.2.12", + "http-body 0.4.6", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.5.10", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http 1.4.0", + "http-body 1.0.1", + "httparse", + "itoa", + "pin-project-lite", + "pin-utils", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +dependencies = [ + "futures-util", + "http 0.2.12", + "hyper 0.14.32", + "rustls 0.21.12", + "tokio", + "tokio-rustls 0.24.1", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" +dependencies = [ + "http 1.4.0", + "hyper 1.8.1", + "hyper-util", + "rustls 0.23.36", + "rustls-pki-types", + "tokio", + "tokio-rustls 0.26.4", + "tower-service", + "webpki-roots 1.0.5", +] + +[[package]] +name = "hyper-util" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http 1.4.0", + "http-body 1.0.1", + "hyper 1.8.1", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2 0.6.1", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" + +[[package]] +name = "icu_properties" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "potential_utf", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" + +[[package]] +name = "icu_provider" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" +dependencies = [ + "displaydoc", + "icu_locale_core", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +dependencies = [ + "equivalent", + "hashbrown 0.16.1", +] + +[[package]] +name = "ipnet" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + +[[package]] +name = "iri-string" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c91338f0783edbd6195decb37bae672fd3b165faffb89bf7b9e6942f8b1a731a" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "ldk-node" +version = "0.6.2" +source = "git+https://github.com/moneydevkit/ldk-node.git?rev=ec8c62e5185c35f30453d837cf7e7d0c6b420fb6#ec8c62e5185c35f30453d837cf7e7d0c6b420fb6" +dependencies = [ + "base64 0.22.1", + "bdk_chain", + "bdk_electrum", + "bdk_esplora", + "bdk_wallet", + "bip21", + "bip39", + "bitcoin", + "chrono", + "electrum-client 0.24.1", + "esplora-client 0.11.0", + "esplora-client 0.12.1", + "libc", + "lightning 0.1.8 (git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f)", + "lightning-background-processor", + "lightning-block-sync", + "lightning-invoice 0.33.2 (git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f)", + "lightning-liquidity", + "lightning-net-tokio", + "lightning-persister", + "lightning-rapid-gossip-sync", + "lightning-transaction-sync", + "lightning-types 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f)", + "log", + "prost", + "rand 0.8.5", + "reqwest 0.12.28", + "rusqlite", + "rustls 0.23.36", + "serde", + "serde_json", + "tokio", + "vss-client", + "winapi", +] + +[[package]] +name = "libc" +version = "0.2.180" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" + +[[package]] +name = "libloading" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" +dependencies = [ + "cfg-if", + "windows-link", +] + +[[package]] +name = "libm" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" + +[[package]] +name = "libsqlite3-sys" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c10584274047cb335c23d3e61bcef8e323adae7c5c8c760540f73610177fc3f" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "lightning" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ffe63f56b10d214be1ade8698ee80af82d981237cae3e581e7a631f5f4959f3" +dependencies = [ + "bech32", + "bitcoin", + "dnssec-prover", + "hashbrown 0.13.2", + "libm", + "lightning-invoice 0.33.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lightning-types 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "possiblyrandom 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lightning" +version = "0.1.8" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f#42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f" +dependencies = [ + "bech32", + "bitcoin", + "dnssec-prover", + "hashbrown 0.13.2", + "libm", + "lightning-invoice 0.33.2 (git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f)", + "lightning-types 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f)", + "musig2", + "possiblyrandom 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f)", +] + +[[package]] +name = "lightning-background-processor" +version = "0.1.0" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f#42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f" +dependencies = [ + "bitcoin", + "bitcoin-io", + "bitcoin_hashes", + "lightning 0.1.8 (git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f)", + "lightning-rapid-gossip-sync", +] + +[[package]] +name = "lightning-block-sync" +version = "0.1.0" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f#42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f" +dependencies = [ + "bitcoin", + "chunked_transfer", + "lightning 0.1.8 (git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f)", + "serde_json", + "tokio", +] + +[[package]] +name = "lightning-invoice" +version = "0.33.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11209f386879b97198b2bfc9e9c1e5d42870825c6bd4376f17f95357244d6600" +dependencies = [ + "bech32", + "bitcoin", + "lightning-types 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lightning-invoice" +version = "0.33.2" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f#42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f" +dependencies = [ + "bech32", + "bitcoin", + "lightning-types 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f)", + "serde", +] + +[[package]] +name = "lightning-js" +version = "0.1.60" +dependencies = [ + "bitcoin", + "bitcoin-payment-instructions", + "home", + "icu_collections", + "icu_locale_core", + "icu_normalizer", + "icu_properties", + "icu_provider", + "ldk-node", + "lightning-invoice 0.33.2 (registry+https://github.com/rust-lang/crates.io-index)", + "napi", + "napi-build", + "napi-derive", + "tokio", + "writeable", +] + +[[package]] +name = "lightning-liquidity" +version = "0.1.0" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f#42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f" +dependencies = [ + "bitcoin", + "chrono", + "lightning 0.1.8 (git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f)", + "lightning-invoice 0.33.2 (git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f)", + "lightning-types 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f)", + "serde", + "serde_json", +] + +[[package]] +name = "lightning-macros" +version = "0.1.0" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f#42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "lightning-net-tokio" +version = "0.1.0" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f#42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f" +dependencies = [ + "bitcoin", + "lightning 0.1.8 (git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f)", + "tokio", +] + +[[package]] +name = "lightning-persister" +version = "0.1.0" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f#42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f" +dependencies = [ + "bitcoin", + "lightning 0.1.8 (git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f)", + "windows-sys 0.48.0", +] + +[[package]] +name = "lightning-rapid-gossip-sync" +version = "0.1.0" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f#42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f" +dependencies = [ + "bitcoin", + "bitcoin-io", + "bitcoin_hashes", + "lightning 0.1.8 (git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f)", +] + +[[package]] +name = "lightning-transaction-sync" +version = "0.1.0" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f#42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f" +dependencies = [ + "bitcoin", + "electrum-client 0.21.0", + "esplora-client 0.11.0", + "futures", + "lightning 0.1.8 (git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f)", + "lightning-macros", +] + +[[package]] +name = "lightning-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2cd84d4e71472035903e43caded8ecc123066ce466329ccd5ae537a8d5488c7" +dependencies = [ + "bitcoin", +] + +[[package]] +name = "lightning-types" +version = "0.2.0" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f#42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f" +dependencies = [ + "bitcoin", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + +[[package]] +name = "litemap" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniscript" +version = "12.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "487906208f38448e186e3deb02f2b8ef046a9078b0de00bdb28bf4fb9b76951c" +dependencies = [ + "bech32", + "bitcoin", + "serde", +] + +[[package]] +name = "mio" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" + +[[package]] +name = "musig2" +version = "0.1.0" +source = "git+https://github.com/arik-so/rust-musig2?rev=6f95a05718cbb44d8fe3fa6021aea8117aa38d50#6f95a05718cbb44d8fe3fa6021aea8117aa38d50" +dependencies = [ + "bitcoin", +] + +[[package]] +name = "napi" +version = "2.16.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55740c4ae1d8696773c78fdafd5d0e5fe9bc9f1b071c7ba493ba5c413a9184f3" +dependencies = [ + "bitflags 2.10.0", + "ctor", + "napi-derive", + "napi-sys", + "once_cell", +] + +[[package]] +name = "napi-build" +version = "2.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ae82775d1b06f3f07efd0666e59bbc175da8383bc372051031d7a447e94fbea" + +[[package]] +name = "napi-derive" +version = "2.16.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cbe2585d8ac223f7d34f13701434b9d5f4eb9c332cccce8dee57ea18ab8ab0c" +dependencies = [ + "cfg-if", + "convert_case", + "napi-derive-backend", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "napi-derive-backend" +version = "1.0.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1639aaa9eeb76e91c6ae66da8ce3e89e921cd3885e99ec85f4abacae72fc91bf" +dependencies = [ + "convert_case", + "once_cell", + "proc-macro2", + "quote", + "regex", + "semver", + "syn 2.0.114", +] + +[[package]] +name = "napi-sys" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427802e8ec3a734331fec1035594a210ce1ff4dc5bc1950530920ab717964ea3" +dependencies = [ + "libloading", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "percent-encoding-rfc3986" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3637c05577168127568a64e9dc5a6887da720efef07b3d9472d45f63ab191166" + +[[package]] +name = "petgraph" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" +dependencies = [ + "fixedbitset", + "indexmap", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "possiblyrandom" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b122a615d72104fb3d8b26523fdf9232cd8ee06949fb37e4ce3ff964d15dffd" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "possiblyrandom" +version = "0.2.0" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f#42bad4fd3c908958b96b6b70ed63bd6aa3cbaf5f" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" +dependencies = [ + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "proc-macro2" +version = "1.0.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prost" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-build" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" +dependencies = [ + "bytes", + "heck", + "itertools", + "lazy_static", + "log", + "multimap", + "petgraph", + "prettyplease", + "prost", + "prost-types", + "regex", + "syn 1.0.109", + "tempfile", + "which", +] + +[[package]] +name = "prost-derive" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "prost-types" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" +dependencies = [ + "prost", +] + +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls 0.23.36", + "socket2 0.6.1", + "thiserror 2.0.17", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" +dependencies = [ + "bytes", + "getrandom 0.3.4", + "lru-slab", + "rand 0.9.2", + "ring", + "rustc-hash", + "rustls 0.23.36", + "rustls-pki-types", + "slab", + "thiserror 2.0.17", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2 0.6.1", + "tracing", + "windows-sys 0.60.2", +] + +[[package]] +name = "quote" +version = "1.0.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "regex" +version = "1.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" + +[[package]] +name = "reqwest" +version = "0.11.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +dependencies = [ + "base64 0.21.7", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.32", + "hyper-rustls 0.24.2", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls 0.21.12", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 0.1.2", + "system-configuration", + "tokio", + "tokio-rustls 0.24.1", + "tokio-socks", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots 0.25.4", + "winreg", +] + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "http 1.4.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.8.1", + "hyper-rustls 0.27.7", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls 0.23.36", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 1.0.2", + "tokio", + "tokio-rustls 0.26.4", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots 1.0.5", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rusqlite" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae" +dependencies = [ + "bitflags 2.10.0", + "fallible-iterator", + "fallible-streaming-iterator", + "hashlink", + "libsqlite3-sys", + "smallvec", +] + +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustix" +version = "0.38.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" +dependencies = [ + "bitflags 2.10.0", + "errno", + "libc", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +dependencies = [ + "bitflags 2.10.0", + "errno", + "libc", + "linux-raw-sys 0.11.0", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.21.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" +dependencies = [ + "log", + "ring", + "rustls-webpki 0.101.7", + "sct", +] + +[[package]] +name = "rustls" +version = "0.23.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b" +dependencies = [ + "aws-lc-rs", + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki 0.103.9", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7df23109aa6c1567d1c575b9952556388da57401e4ace1d15f79eedad0d8f53" +dependencies = [ + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984" + +[[package]] +name = "sct" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "secp256k1" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113" +dependencies = [ + "bitcoin_hashes", + "rand 0.8.5", + "secp256k1-sys", + "serde", +] + +[[package]] +name = "secp256k1-sys" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4387882333d3aa8cb20530a17c69a3752e97837832f34f6dccc760e715001d9" +dependencies = [ + "cc", +] + +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "slab" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "socket2" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tempfile" +version = "3.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" +dependencies = [ + "fastrand", + "getrandom 0.3.4", + "once_cell", + "rustix 1.1.3", + "windows-sys 0.61.2", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +dependencies = [ + "thiserror-impl 2.0.17", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "tinystr" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +dependencies = [ + "displaydoc", + "serde_core", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2 0.6.1", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls 0.21.12", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls 0.23.36", + "tokio", +] + +[[package]] +name = "tokio-socks" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d4770b8024672c1101b3f6733eab95b18007dbe0847a8afe341fcf79e06043f" +dependencies = [ + "either", + "futures-util", + "thiserror 1.0.69", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper 1.0.2", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" +dependencies = [ + "bitflags 2.10.0", + "bytes", + "futures-util", + "http 1.4.0", + "http-body 1.0.1", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "unicode-ident" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" + +[[package]] +name = "unicode-normalization" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vss-client" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d787f7640ceae8caef95434f1b14936402b73e18d34868b052a502a5d5085490" +dependencies = [ + "async-trait", + "base64 0.21.7", + "bitcoin", + "bitcoin_hashes", + "prost", + "prost-build", + "rand 0.8.5", + "reqwest 0.11.27", + "serde", + "serde_json", + "tokio", + "url", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.1+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70a6e77fd0ae8029c9ea0063f87c46fde723e7d887703d74ad2616d792e51e6f" +dependencies = [ + "cfg-if", + "futures-util", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 2.0.114", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" + +[[package]] +name = "webpki-roots" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12bed680863276c63889429bfd6cab3b99943659923822de1c8a39c49e4d722c" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix 0.38.44", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "wit-bindgen" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" + +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" + +[[package]] +name = "yoke" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zerotrie" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "serde", + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "zmij" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94f63c051f4fe3c1509da62131a678643c5b6fbdc9273b2b79d4378ebda003d2" diff --git a/Cargo.toml b/Cargo.toml index 4ddcd16..f1e1b1e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,10 @@ writeable = { version = "=0.6.2", features = ["alloc"] } napi-build = "=2.2.4" [profile.release] -lto = true +opt-level = 3 # Maximum runtime performance +lto = true # Link-time optimization for smaller/faster binary +codegen-units = 1 # Better optimization (slower compile) +strip = "debuginfo" # Remove debug info but keep symbols for crash reports [dev-dependencies] bitcoin = "0.32" diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..020552a --- /dev/null +++ b/flake.lock @@ -0,0 +1,98 @@ +{ + "nodes": { + "crane": { + "locked": { + "lastModified": 1768700043, + "narHash": "sha256-rfs2aP+wdueJZ6uABaj0e0PavQyzkRJuJX30HNcBPTg=", + "owner": "ipetkov", + "repo": "crane", + "rev": "935de8bd6838d940988bb065be2a2034259327b9", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1768661221, + "narHash": "sha256-MJwOjrIISfOpdI9x4C+5WFQXvHtOuj5mqLZ4TMEtk1M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3327b113f2ef698d380df83fbccefad7e83d7769", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "crane": "crane", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1768704795, + "narHash": "sha256-Y33TAp2BHEcuspYvcmBXXD0qdvjftv73PwyKTDOjoSY=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "4b7472a78857ac789fb26616040f55cfcbd36c6e", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ac99d45 --- /dev/null +++ b/flake.nix @@ -0,0 +1,421 @@ +{ + description = "Lightning JS"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + crane.url = "github:ipetkov/crane"; + flake-utils.url = "github:numtide/flake-utils"; + + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + { + nixpkgs, + crane, + flake-utils, + rust-overlay, + ... + }: + flake-utils.lib.eachDefaultSystem ( + localSystem: + let + pkgs = import nixpkgs { + system = localSystem; + overlays = [ (import rust-overlay) ]; + }; + + # Load Rust toolchain configuration from rust-toolchain.toml. + # This ensures consistency between local development (rustup) and Nix builds. + # See: https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file + rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + + # Initialize Crane with our toolchain. + # Crane is a Nix library for building Rust projects with good caching. + # See: https://crane.dev/ + craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain; + + # Filter source to only include Rust-relevant files. + # This improves caching by excluding unrelated files from the build hash. + src = craneLib.cleanCargoSource ./.; + + # Build inputs shared across native builds and checks. + # These are libraries linked into the final binary. + commonBuildInputs = + with pkgs; + [ openssl ] + ++ lib.optionals stdenv.isDarwin [ + # macOS requires these frameworks for network/TLS operations + darwin.apple_sdk.frameworks.Security + darwin.apple_sdk.frameworks.SystemConfiguration + ]; + + # ============================================================ + # Native build for the current system + # ============================================================ + nativePackage = pkgs.callPackage ( + # Using callPackage for proper "splicing" - Nix automatically + # provides the correct versions of dependencies for the target platform. + # See: https://crane.dev/examples/cross-rust-overlay.html + { + lib, + openssl, + pkg-config, + stdenv, + darwin, + }: + craneLib.buildPackage { + inherit src; + pname = "lightning-js"; + + # Enforce strict separation between build-time and runtime deps + strictDeps = true; + + # pkg-config runs at build time to locate openssl + # mold is a fast linker for ELF binaries (Linux targets only, not macOS Mach-O) + nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.isLinux [ pkgs.mold ]; + + # Libraries linked into the final binary + buildInputs = + [ openssl ] + ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.Security + darwin.apple_sdk.frameworks.SystemConfiguration + ]; + + # macOS minimum deployment target (matches CI) + MACOSX_DEPLOYMENT_TARGET = lib.optionalString stdenv.isDarwin "10.13"; + + # Custom install phase for NAPI-RS native addon. + # Cargo builds a cdylib (.so on Linux, .dylib on macOS). + # Node.js expects native addons to have .node extension. + # The naming convention follows NAPI-RS: {name}.{platform}.node + installPhaseCommand = '' + mkdir -p $out/lib + + # Copy the shared library with NAPI-RS naming convention + if [ -f target/release/liblightning_js.so ]; then + cp target/release/liblightning_js.so $out/lib/lightning-js.linux-x64-gnu.node + elif [ -f target/release/liblightning_js.dylib ]; then + cp target/release/liblightning_js.dylib $out/lib/lightning-js.darwin-x64.node + fi + ''; + } + ) { }; + + # ============================================================ + # Debug build (faster compilation, no optimizations) + # ============================================================ + debugPackage = pkgs.callPackage ( + { + lib, + openssl, + pkg-config, + stdenv, + darwin, + }: + craneLib.buildPackage { + inherit src; + pname = "lightning-js"; + strictDeps = true; + + # Build in debug mode (no --release flag) + cargoExtraArgs = ""; + CARGO_PROFILE = "dev"; + + nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.isLinux [ pkgs.mold ]; + buildInputs = + [ openssl ] + ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.Security + darwin.apple_sdk.frameworks.SystemConfiguration + ]; + + MACOSX_DEPLOYMENT_TARGET = lib.optionalString stdenv.isDarwin "10.13"; + + # Debug builds output to target/debug/ + installPhaseCommand = '' + mkdir -p $out/lib + + if [ -f target/debug/liblightning_js.so ]; then + cp target/debug/liblightning_js.so $out/lib/lightning-js.linux-x64-gnu.node + elif [ -f target/debug/liblightning_js.dylib ]; then + cp target/debug/liblightning_js.dylib $out/lib/lightning-js.darwin-x64.node + fi + ''; + } + ) { }; + + # ============================================================ + # Cross-compilation helper for glibc targets + # ============================================================ + mkCrossPackage = + { + crossSystem, # Nix cross-compilation system (e.g., "aarch64-linux") + target, # Rust target triple (e.g., "aarch64-unknown-linux-gnu") + nodeName, # Output filename for the .node addon + extraFlags ? "", # Additional RUSTFLAGS for compilation + }: + let + # Import nixpkgs configured for cross-compilation. + # localSystem = build machine, crossSystem = target machine. + crossPkgs = import nixpkgs { + inherit localSystem crossSystem; + overlays = [ (import rust-overlay) ]; + }; + + # Create Crane lib for cross target. + # Using a function ensures proper toolchain splicing for cross-compilation. + crossCraneLib = (crane.mkLib crossPkgs).overrideToolchain ( + p: p.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml + ); + in + crossPkgs.callPackage ( + { + openssl, + pkg-config, + }: + crossCraneLib.buildPackage { + src = crossCraneLib.cleanCargoSource ./.; + pname = "lightning-js"; + strictDeps = true; + + # Skip tests - can't run cross-compiled binaries on build host + doCheck = false; + + # Tell Cargo which target to build for + CARGO_BUILD_TARGET = target; + CARGO_BUILD_RUSTFLAGS = extraFlags; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ openssl ]; + + # Find and copy the cross-compiled shared library. + # The library is in target/{target}/release/ for cross builds. + installPhaseCommand = '' + mkdir -p $out/lib + + # Use find to locate the .so file in the target-specific directory + find target -name "liblightning_js.so" -exec cp {} $out/lib/${nodeName} \; 2>/dev/null || true + ''; + } + ) { }; + + # ============================================================ + # Cross-compilation helper for musl (static) targets + # ============================================================ + mkMuslPackage = + { + target, # Rust target triple (e.g., "x86_64-unknown-linux-musl") + nodeName, # Output filename for the .node addon + }: + let + muslCraneLib = (crane.mkLib pkgs).overrideToolchain ( + p: p.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml + ); + in + muslCraneLib.buildPackage { + inherit src; + pname = "lightning-js"; + strictDeps = true; + + # Skip tests for cross-compiled targets + doCheck = false; + + # Build for musl target + CARGO_BUILD_TARGET = target; + + # Link the C runtime statically for fully static binaries. + # This makes the binary portable across Linux distributions. + CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static"; + + nativeBuildInputs = with pkgs; [ pkg-config ]; + + # Use static versions of libraries for musl builds + buildInputs = with pkgs.pkgsStatic; [ openssl ]; + + installPhaseCommand = '' + mkdir -p $out/lib + + # Find and copy the statically-linked shared library + find target -name "liblightning_js.so" -exec cp {} $out/lib/${nodeName} \; 2>/dev/null || true + ''; + }; + + # ============================================================ + # Cross-compilation helper for Android targets + # ============================================================ + mkAndroidPackage = + { + target, # Rust target triple (e.g., "aarch64-linux-android") + nodeName, # Output filename for the .node addon + androidAbi, # Android ABI (e.g., "arm64-v8a") + }: + let + # Android NDK requires unfree license acceptance + androidPkgs = import nixpkgs { + system = localSystem; + config.allowUnfree = true; + config.android_sdk.accept_license = true; + overlays = [ (import rust-overlay) ]; + }; + + # Android NDK from nixpkgs + androidNdk = androidPkgs.androidenv.androidPkgs.ndk-bundle; + + androidCraneLib = (crane.mkLib androidPkgs).overrideToolchain ( + p: p.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml + ); + + # NDK toolchain paths + # Using API 28+ for getentropy() support required by aws-lc-sys + ndkToolchain = "${androidNdk}/libexec/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64"; + apiLevel = "28"; + in + androidCraneLib.buildPackage { + inherit src; + pname = "lightning-js"; + strictDeps = true; + + # Skip tests - can't run Android binaries on Linux + doCheck = false; + + # Tell Cargo which target to build for + CARGO_BUILD_TARGET = target; + + # Android NDK environment variables + ANDROID_NDK_HOME = "${androidNdk}/libexec/android-sdk/ndk-bundle"; + CC_aarch64_linux_android = "${ndkToolchain}/bin/aarch64-linux-android${apiLevel}-clang"; + CXX_aarch64_linux_android = "${ndkToolchain}/bin/aarch64-linux-android${apiLevel}-clang++"; + AR_aarch64_linux_android = "${ndkToolchain}/bin/llvm-ar"; + CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER = "${ndkToolchain}/bin/aarch64-linux-android${apiLevel}-clang"; + + CC_armv7_linux_androideabi = "${ndkToolchain}/bin/armv7a-linux-androideabi${apiLevel}-clang"; + CXX_armv7_linux_androideabi = "${ndkToolchain}/bin/armv7a-linux-androideabi${apiLevel}-clang++"; + AR_armv7_linux_androideabi = "${ndkToolchain}/bin/llvm-ar"; + CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER = "${ndkToolchain}/bin/armv7a-linux-androideabi${apiLevel}-clang"; + + nativeBuildInputs = with pkgs; [ pkg-config ]; + + installPhaseCommand = '' + mkdir -p $out/lib + + # Find and copy the Android shared library + find target -name "liblightning_js.so" -exec cp {} $out/lib/${nodeName} \; 2>/dev/null || true + ''; + }; + + # ============================================================ + # Checks (run via `nix flake check`) + # ============================================================ + + # Pre-build dependencies only (cached separately from source changes). + # This speeds up incremental builds significantly. + cargoArtifacts = craneLib.buildDepsOnly { + inherit src; + pname = "lightning-js"; + # mold links ELF (Linux targets only) + nativeBuildInputs = with pkgs; [ pkg-config ] ++ lib.optionals stdenv.isLinux [ mold ]; + buildInputs = commonBuildInputs; + }; + + # Run clippy linter with warnings as errors + cargoClippy = craneLib.cargoClippy { + inherit src cargoArtifacts; + pname = "lightning-js"; + cargoClippyExtraArgs = "--all-targets -- --deny warnings"; + nativeBuildInputs = with pkgs; [ pkg-config ] ++ lib.optionals stdenv.isLinux [ mold ]; + buildInputs = commonBuildInputs; + }; + + # Check code formatting with rustfmt + cargoFmt = craneLib.cargoFmt { inherit src; }; + in + { + checks = { + inherit nativePackage cargoClippy cargoFmt; + }; + + packages = + { + default = nativePackage; + debug = debugPackage; # Fast build without optimizations + } + # Cross-compilation packages are only available on Linux hosts + // pkgs.lib.optionalAttrs pkgs.stdenv.isLinux { + # Linux ARM64 with glibc (for standard Linux distros) + aarch64_unknown_linux_gnu = mkCrossPackage { + crossSystem = "aarch64-linux"; + target = "aarch64-unknown-linux-gnu"; + nodeName = "lightning-js.linux-arm64-gnu.node"; + }; + + # Linux x86_64 with musl (static, portable binary) + x86_64_unknown_linux_musl = mkMuslPackage { + target = "x86_64-unknown-linux-musl"; + nodeName = "lightning-js.linux-x64-musl.node"; + }; + + # Linux ARM64 with musl (static, portable binary) + aarch64_unknown_linux_musl = mkCrossPackage { + crossSystem = { config = "aarch64-unknown-linux-musl"; }; + target = "aarch64-unknown-linux-musl"; + nodeName = "lightning-js.linux-arm64-musl.node"; + extraFlags = "-C target-feature=+crt-static"; + }; + + # Android ARM64 (most modern Android devices) + aarch64_linux_android = mkAndroidPackage { + target = "aarch64-linux-android"; + nodeName = "lightning-js.android-arm64.node"; + androidAbi = "arm64-v8a"; + }; + + # Android ARMv7 (older 32-bit devices) + armv7_linux_androideabi = mkAndroidPackage { + target = "armv7-linux-androideabi"; + nodeName = "lightning-js.android-arm-eabi.node"; + androidAbi = "armeabi-v7a"; + }; + }; + + devShells.default = pkgs.mkShell { + name = "lightning-js-dev"; + + packages = with pkgs; [ + nodejs_22 # JavaScript runtime + yarn # Package manager + rustToolchain # Rust compiler and tools (from rust-toolchain.toml) + pkg-config # Finds system libraries + openssl # TLS library + mold # Fast linker (optional, improves build times) + gcc # C compiler for build scripts + just # Command runner (see justfile) + ]; + + # Tell pkg-config where to find OpenSSL headers and libraries + PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig"; + + # Enable Rust backtraces for debugging + RUST_BACKTRACE = "1"; + + shellHook = '' + echo "==========================================" + echo " Lightning JS Development Shell" + echo "==========================================" + echo "Rust: $(rustc --version)" + echo "Node: $(node --version)" + echo "" + echo "Run 'just' to see available build commands" + echo "==========================================" + ''; + }; + + # Nix code formatter (run via `nix fmt`) + formatter = pkgs.nixfmt-rfc-style; + } + ); +} diff --git a/justfile b/justfile new file mode 100644 index 0000000..67b8e12 --- /dev/null +++ b/justfile @@ -0,0 +1,51 @@ +# Lightning JS Build Commands +# Run `just` to see available commands +# Requires: Nix (https://nixos.org/download) + +# Default: show available commands +default: + @just --list + +# Build native release binary +build: + nix build + +# Build debug binary (faster, for testing) +build-debug: + nix build .#debug + +# Build all Linux targets +build-linux: build build-linux-arm64 build-linux-musl build-linux-arm64-musl + +# Build Linux ARM64 (glibc) +build-linux-arm64: + nix build .#aarch64_unknown_linux_gnu + +# Build Linux x64 (musl, static) +build-linux-musl: + nix build .#x86_64_unknown_linux_musl + +# Build Linux ARM64 (musl, static) +build-linux-arm64-musl: + nix build .#aarch64_unknown_linux_musl + +# Build Android ARM64 +build-android: + nix build .#aarch64_linux_android + +# Build Android ARMv7 +build-android-armv7: + nix build .#armv7_linux_androideabi + +# Build all Android targets +build-android-all: build-android build-android-arm + +# Run lints (clippy + rustfmt) +check: + nix flake check + +# Clean build artifacts +clean: + rm -rf node_modules + cargo clean + rm -f result diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..53713fb --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,15 @@ +[toolchain] +channel = "1.85.1" +components = ["rust-src", "rust-analyzer", "clippy", "rustfmt"] +targets = [ + "x86_64-unknown-linux-gnu", + "x86_64-unknown-linux-musl", + "aarch64-unknown-linux-gnu", + "aarch64-unknown-linux-musl", + "x86_64-apple-darwin", + "aarch64-apple-darwin", + "x86_64-pc-windows-gnu", + "i686-pc-windows-gnu", + "aarch64-linux-android", + "armv7-linux-androideabi", +] From d234a09f4bc5dbf44706551ead95e706be3b4bb7 Mon Sep 17 00:00:00 2001 From: amackillop Date: Mon, 19 Jan 2026 12:36:30 -0800 Subject: [PATCH 02/10] Fix Nix cross-compilation and native addon naming Added nativeNodeName mapping to determine correct NAPI-RS addon filename based on localSystem (x86_64-linux, aarch64-linux, x86_64-darwin, aarch64-darwin). This ensures Apple Silicon builds produce correctly named darwin-arm64.node files instead of being mislabeled as darwin-x64. Fixed musl builds failing with "target does not support cdylib": - Changed +crt-static to -crt-static for musl targets - Static CRT is incompatible with shared library (cdylib) output - Musl addons now dynamically link to musl.so Fixed cross/musl builds failing to find mold linker: - Added mold to nativeBuildInputs for mkCrossPackage - Changed CARGO_BUILD_RUSTFLAGS to RUSTFLAGS (priority #2) to override config.toml's target-specific flags (priority #3) - Include mold flag in RUSTFLAGS for musl/cross builds --- flake.nix | 155 +++++++++++++++++++++++++++++++++--------------------- justfile | 6 +-- 2 files changed, 97 insertions(+), 64 deletions(-) diff --git a/flake.nix b/flake.nix index ac99d45..4611d2c 100644 --- a/flake.nix +++ b/flake.nix @@ -42,6 +42,17 @@ # This improves caching by excluding unrelated files from the build hash. src = craneLib.cleanCargoSource ./.; + # Map Nix system to NAPI-RS node addon naming convention. + # The naming follows: {name}.{platform}-{arch}[-libc].node + nativeNodeName = + { + "x86_64-linux" = "lightning-js.linux-x64-gnu.node"; + "aarch64-linux" = "lightning-js.linux-arm64-gnu.node"; + "x86_64-darwin" = "lightning-js.darwin-x64.node"; + "aarch64-darwin" = "lightning-js.darwin-arm64.node"; + } + .${localSystem} or (throw "Unsupported system: ${localSystem}"); + # Build inputs shared across native builds and checks. # These are libraries linked into the final binary. commonBuildInputs = @@ -79,12 +90,13 @@ nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.isLinux [ pkgs.mold ]; # Libraries linked into the final binary - buildInputs = - [ openssl ] - ++ lib.optionals stdenv.isDarwin [ - darwin.apple_sdk.frameworks.Security - darwin.apple_sdk.frameworks.SystemConfiguration - ]; + buildInputs = [ + openssl + ] + ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.Security + darwin.apple_sdk.frameworks.SystemConfiguration + ]; # macOS minimum deployment target (matches CI) MACOSX_DEPLOYMENT_TARGET = lib.optionalString stdenv.isDarwin "10.13"; @@ -92,15 +104,15 @@ # Custom install phase for NAPI-RS native addon. # Cargo builds a cdylib (.so on Linux, .dylib on macOS). # Node.js expects native addons to have .node extension. - # The naming convention follows NAPI-RS: {name}.{platform}.node + # The naming convention follows NAPI-RS: {name}.{platform}-{arch}.node installPhaseCommand = '' mkdir -p $out/lib # Copy the shared library with NAPI-RS naming convention if [ -f target/release/liblightning_js.so ]; then - cp target/release/liblightning_js.so $out/lib/lightning-js.linux-x64-gnu.node + cp target/release/liblightning_js.so $out/lib/${nativeNodeName} elif [ -f target/release/liblightning_js.dylib ]; then - cp target/release/liblightning_js.dylib $out/lib/lightning-js.darwin-x64.node + cp target/release/liblightning_js.dylib $out/lib/${nativeNodeName} fi ''; } @@ -127,12 +139,13 @@ CARGO_PROFILE = "dev"; nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.isLinux [ pkgs.mold ]; - buildInputs = - [ openssl ] - ++ lib.optionals stdenv.isDarwin [ - darwin.apple_sdk.frameworks.Security - darwin.apple_sdk.frameworks.SystemConfiguration - ]; + buildInputs = [ + openssl + ] + ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.Security + darwin.apple_sdk.frameworks.SystemConfiguration + ]; MACOSX_DEPLOYMENT_TARGET = lib.optionalString stdenv.isDarwin "10.13"; @@ -141,9 +154,9 @@ mkdir -p $out/lib if [ -f target/debug/liblightning_js.so ]; then - cp target/debug/liblightning_js.so $out/lib/lightning-js.linux-x64-gnu.node + cp target/debug/liblightning_js.so $out/lib/${nativeNodeName} elif [ -f target/debug/liblightning_js.dylib ]; then - cp target/debug/liblightning_js.dylib $out/lib/lightning-js.darwin-x64.node + cp target/debug/liblightning_js.dylib $out/lib/${nativeNodeName} fi ''; } @@ -188,9 +201,17 @@ # Tell Cargo which target to build for CARGO_BUILD_TARGET = target; - CARGO_BUILD_RUSTFLAGS = extraFlags; - nativeBuildInputs = [ pkg-config ]; + # Use RUSTFLAGS (priority #2) to override config.toml's target-specific flags. + # For musl targets, we need -crt-static to allow cdylib output. + RUSTFLAGS = "-C link-arg=-fuse-ld=mold" + (if extraFlags != "" then " ${extraFlags}" else ""); + + # pkg-config runs at build time to locate openssl + # mold is required because .cargo/config.toml sets -fuse-ld=mold for Linux targets + nativeBuildInputs = [ + pkg-config + pkgs.mold + ]; buildInputs = [ openssl ]; # Find and copy the cross-compiled shared library. @@ -205,7 +226,9 @@ ) { }; # ============================================================ - # Cross-compilation helper for musl (static) targets + # Cross-compilation helper for musl targets + # Note: Uses dynamic musl (-crt-static) because cdylib (shared library) + # output is incompatible with static musl (+crt-static). # ============================================================ mkMuslPackage = { @@ -228,11 +251,18 @@ # Build for musl target CARGO_BUILD_TARGET = target; - # Link the C runtime statically for fully static binaries. - # This makes the binary portable across Linux distributions. - CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static"; + # Use RUSTFLAGS (priority #2) to override config.toml's target-specific flags. + # -crt-static: Required for cdylib output (musl defaults to +crt-static which + # is incompatible with shared libraries). The addon will depend on musl.so. + # -fuse-ld=mold: Fast linker (matches config.toml for consistency). + RUSTFLAGS = "-C target-feature=-crt-static -C link-arg=-fuse-ld=mold"; - nativeBuildInputs = with pkgs; [ pkg-config ]; + # pkg-config runs at build time to locate openssl + # mold is required because .cargo/config.toml sets -fuse-ld=mold for Linux targets + nativeBuildInputs = with pkgs; [ + pkg-config + mold + ]; # Use static versions of libraries for musl builds buildInputs = with pkgs.pkgsStatic; [ openssl ]; @@ -240,7 +270,7 @@ installPhaseCommand = '' mkdir -p $out/lib - # Find and copy the statically-linked shared library + # Find and copy the musl-linked shared library find target -name "liblightning_js.so" -exec cp {} $out/lib/${nodeName} \; 2>/dev/null || true ''; }; @@ -339,48 +369,51 @@ inherit nativePackage cargoClippy cargoFmt; }; - packages = - { - default = nativePackage; - debug = debugPackage; # Fast build without optimizations - } - # Cross-compilation packages are only available on Linux hosts - // pkgs.lib.optionalAttrs pkgs.stdenv.isLinux { - # Linux ARM64 with glibc (for standard Linux distros) - aarch64_unknown_linux_gnu = mkCrossPackage { - crossSystem = "aarch64-linux"; - target = "aarch64-unknown-linux-gnu"; - nodeName = "lightning-js.linux-arm64-gnu.node"; - }; + packages = { + default = nativePackage; + debug = debugPackage; # Fast build without optimizations + } + # Cross-compilation packages are only available on Linux hosts + // pkgs.lib.optionalAttrs pkgs.stdenv.isLinux { + # Linux ARM64 with glibc (for standard Linux distros) + aarch64_unknown_linux_gnu = mkCrossPackage { + crossSystem = "aarch64-linux"; + target = "aarch64-unknown-linux-gnu"; + nodeName = "lightning-js.linux-arm64-gnu.node"; + }; - # Linux x86_64 with musl (static, portable binary) - x86_64_unknown_linux_musl = mkMuslPackage { - target = "x86_64-unknown-linux-musl"; - nodeName = "lightning-js.linux-x64-musl.node"; - }; + # Linux x86_64 with musl (dynamically linked to musl.so) + x86_64_unknown_linux_musl = mkMuslPackage { + target = "x86_64-unknown-linux-musl"; + nodeName = "lightning-js.linux-x64-musl.node"; + }; - # Linux ARM64 with musl (static, portable binary) - aarch64_unknown_linux_musl = mkCrossPackage { - crossSystem = { config = "aarch64-unknown-linux-musl"; }; - target = "aarch64-unknown-linux-musl"; - nodeName = "lightning-js.linux-arm64-musl.node"; - extraFlags = "-C target-feature=+crt-static"; + # Linux ARM64 with musl (static, portable binary) + # Linux ARM64 with musl (dynamically linked to musl.so for cdylib compatibility) + aarch64_unknown_linux_musl = mkCrossPackage { + crossSystem = { + config = "aarch64-unknown-linux-musl"; }; + target = "aarch64-unknown-linux-musl"; + nodeName = "lightning-js.linux-arm64-musl.node"; + # -crt-static: Required for cdylib output (musl defaults to +crt-static) + extraFlags = "-C target-feature=-crt-static"; + }; - # Android ARM64 (most modern Android devices) - aarch64_linux_android = mkAndroidPackage { - target = "aarch64-linux-android"; - nodeName = "lightning-js.android-arm64.node"; - androidAbi = "arm64-v8a"; - }; + # Android ARM64 (most modern Android devices) + aarch64_linux_android = mkAndroidPackage { + target = "aarch64-linux-android"; + nodeName = "lightning-js.android-arm64.node"; + androidAbi = "arm64-v8a"; + }; - # Android ARMv7 (older 32-bit devices) - armv7_linux_androideabi = mkAndroidPackage { - target = "armv7-linux-androideabi"; - nodeName = "lightning-js.android-arm-eabi.node"; - androidAbi = "armeabi-v7a"; - }; + # Android ARMv7 (older 32-bit devices) + armv7_linux_androideabi = mkAndroidPackage { + target = "armv7-linux-androideabi"; + nodeName = "lightning-js.android-arm-eabi.node"; + androidAbi = "armeabi-v7a"; }; + }; devShells.default = pkgs.mkShell { name = "lightning-js-dev"; diff --git a/justfile b/justfile index 67b8e12..1eaee5e 100644 --- a/justfile +++ b/justfile @@ -21,11 +21,11 @@ build-linux: build build-linux-arm64 build-linux-musl build-linux-arm64-musl build-linux-arm64: nix build .#aarch64_unknown_linux_gnu -# Build Linux x64 (musl, static) +# Build Linux x64 (musl) build-linux-musl: nix build .#x86_64_unknown_linux_musl -# Build Linux ARM64 (musl, static) +# Build Linux ARM64 (musl) build-linux-arm64-musl: nix build .#aarch64_unknown_linux_musl @@ -38,7 +38,7 @@ build-android-armv7: nix build .#armv7_linux_androideabi # Build all Android targets -build-android-all: build-android build-android-arm +build-android-all: build-android build-android-armv7 # Run lints (clippy + rustfmt) check: From fafee549d434cd6c0be236f19ec050e4962ea0f5 Mon Sep 17 00:00:00 2001 From: amackillop Date: Mon, 19 Jan 2026 13:13:24 -0800 Subject: [PATCH 03/10] Fix Darwin SDK and update macOS CI runner Fixed Darwin builds failing with "apple_sdk_11_0 has been removed": - Migrated from darwin.apple_sdk.frameworks to apple-sdk.frameworks - Updated MACOSX_DEPLOYMENT_TARGET from 10.13 to 11.0 Updated GitHub Actions workflow: - Removed macos-13 runner (retired by GitHub) - macOS builds now use macos-15 (arm64 only) --- .github/workflows/nix.yml | 14 +++----------- flake.nix | 38 +++++++++++++++++++++----------------- 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index edef922..4b53733 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -109,17 +109,9 @@ jobs: if-no-files-found: error build-macos: - name: Build - macOS ${{ matrix.arch }} - runs-on: ${{ matrix.runner }} + name: Build - macOS arm64 + runs-on: macos-latest needs: check - strategy: - fail-fast: false - matrix: - include: - - runner: macos-13 - arch: x64 - - runner: macos-14 - arch: arm64 steps: - uses: actions/checkout@v4 @@ -140,7 +132,7 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: bindings-darwin-${{ matrix.arch }} + name: bindings-darwin-arm64 path: result/lib/*.node if-no-files-found: error diff --git a/flake.nix b/flake.nix index 4611d2c..d16b7ce 100644 --- a/flake.nix +++ b/flake.nix @@ -58,11 +58,13 @@ commonBuildInputs = with pkgs; [ openssl ] - ++ lib.optionals stdenv.isDarwin [ - # macOS requires these frameworks for network/TLS operations - darwin.apple_sdk.frameworks.Security - darwin.apple_sdk.frameworks.SystemConfiguration - ]; + ++ lib.optionals stdenv.isDarwin ( + with apple-sdk.frameworks; [ + # macOS requires these frameworks for network/TLS operations + Security + SystemConfiguration + ] + ); # ============================================================ # Native build for the current system @@ -76,7 +78,6 @@ openssl, pkg-config, stdenv, - darwin, }: craneLib.buildPackage { inherit src; @@ -93,13 +94,15 @@ buildInputs = [ openssl ] - ++ lib.optionals stdenv.isDarwin [ - darwin.apple_sdk.frameworks.Security - darwin.apple_sdk.frameworks.SystemConfiguration - ]; + ++ lib.optionals stdenv.isDarwin ( + with pkgs.apple-sdk.frameworks; [ + Security + SystemConfiguration + ] + ); # macOS minimum deployment target (matches CI) - MACOSX_DEPLOYMENT_TARGET = lib.optionalString stdenv.isDarwin "10.13"; + MACOSX_DEPLOYMENT_TARGET = lib.optionalString stdenv.isDarwin "11.0"; # Custom install phase for NAPI-RS native addon. # Cargo builds a cdylib (.so on Linux, .dylib on macOS). @@ -127,7 +130,6 @@ openssl, pkg-config, stdenv, - darwin, }: craneLib.buildPackage { inherit src; @@ -142,12 +144,14 @@ buildInputs = [ openssl ] - ++ lib.optionals stdenv.isDarwin [ - darwin.apple_sdk.frameworks.Security - darwin.apple_sdk.frameworks.SystemConfiguration - ]; + ++ lib.optionals stdenv.isDarwin ( + with pkgs.apple-sdk.frameworks; [ + Security + SystemConfiguration + ] + ); - MACOSX_DEPLOYMENT_TARGET = lib.optionalString stdenv.isDarwin "10.13"; + MACOSX_DEPLOYMENT_TARGET = lib.optionalString stdenv.isDarwin "11.0"; # Debug builds output to target/debug/ installPhaseCommand = '' From 85c1f4e25ef07614ca49aa4de1bc59ddc78a40ec Mon Sep 17 00:00:00 2001 From: amackillop Date: Mon, 19 Jan 2026 13:35:05 -0800 Subject: [PATCH 04/10] Refactor flake.nix to reduce duplication Consolidate repeated patterns and improve organization: - Extract mkNativePackage helper for release/debug builds - Unify mkCrossPackage to handle both glibc and musl targets - Scope check-only definitions (checkBuildInputs, cargoArtifacts) into a local let block within the checks output - Extract mkInstallPhase and mkCrossInstallPhase helpers - Remove dead code: unused profile variable, no-op conditionals - Fix Darwin builds: use darwin.apple_sdk.frameworks path - Update formatter from deprecated nixfmt-rfc-style to nixfmt --- .github/workflows/nix.yml | 4 +- flake.nix | 477 ++++++++++++++++---------------------- 2 files changed, 198 insertions(+), 283 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 4b53733..179c5f0 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -31,7 +31,7 @@ jobs: - name: Check flake uses: DeterminateSystems/flake-checker-action@main - - name: Run checks (clippy, rustfmt) + - name: Run checks (clippy, rustfmt, build) run: nix flake check build-linux: @@ -42,7 +42,7 @@ jobs: fail-fast: false matrix: target: - - default + - x86_64_unknown_linux_gnu - aarch64_unknown_linux_gnu - x86_64_unknown_linux_musl - aarch64_unknown_linux_musl diff --git a/flake.nix b/flake.nix index d16b7ce..958a394 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,8 @@ overlays = [ (import rust-overlay) ]; }; + inherit (pkgs) lib stdenv; + # Load Rust toolchain configuration from rust-toolchain.toml. # This ensures consistency between local development (rustup) and Nix builds. # See: https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file @@ -53,148 +55,110 @@ } .${localSystem} or (throw "Unsupported system: ${localSystem}"); - # Build inputs shared across native builds and checks. - # These are libraries linked into the final binary. - commonBuildInputs = - with pkgs; - [ openssl ] - ++ lib.optionals stdenv.isDarwin ( - with apple-sdk.frameworks; [ - # macOS requires these frameworks for network/TLS operations - Security - SystemConfiguration - ] - ); - - # ============================================================ - # Native build for the current system - # ============================================================ - nativePackage = pkgs.callPackage ( - # Using callPackage for proper "splicing" - Nix automatically - # provides the correct versions of dependencies for the target platform. - # See: https://crane.dev/examples/cross-rust-overlay.html - { - lib, - openssl, - pkg-config, - stdenv, - }: - craneLib.buildPackage { - inherit src; - pname = "lightning-js"; - - # Enforce strict separation between build-time and runtime deps - strictDeps = true; - - # pkg-config runs at build time to locate openssl - # mold is a fast linker for ELF binaries (Linux targets only, not macOS Mach-O) - nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.isLinux [ pkgs.mold ]; - - # Libraries linked into the final binary - buildInputs = [ - openssl - ] - ++ lib.optionals stdenv.isDarwin ( - with pkgs.apple-sdk.frameworks; [ - Security - SystemConfiguration - ] - ); + # Generate install phase command for copying the built library + mkInstallPhase = + { nodeName, targetDir }: + '' + mkdir -p $out/lib + # Copy the shared library with NAPI-RS naming convention + # Cargo builds a cdylib (.so on Linux, .dylib on macOS) + # Node.js expects native addons to have .node extension + if [ -f ${targetDir}/liblightning_js.so ]; then + cp ${targetDir}/liblightning_js.so $out/lib/${nodeName} + elif [ -f ${targetDir}/liblightning_js.dylib ]; then + cp ${targetDir}/liblightning_js.dylib $out/lib/${nodeName} + fi + ''; - # macOS minimum deployment target (matches CI) - MACOSX_DEPLOYMENT_TARGET = lib.optionalString stdenv.isDarwin "11.0"; - - # Custom install phase for NAPI-RS native addon. - # Cargo builds a cdylib (.so on Linux, .dylib on macOS). - # Node.js expects native addons to have .node extension. - # The naming convention follows NAPI-RS: {name}.{platform}-{arch}.node - installPhaseCommand = '' - mkdir -p $out/lib - - # Copy the shared library with NAPI-RS naming convention - if [ -f target/release/liblightning_js.so ]; then - cp target/release/liblightning_js.so $out/lib/${nativeNodeName} - elif [ -f target/release/liblightning_js.dylib ]; then - cp target/release/liblightning_js.dylib $out/lib/${nativeNodeName} - fi - ''; - } - ) { }; + # Generate install phase for cross-compiled builds (searches target directory) + mkCrossInstallPhase = + nodeName: + '' + mkdir -p $out/lib + find target -name "liblightning_js.so" -exec cp {} $out/lib/${nodeName} \; 2>/dev/null || true + ''; # ============================================================ - # Debug build (faster compilation, no optimizations) + # Native build helper (release or debug) # ============================================================ - debugPackage = pkgs.callPackage ( - { - lib, - openssl, - pkg-config, - stdenv, - }: - craneLib.buildPackage { - inherit src; - pname = "lightning-js"; - strictDeps = true; + mkNativePackage = + { isDebug ? false }: + let + targetDir = "target/${if isDebug then "debug" else "release"}"; + in + pkgs.callPackage ( + # Using callPackage for proper "splicing" - Nix automatically + # provides the correct versions of dependencies for the target platform. + # See: https://crane.dev/examples/cross-rust-overlay.html + { + lib, + openssl, + pkg-config, + stdenv, + }: + craneLib.buildPackage { + inherit src; + pname = "lightning-js"; + strictDeps = true; - # Build in debug mode (no --release flag) - cargoExtraArgs = ""; - CARGO_PROFILE = "dev"; - - nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.isLinux [ pkgs.mold ]; - buildInputs = [ - openssl - ] - ++ lib.optionals stdenv.isDarwin ( - with pkgs.apple-sdk.frameworks; [ - Security - SystemConfiguration - ] - ); + # Set profile for debug builds (Crane defaults to release) + CARGO_PROFILE = lib.optionalString isDebug "dev"; - MACOSX_DEPLOYMENT_TARGET = lib.optionalString stdenv.isDarwin "11.0"; + nativeBuildInputs = + [ pkg-config ] + ++ lib.optionals stdenv.isLinux [ pkgs.mold ]; - # Debug builds output to target/debug/ - installPhaseCommand = '' - mkdir -p $out/lib + buildInputs = + [ openssl ] + ++ lib.optionals stdenv.isDarwin ( + with pkgs.darwin.apple_sdk.frameworks; [ Security SystemConfiguration ] + ); - if [ -f target/debug/liblightning_js.so ]; then - cp target/debug/liblightning_js.so $out/lib/${nativeNodeName} - elif [ -f target/debug/liblightning_js.dylib ]; then - cp target/debug/liblightning_js.dylib $out/lib/${nativeNodeName} - fi - ''; - } - ) { }; + # macOS minimum deployment target (matches CI) + MACOSX_DEPLOYMENT_TARGET = lib.optionalString stdenv.isDarwin "11.0"; + + installPhaseCommand = mkInstallPhase { + nodeName = nativeNodeName; + inherit targetDir; + }; + } + ) { }; # ============================================================ - # Cross-compilation helper for glibc targets + # Cross-compilation helper for Linux targets (glibc and musl) # ============================================================ mkCrossPackage = { - crossSystem, # Nix cross-compilation system (e.g., "aarch64-linux") + crossSystem, # Nix cross-compilation system (e.g., "aarch64-linux" or attrset) target, # Rust target triple (e.g., "aarch64-unknown-linux-gnu") nodeName, # Output filename for the .node addon - extraFlags ? "", # Additional RUSTFLAGS for compilation + extraRustFlags ? "", # Additional RUSTFLAGS for compilation + useStaticLibs ? false, # Use pkgsStatic for musl builds + isMuslNative ? false, # Build musl on native system (no cross pkgs) }: let - # Import nixpkgs configured for cross-compilation. - # localSystem = build machine, crossSystem = target machine. - crossPkgs = import nixpkgs { - inherit localSystem crossSystem; - overlays = [ (import rust-overlay) ]; - }; - - # Create Crane lib for cross target. - # Using a function ensures proper toolchain splicing for cross-compilation. + # For musl native builds, use regular pkgs; for cross builds, configure cross-compilation + crossPkgs = + if isMuslNative then + pkgs + else + import nixpkgs { + inherit localSystem crossSystem; + overlays = [ (import rust-overlay) ]; + }; + + # Create Crane lib for cross target crossCraneLib = (crane.mkLib crossPkgs).overrideToolchain ( p: p.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml ); + + # Base RUSTFLAGS: always use mold linker for Linux + baseRustFlags = "-C link-arg=-fuse-ld=mold"; + rustFlags = + if extraRustFlags != "" then "${baseRustFlags} ${extraRustFlags}" else baseRustFlags; in crossPkgs.callPackage ( - { - openssl, - pkg-config, - }: + { openssl, pkg-config }: crossCraneLib.buildPackage { src = crossCraneLib.cleanCargoSource ./.; pname = "lightning-js"; @@ -203,90 +167,23 @@ # Skip tests - can't run cross-compiled binaries on build host doCheck = false; - # Tell Cargo which target to build for CARGO_BUILD_TARGET = target; + RUSTFLAGS = rustFlags; - # Use RUSTFLAGS (priority #2) to override config.toml's target-specific flags. - # For musl targets, we need -crt-static to allow cdylib output. - RUSTFLAGS = "-C link-arg=-fuse-ld=mold" + (if extraFlags != "" then " ${extraFlags}" else ""); - - # pkg-config runs at build time to locate openssl - # mold is required because .cargo/config.toml sets -fuse-ld=mold for Linux targets - nativeBuildInputs = [ - pkg-config - pkgs.mold - ]; - buildInputs = [ openssl ]; - - # Find and copy the cross-compiled shared library. - # The library is in target/{target}/release/ for cross builds. - installPhaseCommand = '' - mkdir -p $out/lib - - # Use find to locate the .so file in the target-specific directory - find target -name "liblightning_js.so" -exec cp {} $out/lib/${nodeName} \; 2>/dev/null || true - ''; + nativeBuildInputs = [ pkg-config pkgs.mold ]; + buildInputs = if useStaticLibs then [ pkgs.pkgsStatic.openssl ] else [ openssl ]; + + installPhaseCommand = mkCrossInstallPhase nodeName; } ) { }; # ============================================================ - # Cross-compilation helper for musl targets - # Note: Uses dynamic musl (-crt-static) because cdylib (shared library) - # output is incompatible with static musl (+crt-static). - # ============================================================ - mkMuslPackage = - { - target, # Rust target triple (e.g., "x86_64-unknown-linux-musl") - nodeName, # Output filename for the .node addon - }: - let - muslCraneLib = (crane.mkLib pkgs).overrideToolchain ( - p: p.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml - ); - in - muslCraneLib.buildPackage { - inherit src; - pname = "lightning-js"; - strictDeps = true; - - # Skip tests for cross-compiled targets - doCheck = false; - - # Build for musl target - CARGO_BUILD_TARGET = target; - - # Use RUSTFLAGS (priority #2) to override config.toml's target-specific flags. - # -crt-static: Required for cdylib output (musl defaults to +crt-static which - # is incompatible with shared libraries). The addon will depend on musl.so. - # -fuse-ld=mold: Fast linker (matches config.toml for consistency). - RUSTFLAGS = "-C target-feature=-crt-static -C link-arg=-fuse-ld=mold"; - - # pkg-config runs at build time to locate openssl - # mold is required because .cargo/config.toml sets -fuse-ld=mold for Linux targets - nativeBuildInputs = with pkgs; [ - pkg-config - mold - ]; - - # Use static versions of libraries for musl builds - buildInputs = with pkgs.pkgsStatic; [ openssl ]; - - installPhaseCommand = '' - mkdir -p $out/lib - - # Find and copy the musl-linked shared library - find target -name "liblightning_js.so" -exec cp {} $out/lib/${nodeName} \; 2>/dev/null || true - ''; - }; - - # ============================================================ - # Cross-compilation helper for Android targets + # Android cross-compilation helper # ============================================================ mkAndroidPackage = { target, # Rust target triple (e.g., "aarch64-linux-android") nodeName, # Output filename for the .node addon - androidAbi, # Android ABI (e.g., "arm64-v8a") }: let # Android NDK requires unfree license acceptance @@ -297,127 +194,149 @@ overlays = [ (import rust-overlay) ]; }; - # Android NDK from nixpkgs androidNdk = androidPkgs.androidenv.androidPkgs.ndk-bundle; androidCraneLib = (crane.mkLib androidPkgs).overrideToolchain ( p: p.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml ); - # NDK toolchain paths - # Using API 28+ for getentropy() support required by aws-lc-sys + # NDK toolchain paths - API 28+ for getentropy() support (required by aws-lc-sys) ndkToolchain = "${androidNdk}/libexec/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64"; apiLevel = "28"; + + # Map target triple to NDK binary prefix + ndkPrefix = + { + "aarch64-linux-android" = "aarch64-linux-android"; + "armv7-linux-androideabi" = "armv7a-linux-androideabi"; + } + .${target}; + + # Map target triple to Cargo environment variable format (underscores, uppercase for linker) + cargoEnvTarget = + { + "aarch64-linux-android" = { + lower = "aarch64_linux_android"; + upper = "AARCH64_LINUX_ANDROID"; + }; + "armv7-linux-androideabi" = { + lower = "armv7_linux_androideabi"; + upper = "ARMV7_LINUX_ANDROIDEABI"; + }; + } + .${target}; in androidCraneLib.buildPackage { inherit src; pname = "lightning-js"; strictDeps = true; - # Skip tests - can't run Android binaries on Linux doCheck = false; - # Tell Cargo which target to build for CARGO_BUILD_TARGET = target; - - # Android NDK environment variables ANDROID_NDK_HOME = "${androidNdk}/libexec/android-sdk/ndk-bundle"; - CC_aarch64_linux_android = "${ndkToolchain}/bin/aarch64-linux-android${apiLevel}-clang"; - CXX_aarch64_linux_android = "${ndkToolchain}/bin/aarch64-linux-android${apiLevel}-clang++"; - AR_aarch64_linux_android = "${ndkToolchain}/bin/llvm-ar"; - CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER = "${ndkToolchain}/bin/aarch64-linux-android${apiLevel}-clang"; - CC_armv7_linux_androideabi = "${ndkToolchain}/bin/armv7a-linux-androideabi${apiLevel}-clang"; - CXX_armv7_linux_androideabi = "${ndkToolchain}/bin/armv7a-linux-androideabi${apiLevel}-clang++"; - AR_armv7_linux_androideabi = "${ndkToolchain}/bin/llvm-ar"; - CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER = "${ndkToolchain}/bin/armv7a-linux-androideabi${apiLevel}-clang"; + # Set CC, CXX, AR, and linker for the specific target + "CC_${cargoEnvTarget.lower}" = "${ndkToolchain}/bin/${ndkPrefix}${apiLevel}-clang"; + "CXX_${cargoEnvTarget.lower}" = "${ndkToolchain}/bin/${ndkPrefix}${apiLevel}-clang++"; + "AR_${cargoEnvTarget.lower}" = "${ndkToolchain}/bin/llvm-ar"; + "CARGO_TARGET_${cargoEnvTarget.upper}_LINKER" = "${ndkToolchain}/bin/${ndkPrefix}${apiLevel}-clang"; - nativeBuildInputs = with pkgs; [ pkg-config ]; + nativeBuildInputs = [ pkgs.pkg-config ]; - installPhaseCommand = '' - mkdir -p $out/lib - - # Find and copy the Android shared library - find target -name "liblightning_js.so" -exec cp {} $out/lib/${nodeName} \; 2>/dev/null || true - ''; + installPhaseCommand = mkCrossInstallPhase nodeName; }; # ============================================================ # Checks (run via `nix flake check`) # ============================================================ + checks = + let + # Build inputs only used for checks (not for package builds, which use callPackage splicing) + checkBuildInputs = + [ pkgs.openssl ] + ++ lib.optionals stdenv.isDarwin ( + with pkgs.darwin.apple_sdk.frameworks; [ Security SystemConfiguration ] + ); + checkNativeBuildInputs = + [ pkgs.pkg-config ] + ++ lib.optionals stdenv.isLinux [ pkgs.mold ]; + + # Pre-build dependencies only (cached separately from source changes) + cargoArtifacts = craneLib.buildDepsOnly { + inherit src; + pname = "lightning-js"; + nativeBuildInputs = checkNativeBuildInputs; + buildInputs = checkBuildInputs; + }; + in + { + clippy = craneLib.cargoClippy { + inherit src cargoArtifacts; + pname = "lightning-js"; + cargoClippyExtraArgs = "--all-targets -- --deny warnings"; + nativeBuildInputs = checkNativeBuildInputs; + buildInputs = checkBuildInputs; + }; - # Pre-build dependencies only (cached separately from source changes). - # This speeds up incremental builds significantly. - cargoArtifacts = craneLib.buildDepsOnly { - inherit src; - pname = "lightning-js"; - # mold links ELF (Linux targets only) - nativeBuildInputs = with pkgs; [ pkg-config ] ++ lib.optionals stdenv.isLinux [ mold ]; - buildInputs = commonBuildInputs; - }; + fmt = craneLib.cargoFmt { inherit src; }; - # Run clippy linter with warnings as errors - cargoClippy = craneLib.cargoClippy { - inherit src cargoArtifacts; - pname = "lightning-js"; - cargoClippyExtraArgs = "--all-targets -- --deny warnings"; - nativeBuildInputs = with pkgs; [ pkg-config ] ++ lib.optionals stdenv.isLinux [ mold ]; - buildInputs = commonBuildInputs; - }; + # Also verify the package builds + build = nativePackage; + }; - # Check code formatting with rustfmt - cargoFmt = craneLib.cargoFmt { inherit src; }; + # Instantiate native packages + nativePackage = mkNativePackage { }; + debugPackage = mkNativePackage { isDebug = true; }; in { - checks = { - inherit nativePackage cargoClippy cargoFmt; - }; + inherit checks; - packages = { - default = nativePackage; - debug = debugPackage; # Fast build without optimizations - } - # Cross-compilation packages are only available on Linux hosts - // pkgs.lib.optionalAttrs pkgs.stdenv.isLinux { - # Linux ARM64 with glibc (for standard Linux distros) - aarch64_unknown_linux_gnu = mkCrossPackage { - crossSystem = "aarch64-linux"; - target = "aarch64-unknown-linux-gnu"; - nodeName = "lightning-js.linux-arm64-gnu.node"; - }; + packages = + { + default = nativePackage; + debug = debugPackage; + } + # Cross-compilation packages are only available on Linux hosts + // lib.optionalAttrs stdenv.isLinux { + # Linux ARM64 with glibc (standard Linux distros) + aarch64_unknown_linux_gnu = mkCrossPackage { + crossSystem = "aarch64-linux"; + target = "aarch64-unknown-linux-gnu"; + nodeName = "lightning-js.linux-arm64-gnu.node"; + }; - # Linux x86_64 with musl (dynamically linked to musl.so) - x86_64_unknown_linux_musl = mkMuslPackage { - target = "x86_64-unknown-linux-musl"; - nodeName = "lightning-js.linux-x64-musl.node"; - }; + # Linux x86_64 with musl (dynamically linked to musl.so) + # Note: Uses -crt-static because cdylib output is incompatible with static musl + x86_64_unknown_linux_musl = mkCrossPackage { + crossSystem = localSystem; + target = "x86_64-unknown-linux-musl"; + nodeName = "lightning-js.linux-x64-musl.node"; + extraRustFlags = "-C target-feature=-crt-static"; + useStaticLibs = true; + isMuslNative = true; + }; - # Linux ARM64 with musl (static, portable binary) - # Linux ARM64 with musl (dynamically linked to musl.so for cdylib compatibility) - aarch64_unknown_linux_musl = mkCrossPackage { - crossSystem = { - config = "aarch64-unknown-linux-musl"; + # Linux ARM64 with musl (dynamically linked to musl.so for cdylib compatibility) + aarch64_unknown_linux_musl = mkCrossPackage { + crossSystem = { config = "aarch64-unknown-linux-musl"; }; + target = "aarch64-unknown-linux-musl"; + nodeName = "lightning-js.linux-arm64-musl.node"; + extraRustFlags = "-C target-feature=-crt-static"; }; - target = "aarch64-unknown-linux-musl"; - nodeName = "lightning-js.linux-arm64-musl.node"; - # -crt-static: Required for cdylib output (musl defaults to +crt-static) - extraFlags = "-C target-feature=-crt-static"; - }; - # Android ARM64 (most modern Android devices) - aarch64_linux_android = mkAndroidPackage { - target = "aarch64-linux-android"; - nodeName = "lightning-js.android-arm64.node"; - androidAbi = "arm64-v8a"; - }; + # Android ARM64 (modern Android devices) + aarch64_linux_android = mkAndroidPackage { + target = "aarch64-linux-android"; + nodeName = "lightning-js.android-arm64.node"; + }; - # Android ARMv7 (older 32-bit devices) - armv7_linux_androideabi = mkAndroidPackage { - target = "armv7-linux-androideabi"; - nodeName = "lightning-js.android-arm-eabi.node"; - androidAbi = "armeabi-v7a"; + # Android ARMv7 (older 32-bit devices) + armv7_linux_androideabi = mkAndroidPackage { + target = "armv7-linux-androideabi"; + nodeName = "lightning-js.android-arm-eabi.node"; + }; }; - }; devShells.default = pkgs.mkShell { name = "lightning-js-dev"; @@ -433,10 +352,7 @@ just # Command runner (see justfile) ]; - # Tell pkg-config where to find OpenSSL headers and libraries PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig"; - - # Enable Rust backtraces for debugging RUST_BACKTRACE = "1"; shellHook = '' @@ -451,8 +367,7 @@ ''; }; - # Nix code formatter (run via `nix fmt`) - formatter = pkgs.nixfmt-rfc-style; + formatter = pkgs.nixfmt; } ); } From ba56724de863285bc425fff7546ec8c3b2694001 Mon Sep 17 00:00:00 2001 From: amackillop Date: Mon, 19 Jan 2026 14:53:33 -0800 Subject: [PATCH 05/10] Fix darwin build and improve CI package evaluation Remove darwin.apple_sdk.frameworks references which have been removed from nixpkgs as legacy compatibility stubs. The default SDK now includes Security and SystemConfiguration frameworks automatically. Remove explicit MACOSX_DEPLOYMENT_TARGET since it was out of sync with the nixpkgs SDK default (14.0). Let nixpkgs use its default darwinMinVersion which matches the SDK. Update CI to use 'default' package for x86_64 glibc builds since the native build on ubuntu runners is the x86_64-unknown-linux-gnu target. Add upfront evaluation check with --all-systems --no-build to catch cross-platform issues like this before running full builds. --- .github/workflows/nix.yml | 9 ++++++++- flake.nix | 15 ++------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 179c5f0..7085c6a 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -31,6 +31,9 @@ jobs: - name: Check flake uses: DeterminateSystems/flake-checker-action@main + - name: Verify all packages evaluate + run: nix flake check --all-systems --no-build + - name: Run checks (clippy, rustfmt, build) run: nix flake check @@ -46,6 +49,10 @@ jobs: - aarch64_unknown_linux_gnu - x86_64_unknown_linux_musl - aarch64_unknown_linux_musl + include: + # x86_64 glibc uses 'default' - the native build on ubuntu runners + - target: x86_64_unknown_linux_gnu + package: default steps: - uses: actions/checkout@v4 @@ -56,7 +63,7 @@ jobs: uses: DeterminateSystems/magic-nix-cache-action@main - name: Build ${{ matrix.target }} - run: nix build .#${{ matrix.target }} --print-out-paths + run: nix build .#${{ matrix.package || matrix.target }} --print-out-paths - name: List output run: | diff --git a/flake.nix b/flake.nix index 958a394..1593554 100644 --- a/flake.nix +++ b/flake.nix @@ -108,14 +108,7 @@ [ pkg-config ] ++ lib.optionals stdenv.isLinux [ pkgs.mold ]; - buildInputs = - [ openssl ] - ++ lib.optionals stdenv.isDarwin ( - with pkgs.darwin.apple_sdk.frameworks; [ Security SystemConfiguration ] - ); - - # macOS minimum deployment target (matches CI) - MACOSX_DEPLOYMENT_TARGET = lib.optionalString stdenv.isDarwin "11.0"; + buildInputs = [ openssl ]; installPhaseCommand = mkInstallPhase { nodeName = nativeNodeName; @@ -253,11 +246,7 @@ checks = let # Build inputs only used for checks (not for package builds, which use callPackage splicing) - checkBuildInputs = - [ pkgs.openssl ] - ++ lib.optionals stdenv.isDarwin ( - with pkgs.darwin.apple_sdk.frameworks; [ Security SystemConfiguration ] - ); + checkBuildInputs = [ pkgs.openssl ]; checkNativeBuildInputs = [ pkgs.pkg-config ] ++ lib.optionals stdenv.isLinux [ pkgs.mold ]; From 29c7275935f116266b74aea2256f2ed4d91ab166 Mon Sep 17 00:00:00 2001 From: amackillop Date: Mon, 19 Jan 2026 15:36:27 -0800 Subject: [PATCH 06/10] Fix install phase to find library in Crane output Use find to locate liblightning_js.so/.dylib instead of hardcoding the target directory path. Crane's build environment may place outputs in different locations than a regular cargo build. Consolidate mkInstallPhase and mkCrossInstallPhase since both now use the same find-based approach. --- flake.nix | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/flake.nix b/flake.nix index 1593554..a894f8c 100644 --- a/flake.nix +++ b/flake.nix @@ -56,36 +56,24 @@ .${localSystem} or (throw "Unsupported system: ${localSystem}"); # Generate install phase command for copying the built library + # Uses find to locate the library since Crane may place it in various locations mkInstallPhase = - { nodeName, targetDir }: + nodeName: '' mkdir -p $out/lib - # Copy the shared library with NAPI-RS naming convention + # Find and copy the shared library with NAPI-RS naming convention # Cargo builds a cdylib (.so on Linux, .dylib on macOS) # Node.js expects native addons to have .node extension - if [ -f ${targetDir}/liblightning_js.so ]; then - cp ${targetDir}/liblightning_js.so $out/lib/${nodeName} - elif [ -f ${targetDir}/liblightning_js.dylib ]; then - cp ${targetDir}/liblightning_js.dylib $out/lib/${nodeName} + if ! find target -name "liblightning_js.so" -exec cp {} $out/lib/${nodeName} \; 2>/dev/null; then + find target -name "liblightning_js.dylib" -exec cp {} $out/lib/${nodeName} \; 2>/dev/null || true fi ''; - # Generate install phase for cross-compiled builds (searches target directory) - mkCrossInstallPhase = - nodeName: - '' - mkdir -p $out/lib - find target -name "liblightning_js.so" -exec cp {} $out/lib/${nodeName} \; 2>/dev/null || true - ''; - # ============================================================ # Native build helper (release or debug) # ============================================================ mkNativePackage = { isDebug ? false }: - let - targetDir = "target/${if isDebug then "debug" else "release"}"; - in pkgs.callPackage ( # Using callPackage for proper "splicing" - Nix automatically # provides the correct versions of dependencies for the target platform. @@ -110,10 +98,7 @@ buildInputs = [ openssl ]; - installPhaseCommand = mkInstallPhase { - nodeName = nativeNodeName; - inherit targetDir; - }; + installPhaseCommand = mkInstallPhase nativeNodeName; } ) { }; @@ -166,7 +151,7 @@ nativeBuildInputs = [ pkg-config pkgs.mold ]; buildInputs = if useStaticLibs then [ pkgs.pkgsStatic.openssl ] else [ openssl ]; - installPhaseCommand = mkCrossInstallPhase nodeName; + installPhaseCommand = mkInstallPhase nodeName; } ) { }; @@ -237,7 +222,7 @@ nativeBuildInputs = [ pkgs.pkg-config ]; - installPhaseCommand = mkCrossInstallPhase nodeName; + installPhaseCommand = mkInstallPhase nodeName; }; # ============================================================ From 3ceae26bf5178a806dd1a4ad9f4da37e6dde5b14 Mon Sep 17 00:00:00 2001 From: amackillop Date: Mon, 19 Jan 2026 18:21:05 -0800 Subject: [PATCH 07/10] Add Crane dependency caching for faster builds Extracted buildDepsOnly derivations for all targets so dependencies are cached separately from source code. When only source changes, subsequent builds skip dependency compilation entirely. - Native release package and checks share nativeCargoArtifacts - Debug builds use separate debugCargoArtifacts (different profile) - Cross and Android targets each cache their own dependencies - Refactored to use shared commonArgs patterns --- flake.nix | 263 +++++++++++++++++++++++++++--------------------------- 1 file changed, 130 insertions(+), 133 deletions(-) diff --git a/flake.nix b/flake.nix index a894f8c..a4a086f 100644 --- a/flake.nix +++ b/flake.nix @@ -57,50 +57,51 @@ # Generate install phase command for copying the built library # Uses find to locate the library since Crane may place it in various locations - mkInstallPhase = - nodeName: - '' - mkdir -p $out/lib - # Find and copy the shared library with NAPI-RS naming convention - # Cargo builds a cdylib (.so on Linux, .dylib on macOS) - # Node.js expects native addons to have .node extension - if ! find target -name "liblightning_js.so" -exec cp {} $out/lib/${nodeName} \; 2>/dev/null; then - find target -name "liblightning_js.dylib" -exec cp {} $out/lib/${nodeName} \; 2>/dev/null || true - fi - ''; + mkInstallPhase = nodeName: '' + mkdir -p $out/lib + # Find and copy the shared library with NAPI-RS naming convention + # Cargo builds a cdylib (.so on Linux, .dylib on macOS) + # Node.js expects native addons to have .node extension + if ! find target -name "liblightning_js.so" -exec cp {} $out/lib/${nodeName} \; 2>/dev/null; then + find target -name "liblightning_js.dylib" -exec cp {} $out/lib/${nodeName} \; 2>/dev/null || true + fi + ''; + + # ============================================================ + # Native build configuration (shared between packages and checks) + # ============================================================ + nativeCommonArgs = { + inherit src; + pname = "lightning-js"; + strictDeps = true; + nativeBuildInputs = [ pkgs.pkg-config ] ++ lib.optionals stdenv.isLinux [ pkgs.mold ]; + buildInputs = [ pkgs.openssl ]; + }; + + # Shared dependency derivation for native release builds and checks + nativeCargoArtifacts = craneLib.buildDepsOnly nativeCommonArgs; + + # Separate debug deps (different profile = different artifacts) + debugCargoArtifacts = craneLib.buildDepsOnly (nativeCommonArgs // { CARGO_PROFILE = "dev"; }); # ============================================================ # Native build helper (release or debug) # ============================================================ mkNativePackage = - { isDebug ? false }: - pkgs.callPackage ( - # Using callPackage for proper "splicing" - Nix automatically - # provides the correct versions of dependencies for the target platform. - # See: https://crane.dev/examples/cross-rust-overlay.html - { - lib, - openssl, - pkg-config, - stdenv, - }: - craneLib.buildPackage { - inherit src; - pname = "lightning-js"; - strictDeps = true; + { + isDebug ? false, + }: + craneLib.buildPackage ( + nativeCommonArgs + // { + cargoArtifacts = if isDebug then debugCargoArtifacts else nativeCargoArtifacts; # Set profile for debug builds (Crane defaults to release) CARGO_PROFILE = lib.optionalString isDebug "dev"; - nativeBuildInputs = - [ pkg-config ] - ++ lib.optionals stdenv.isLinux [ pkgs.mold ]; - - buildInputs = [ openssl ]; - installPhaseCommand = mkInstallPhase nativeNodeName; } - ) { }; + ); # ============================================================ # Cross-compilation helper for Linux targets (glibc and musl) @@ -132,28 +133,34 @@ # Base RUSTFLAGS: always use mold linker for Linux baseRustFlags = "-C link-arg=-fuse-ld=mold"; - rustFlags = - if extraRustFlags != "" then "${baseRustFlags} ${extraRustFlags}" else baseRustFlags; - in - crossPkgs.callPackage ( - { openssl, pkg-config }: - crossCraneLib.buildPackage { - src = crossCraneLib.cleanCargoSource ./.; - pname = "lightning-js"; - strictDeps = true; + rustFlags = if extraRustFlags != "" then "${baseRustFlags} ${extraRustFlags}" else baseRustFlags; - # Skip tests - can't run cross-compiled binaries on build host - doCheck = false; + crossSrc = crossCraneLib.cleanCargoSource ./.; + commonArgs = { + src = crossSrc; + pname = "lightning-js-${target}"; + strictDeps = true; + doCheck = false; CARGO_BUILD_TARGET = target; RUSTFLAGS = rustFlags; + nativeBuildInputs = [ + crossPkgs.pkg-config + pkgs.mold + ]; + buildInputs = if useStaticLibs then [ pkgs.pkgsStatic.openssl ] else [ crossPkgs.openssl ]; + }; - nativeBuildInputs = [ pkg-config pkgs.mold ]; - buildInputs = if useStaticLibs then [ pkgs.pkgsStatic.openssl ] else [ openssl ]; - + # Build dependencies separately for better caching + cargoArtifacts = crossCraneLib.buildDepsOnly commonArgs; + in + crossCraneLib.buildPackage ( + commonArgs + // { + inherit cargoArtifacts; installPhaseCommand = mkInstallPhase nodeName; } - ) { }; + ); # ============================================================ # Android cross-compilation helper @@ -203,61 +210,50 @@ }; } .${target}; - in - androidCraneLib.buildPackage { - inherit src; - pname = "lightning-js"; - strictDeps = true; - - doCheck = false; - - CARGO_BUILD_TARGET = target; - ANDROID_NDK_HOME = "${androidNdk}/libexec/android-sdk/ndk-bundle"; - # Set CC, CXX, AR, and linker for the specific target - "CC_${cargoEnvTarget.lower}" = "${ndkToolchain}/bin/${ndkPrefix}${apiLevel}-clang"; - "CXX_${cargoEnvTarget.lower}" = "${ndkToolchain}/bin/${ndkPrefix}${apiLevel}-clang++"; - "AR_${cargoEnvTarget.lower}" = "${ndkToolchain}/bin/llvm-ar"; - "CARGO_TARGET_${cargoEnvTarget.upper}_LINKER" = "${ndkToolchain}/bin/${ndkPrefix}${apiLevel}-clang"; - - nativeBuildInputs = [ pkgs.pkg-config ]; + commonArgs = { + inherit src; + pname = "lightning-js-${target}"; + strictDeps = true; + doCheck = false; + CARGO_BUILD_TARGET = target; + ANDROID_NDK_HOME = "${androidNdk}/libexec/android-sdk/ndk-bundle"; + "CC_${cargoEnvTarget.lower}" = "${ndkToolchain}/bin/${ndkPrefix}${apiLevel}-clang"; + "CXX_${cargoEnvTarget.lower}" = "${ndkToolchain}/bin/${ndkPrefix}${apiLevel}-clang++"; + "AR_${cargoEnvTarget.lower}" = "${ndkToolchain}/bin/llvm-ar"; + "CARGO_TARGET_${cargoEnvTarget.upper}_LINKER" = "${ndkToolchain}/bin/${ndkPrefix}${apiLevel}-clang"; + nativeBuildInputs = [ pkgs.pkg-config ]; + }; - installPhaseCommand = mkInstallPhase nodeName; - }; + # Build dependencies separately for better caching + cargoArtifacts = androidCraneLib.buildDepsOnly commonArgs; + in + androidCraneLib.buildPackage ( + commonArgs + // { + inherit cargoArtifacts; + installPhaseCommand = mkInstallPhase nodeName; + } + ); # ============================================================ # Checks (run via `nix flake check`) + # Reuses nativeCargoArtifacts for faster CI when package is also built # ============================================================ - checks = - let - # Build inputs only used for checks (not for package builds, which use callPackage splicing) - checkBuildInputs = [ pkgs.openssl ]; - checkNativeBuildInputs = - [ pkgs.pkg-config ] - ++ lib.optionals stdenv.isLinux [ pkgs.mold ]; - - # Pre-build dependencies only (cached separately from source changes) - cargoArtifacts = craneLib.buildDepsOnly { - inherit src; - pname = "lightning-js"; - nativeBuildInputs = checkNativeBuildInputs; - buildInputs = checkBuildInputs; - }; - in - { - clippy = craneLib.cargoClippy { - inherit src cargoArtifacts; - pname = "lightning-js"; + checks = { + clippy = craneLib.cargoClippy ( + nativeCommonArgs + // { + cargoArtifacts = nativeCargoArtifacts; cargoClippyExtraArgs = "--all-targets -- --deny warnings"; - nativeBuildInputs = checkNativeBuildInputs; - buildInputs = checkBuildInputs; - }; + } + ); - fmt = craneLib.cargoFmt { inherit src; }; + fmt = craneLib.cargoFmt { inherit src; }; - # Also verify the package builds - build = nativePackage; - }; + # Also verify the package builds + build = nativePackage; + }; # Instantiate native packages nativePackage = mkNativePackage { }; @@ -266,51 +262,52 @@ { inherit checks; - packages = - { - default = nativePackage; - debug = debugPackage; - } - # Cross-compilation packages are only available on Linux hosts - // lib.optionalAttrs stdenv.isLinux { - # Linux ARM64 with glibc (standard Linux distros) - aarch64_unknown_linux_gnu = mkCrossPackage { - crossSystem = "aarch64-linux"; - target = "aarch64-unknown-linux-gnu"; - nodeName = "lightning-js.linux-arm64-gnu.node"; - }; + packages = { + default = nativePackage; + debug = debugPackage; + } + # Cross-compilation packages are only available on Linux hosts + // lib.optionalAttrs stdenv.isLinux { + # Linux ARM64 with glibc (standard Linux distros) + aarch64_unknown_linux_gnu = mkCrossPackage { + crossSystem = "aarch64-linux"; + target = "aarch64-unknown-linux-gnu"; + nodeName = "lightning-js.linux-arm64-gnu.node"; + }; - # Linux x86_64 with musl (dynamically linked to musl.so) - # Note: Uses -crt-static because cdylib output is incompatible with static musl - x86_64_unknown_linux_musl = mkCrossPackage { - crossSystem = localSystem; - target = "x86_64-unknown-linux-musl"; - nodeName = "lightning-js.linux-x64-musl.node"; - extraRustFlags = "-C target-feature=-crt-static"; - useStaticLibs = true; - isMuslNative = true; - }; + # Linux x86_64 with musl (dynamically linked to musl.so) + # Note: Uses -crt-static because cdylib output is incompatible with static musl + x86_64_unknown_linux_musl = mkCrossPackage { + crossSystem = localSystem; + target = "x86_64-unknown-linux-musl"; + nodeName = "lightning-js.linux-x64-musl.node"; + extraRustFlags = "-C target-feature=-crt-static"; + useStaticLibs = true; + isMuslNative = true; + }; - # Linux ARM64 with musl (dynamically linked to musl.so for cdylib compatibility) - aarch64_unknown_linux_musl = mkCrossPackage { - crossSystem = { config = "aarch64-unknown-linux-musl"; }; - target = "aarch64-unknown-linux-musl"; - nodeName = "lightning-js.linux-arm64-musl.node"; - extraRustFlags = "-C target-feature=-crt-static"; + # Linux ARM64 with musl (dynamically linked to musl.so for cdylib compatibility) + aarch64_unknown_linux_musl = mkCrossPackage { + crossSystem = { + config = "aarch64-unknown-linux-musl"; }; + target = "aarch64-unknown-linux-musl"; + nodeName = "lightning-js.linux-arm64-musl.node"; + extraRustFlags = "-C target-feature=-crt-static"; + }; - # Android ARM64 (modern Android devices) - aarch64_linux_android = mkAndroidPackage { - target = "aarch64-linux-android"; - nodeName = "lightning-js.android-arm64.node"; - }; + # Android ARM64 (modern Android devices) + aarch64_linux_android = mkAndroidPackage { + target = "aarch64-linux-android"; + nodeName = "lightning-js.android-arm64.node"; + }; - # Android ARMv7 (older 32-bit devices) - armv7_linux_androideabi = mkAndroidPackage { - target = "armv7-linux-androideabi"; - nodeName = "lightning-js.android-arm-eabi.node"; - }; + # Android ARMv7 (older 32-bit devices) + armv7_linux_androideabi = mkAndroidPackage { + target = "armv7-linux-androideabi"; + nodeName = "lightning-js.android-arm-eabi.node"; }; + }; devShells.default = pkgs.mkShell { name = "lightning-js-dev"; From ff6a51e0d7cea7d28a9586660511758c39c900ac Mon Sep 17 00:00:00 2001 From: amackillop Date: Mon, 19 Jan 2026 18:48:31 -0800 Subject: [PATCH 08/10] Remove armv7 Android target and limit CI parallelism Removed armv7-linux-androideabi build target from both the Nix flake and GitHub Actions workflow. This 32-bit ARM target is increasingly rare on modern Android devices. Added max-parallel: 3 to the Linux build matrix to reduce concurrent jobs hitting the GitHub Actions Cache, which was causing Magic Nix Cache throttling errors (HTTP 418). --- .github/workflows/nix.yml | 2 +- flake.nix | 11 ----------- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 7085c6a..cbf5216 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -43,6 +43,7 @@ jobs: needs: check strategy: fail-fast: false + max-parallel: 3 matrix: target: - x86_64_unknown_linux_gnu @@ -86,7 +87,6 @@ jobs: matrix: target: - aarch64_linux_android - - armv7_linux_androideabi steps: - uses: actions/checkout@v4 diff --git a/flake.nix b/flake.nix index a4a086f..53ac866 100644 --- a/flake.nix +++ b/flake.nix @@ -193,7 +193,6 @@ ndkPrefix = { "aarch64-linux-android" = "aarch64-linux-android"; - "armv7-linux-androideabi" = "armv7a-linux-androideabi"; } .${target}; @@ -204,10 +203,6 @@ lower = "aarch64_linux_android"; upper = "AARCH64_LINUX_ANDROID"; }; - "armv7-linux-androideabi" = { - lower = "armv7_linux_androideabi"; - upper = "ARMV7_LINUX_ANDROIDEABI"; - }; } .${target}; @@ -301,12 +296,6 @@ target = "aarch64-linux-android"; nodeName = "lightning-js.android-arm64.node"; }; - - # Android ARMv7 (older 32-bit devices) - armv7_linux_androideabi = mkAndroidPackage { - target = "armv7-linux-androideabi"; - nodeName = "lightning-js.android-arm-eabi.node"; - }; }; devShells.default = pkgs.mkShell { From a1e94034829a62fac55867fbdf5209266e5ebef7 Mon Sep 17 00:00:00 2001 From: amackillop Date: Mon, 19 Jan 2026 19:16:55 -0800 Subject: [PATCH 09/10] Consolidate Android build into Linux matrix job Merge the separate build-android job into build-linux by adding aarch64_linux_android to the target matrix. This simplifies the workflow and reduces duplication. Also refactor build-macos to use a matrix pattern for consistency and future extensibility. Remove max-parallel limit from build-linux to allow faster CI runs. --- .github/workflows/nix.yml | 46 ++++++--------------------------------- 1 file changed, 7 insertions(+), 39 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index cbf5216..c9d591a 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -43,13 +43,13 @@ jobs: needs: check strategy: fail-fast: false - max-parallel: 3 matrix: target: - x86_64_unknown_linux_gnu - aarch64_unknown_linux_gnu - x86_64_unknown_linux_musl - aarch64_unknown_linux_musl + - aarch64_linux_android include: # x86_64 glibc uses 'default' - the native build on ubuntu runners - target: x86_64_unknown_linux_gnu @@ -78,47 +78,16 @@ jobs: path: result/lib/*.node if-no-files-found: error - build-android: + build-macos: name: Build - ${{ matrix.target }} - runs-on: ubuntu-latest + runs-on: ${{ matrix.runner }} needs: check strategy: fail-fast: false matrix: - target: - - aarch64_linux_android - steps: - - uses: actions/checkout@v4 - - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main - with: - extra-conf: | - extra-substituters = https://cache.nixos.org - extra-trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= - - - name: Enable Nix cache - uses: DeterminateSystems/magic-nix-cache-action@main - - - name: Build ${{ matrix.target }} - run: nix build .#${{ matrix.target }} --print-out-paths - - - name: List output - run: | - ls -la result/lib/ - file result/lib/*.node - - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: bindings-${{ matrix.target }} - path: result/lib/*.node - if-no-files-found: error - - build-macos: - name: Build - macOS arm64 - runs-on: macos-latest - needs: check + include: + - target: darwin-arm64 + runner: macos-latest steps: - uses: actions/checkout@v4 @@ -139,7 +108,7 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: bindings-darwin-arm64 + name: bindings-${{ matrix.target }} path: result/lib/*.node if-no-files-found: error @@ -151,7 +120,6 @@ jobs: needs: - check - build-linux - - build-android - build-macos steps: - uses: actions/checkout@v4 From 23f2927f453d8cb93f146da9053628126f8e951b Mon Sep 17 00:00:00 2001 From: amackillop Date: Mon, 19 Jan 2026 19:28:10 -0800 Subject: [PATCH 10/10] Limit CI parallelism and improve install phase error handling Add max-parallel: 1 to build-linux matrix to prevent concurrent jobs from overwhelming the Magic Nix Cache. Refactor mkInstallPhase to properly detect missing library files and fail with a clear error message instead of silently succeeding. --- .github/workflows/nix.yml | 1 + flake.nix | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index c9d591a..ad8d558 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -43,6 +43,7 @@ jobs: needs: check strategy: fail-fast: false + max-parallel: 1 matrix: target: - x86_64_unknown_linux_gnu diff --git a/flake.nix b/flake.nix index 53ac866..5e312b4 100644 --- a/flake.nix +++ b/flake.nix @@ -62,8 +62,18 @@ # Find and copy the shared library with NAPI-RS naming convention # Cargo builds a cdylib (.so on Linux, .dylib on macOS) # Node.js expects native addons to have .node extension - if ! find target -name "liblightning_js.so" -exec cp {} $out/lib/${nodeName} \; 2>/dev/null; then - find target -name "liblightning_js.dylib" -exec cp {} $out/lib/${nodeName} \; 2>/dev/null || true + found="" + for ext in so dylib; do + lib=$(find target -name "liblightning_js.$ext" -type f | head -1) + if [ -n "$lib" ]; then + cp "$lib" "$out/lib/${nodeName}" + found=1 + break + fi + done + if [ -z "$found" ]; then + echo "ERROR: Could not find liblightning_js.so or liblightning_js.dylib" + exit 1 fi '';