RTL: switch to buildNpmPackage with placeholder npmDepsHash
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.
This commit is contained in:
+23
-21
@@ -1,38 +1,35 @@
|
|||||||
{ lib
|
{ lib
|
||||||
, stdenvNoCC
|
, buildNpmPackage
|
||||||
, nodejs_22
|
, nodejs_22
|
||||||
, nodejs-slim_22
|
, nodejs-slim_22
|
||||||
, fetchNodeModules
|
|
||||||
, fetchurl
|
, fetchurl
|
||||||
, makeWrapper
|
, makeWrapper
|
||||||
}:
|
}:
|
||||||
let self = stdenvNoCC.mkDerivation {
|
|
||||||
pname = "rtl";
|
let
|
||||||
version = "0.15.8";
|
version = "0.15.8";
|
||||||
|
|
||||||
src = fetchurl {
|
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=";
|
hash = "sha256-8XdGyORxB2dkZRB/Yl7zh+Quqo4L/Y0VmC6Brbr/hqU=";
|
||||||
};
|
};
|
||||||
|
|
||||||
passthru = {
|
in buildNpmPackage {
|
||||||
nodejs = nodejs_22;
|
pname = "rtl";
|
||||||
nodejsRuntime = nodejs-slim_22;
|
inherit version src;
|
||||||
|
|
||||||
nodeModules = fetchNodeModules {
|
# Placeholder: build once, then replace with the hash from the
|
||||||
inherit (self) src nodejs;
|
# "hash mismatch" error output.
|
||||||
# TODO-EXTERNAL: Remove `npmFlags` when no longer required
|
npmDepsHash = lib.fakeHash;
|
||||||
# See: https://github.com/Ride-The-Lightning/RTL/issues/1182
|
|
||||||
npmFlags = "--legacy-peer-deps";
|
npmFlags = [ "--legacy-peer-deps" ];
|
||||||
hash = "sha256-oMqd6nLzS6iQ9w4z2yzpR2unA5qhOq5YdvfoS8IgYLY=";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
makeWrapper
|
makeWrapper
|
||||||
];
|
];
|
||||||
|
|
||||||
phases = "unpackPhase patchPhase installPhase";
|
dontNpmBuild = true;
|
||||||
|
dontNpmInstall = true;
|
||||||
|
|
||||||
# `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
|
||||||
@@ -45,20 +42,25 @@ let self = stdenvNoCC.mkDerivation {
|
|||||||
package.json \
|
package.json \
|
||||||
frontend \
|
frontend \
|
||||||
backend \
|
backend \
|
||||||
${self.nodeModules}/lib/node_modules \
|
node_modules \
|
||||||
$dest
|
$dest
|
||||||
|
|
||||||
makeWrapper ${self.nodejsRuntime}/bin/node "$out/bin/rtl" \
|
makeWrapper ${nodejs-slim_22}/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, c-lightning and Eclair";
|
description = "A web interface for LND";
|
||||||
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