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.
This commit is contained in:
+21
-22
@@ -2,33 +2,37 @@
|
|||||||
, stdenvNoCC
|
, stdenvNoCC
|
||||||
, nodejs_22
|
, nodejs_22
|
||||||
, nodejs-slim_22
|
, nodejs-slim_22
|
||||||
|
, fetchNodeModules
|
||||||
, fetchurl
|
, fetchurl
|
||||||
, makeWrapper
|
, makeWrapper
|
||||||
}:
|
}:
|
||||||
|
let self = stdenvNoCC.mkDerivation {
|
||||||
let
|
pname = "rtl";
|
||||||
version = "0.15.8";
|
version = "0.15.8";
|
||||||
|
|
||||||
src = fetchurl {
|
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=";
|
hash = "sha256-8XdGyORxB2dkZRB/Yl7zh+Quqo4L/Y0VmC6Brbr/hqU=";
|
||||||
};
|
};
|
||||||
|
|
||||||
in stdenvNoCC.mkDerivation {
|
passthru = {
|
||||||
pname = "rtl";
|
nodejs = nodejs_22;
|
||||||
inherit version src;
|
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 = [
|
nativeBuildInputs = [
|
||||||
makeWrapper
|
makeWrapper
|
||||||
nodejs_22
|
|
||||||
];
|
];
|
||||||
|
|
||||||
phases = "unpackPhase buildPhase installPhase";
|
phases = "unpackPhase patchPhase installPhase";
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
# Install dependencies using npm ci (requires package-lock.json)
|
|
||||||
npm ci --legacy-peer-deps --ignore-scripts
|
|
||||||
'';
|
|
||||||
|
|
||||||
# `src` already contains the precompiled frontend and backend.
|
# `src` already contains the precompiled frontend and backend.
|
||||||
# Copy all files required for packaging, like in
|
# Copy all files required for packaging, like in
|
||||||
@@ -41,25 +45,20 @@ in stdenvNoCC.mkDerivation {
|
|||||||
package.json \
|
package.json \
|
||||||
frontend \
|
frontend \
|
||||||
backend \
|
backend \
|
||||||
node_modules \
|
${self.nodeModules}/lib/node_modules \
|
||||||
$dest
|
$dest
|
||||||
|
|
||||||
makeWrapper ${nodejs-slim_22}/bin/node "$out/bin/rtl" \
|
makeWrapper ${self.nodejsRuntime}/bin/node "$out/bin/rtl" \
|
||||||
--add-flags "$dest/rtl.js"
|
--add-flags "$dest/rtl.js"
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru = {
|
|
||||||
nodejs = nodejs_22;
|
|
||||||
nodejsRuntime = nodejs-slim_22;
|
|
||||||
};
|
|
||||||
|
|
||||||
meta = with lib; {
|
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";
|
homepage = "https://github.com/Ride-The-Lightning/RTL";
|
||||||
license = licenses.mit;
|
license = licenses.mit;
|
||||||
maintainers = with maintainers; [ ];
|
maintainers = with maintainers; [ ];
|
||||||
platforms = platforms.unix;
|
platforms = platforms.unix;
|
||||||
};
|
};
|
||||||
}
|
}; in self
|
||||||
|
|||||||
Reference in New Issue
Block a user