From 0df4cde9b8ffe96dcb06abf4d5ebeea8b7d73b4c Mon Sep 17 00:00:00 2001 From: Sovran Systems <99053422+naturallaw777@users.noreply.github.com> Date: Mon, 10 Aug 2026 12:36:58 -0500 Subject: [PATCH] Fix RTL: use fetchNodeModules instead of npm ci in buildPhase npm ci in buildPhase hangs because the Nix build sandbox has no network access. Adopt nix-bitcoin's approach: fetchNodeModules pre-fetches node_modules as a fixed-output derivation (which has network access), and the main build copies them offline. Uses the same node_modules hash as upstream nix-bitcoin for RTL 0.15.8. --- packages/rtl/default.nix | 43 ++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/packages/rtl/default.nix b/packages/rtl/default.nix index 0e11351..9d12889 100644 --- a/packages/rtl/default.nix +++ b/packages/rtl/default.nix @@ -2,33 +2,37 @@ , stdenvNoCC , nodejs_22 , nodejs-slim_22 +, fetchNodeModules , fetchurl , makeWrapper }: - -let +let self = stdenvNoCC.mkDerivation { + pname = "rtl"; version = "0.15.8"; src = fetchurl { - url = "https://github.com/Ride-The-Lightning/RTL/archive/refs/tags/v${version}.tar.gz"; + url = "https://github.com/Ride-The-Lightning/RTL/archive/refs/tags/v${self.version}.tar.gz"; hash = "sha256-8XdGyORxB2dkZRB/Yl7zh+Quqo4L/Y0VmC6Brbr/hqU="; }; -in stdenvNoCC.mkDerivation { - pname = "rtl"; - inherit version src; + passthru = { + nodejs = nodejs_22; + nodejsRuntime = nodejs-slim_22; + + nodeModules = fetchNodeModules { + inherit (self) src nodejs; + # TODO-EXTERNAL: Remove `npmFlags` when no longer required + # See: https://github.com/Ride-The-Lightning/RTL/issues/1182 + npmFlags = "--legacy-peer-deps"; + hash = "sha256-oMqd6nLzS6iQ9w4z2yzpR2unA5qhOq5YdvfoS8IgYLY="; + }; + }; nativeBuildInputs = [ makeWrapper - nodejs_22 ]; - phases = "unpackPhase buildPhase installPhase"; - - buildPhase = '' - # Install dependencies using npm ci (requires package-lock.json) - npm ci --legacy-peer-deps --ignore-scripts - ''; + phases = "unpackPhase patchPhase installPhase"; # `src` already contains the precompiled frontend and backend. # Copy all files required for packaging, like in @@ -41,25 +45,20 @@ in stdenvNoCC.mkDerivation { package.json \ frontend \ backend \ - node_modules \ + ${self.nodeModules}/lib/node_modules \ $dest - makeWrapper ${nodejs-slim_22}/bin/node "$out/bin/rtl" \ + makeWrapper ${self.nodejsRuntime}/bin/node "$out/bin/rtl" \ --add-flags "$dest/rtl.js" runHook postInstall ''; - passthru = { - nodejs = nodejs_22; - nodejsRuntime = nodejs-slim_22; - }; - meta = with lib; { - description = "A web interface for LND"; + description = "A web interface for LND, c-lightning and Eclair"; homepage = "https://github.com/Ride-The-Lightning/RTL"; license = licenses.mit; maintainers = with maintainers; [ ]; platforms = platforms.unix; }; -} +}; in self