nix-bitcoin/pkgs/clightning-rest/default.nix

56 lines
1.3 KiB
Nix
Raw Permalink Normal View History

{ lib
, stdenvNoCC
, nodejs-16_x
, nodejs-slim-16_x
, fetchNodeModules
, fetchurl
, makeWrapper
, rsync
}:
let self = stdenvNoCC.mkDerivation {
pname = "clightning-rest";
2022-08-27 05:08:48 -07:00
version = "0.9.0";
src = fetchurl {
url = "https://github.com/Ride-The-Lightning/c-lightning-REST/archive/refs/tags/v${self.version}.tar.gz";
2022-08-27 05:08:48 -07:00
hash = "sha256-1thorV/UivDDH7oqjfm8VTd47LYSGooR2yEoETgBOH4=";
};
passthru = {
nodejs = nodejs-16_x;
nodejsRuntime = nodejs-slim-16_x;
nodeModules = fetchNodeModules {
inherit (self) src nodejs;
2022-08-27 05:08:48 -07:00
hash = "sha256-rQrAt2BDmNMUCVWxTJN3qoPonKlRWeJ8C4ZvF/gPygk=";
};
};
nativeBuildInputs = [
2021-12-14 10:51:22 -08:00
makeWrapper
];
phases = "unpackPhase patchPhase installPhase";
installPhase = ''
dest=$out/lib/node_modules/clightning-rest
mkdir -p $dest
${rsync}/bin/rsync -a --inplace * ${self.nodeModules}/lib/node_modules \
--exclude=/{screenshots,'*.Dockerfile'} \
$dest
makeWrapper ${self.nodejsRuntime}/bin/node "$out/bin/cl-rest" \
--add-flags "$dest/cl-rest.js"
runHook postInstall
2021-12-14 10:51:22 -08:00
'';
meta = with lib; {
description = "REST API for C-Lightning";
homepage = "https://github.com/Ride-The-Lightning/c-lightning-REST";
license = licenses.mit;
maintainers = with maintainers; [ nixbitcoin erikarvstedt ];
platforms = platforms.unix;
};
}; in self