From 228a48af030e602fc6e135b6a789cd6ebd2bba21 Mon Sep 17 00:00:00 2001 From: Sovran Systems <99053422+naturallaw777@users.noreply.github.com> Date: Mon, 10 Aug 2026 12:41:51 -0500 Subject: [PATCH] RTL: switch to buildNpmPackage with placeholder npmDepsHash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit buildNpmPackage is built into nixpkgs and pre-fetches dependencies as a fixed-output derivation with network access. npmDepsHash is a placeholder (lib.fakeHash) — the first build will fail with a hash mismatch that reports the correct hash. --- packages/rtl/default.nix | 44 +++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/packages/rtl/default.nix b/packages/rtl/default.nix index 9d12889..aa9fde0 100644 --- a/packages/rtl/default.nix +++ b/packages/rtl/default.nix @@ -1,38 +1,35 @@ { lib -, stdenvNoCC +, buildNpmPackage , nodejs_22 , nodejs-slim_22 -, fetchNodeModules , fetchurl , makeWrapper }: -let self = stdenvNoCC.mkDerivation { - pname = "rtl"; + +let version = "0.15.8"; src = fetchurl { - url = "https://github.com/Ride-The-Lightning/RTL/archive/refs/tags/v${self.version}.tar.gz"; + url = "https://github.com/Ride-The-Lightning/RTL/archive/refs/tags/v${version}.tar.gz"; hash = "sha256-8XdGyORxB2dkZRB/Yl7zh+Quqo4L/Y0VmC6Brbr/hqU="; }; - passthru = { - nodejs = nodejs_22; - nodejsRuntime = nodejs-slim_22; +in buildNpmPackage { + pname = "rtl"; + inherit version src; - 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="; - }; - }; + # Placeholder: build once, then replace with the hash from the + # "hash mismatch" error output. + npmDepsHash = lib.fakeHash; + + npmFlags = [ "--legacy-peer-deps" ]; nativeBuildInputs = [ makeWrapper ]; - phases = "unpackPhase patchPhase installPhase"; + dontNpmBuild = true; + dontNpmInstall = true; # `src` already contains the precompiled frontend and backend. # Copy all files required for packaging, like in @@ -45,20 +42,25 @@ let self = stdenvNoCC.mkDerivation { package.json \ frontend \ backend \ - ${self.nodeModules}/lib/node_modules \ + node_modules \ $dest - makeWrapper ${self.nodejsRuntime}/bin/node "$out/bin/rtl" \ + makeWrapper ${nodejs-slim_22}/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, c-lightning and Eclair"; + description = "A web interface for LND"; homepage = "https://github.com/Ride-The-Lightning/RTL"; license = licenses.mit; maintainers = with maintainers; [ ]; platforms = platforms.unix; }; -}; in self +}