cl-rest: 0.7.2 -> 0.8.0
- Use `fetch-node-modules` - Only use nodejs-slim as a runtime dependency
This commit is contained in:
parent
617ed4c8e8
commit
53dd2a1ae2
@ -1,17 +0,0 @@
|
||||
# This file has been generated by node2nix 1.9.0. Do not edit!
|
||||
|
||||
{pkgs ? import <nixpkgs> {
|
||||
inherit system;
|
||||
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-12_x"}:
|
||||
|
||||
let
|
||||
nodeEnv = import "${toString pkgs.path}/pkgs/development/node-packages/node-env.nix" {
|
||||
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
|
||||
inherit pkgs nodejs;
|
||||
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
|
||||
};
|
||||
in
|
||||
import ./node-packages.nix {
|
||||
inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
|
||||
inherit nodeEnv;
|
||||
}
|
@ -1,16 +1,48 @@
|
||||
{ pkgs, lib, makeWrapper }:
|
||||
let
|
||||
inherit (pkgs) nodejs;
|
||||
nodePackages = import ./composition.nix { inherit pkgs nodejs; };
|
||||
in
|
||||
nodePackages.package.overrideAttrs (old: {
|
||||
nativeBuildInputs = (old.nativeBuildInputs or []) ++ [
|
||||
{ lib
|
||||
, stdenvNoCC
|
||||
, nodejs-16_x
|
||||
, nodejs-slim-16_x
|
||||
, fetchNodeModules
|
||||
, fetchurl
|
||||
, makeWrapper
|
||||
, rsync
|
||||
}:
|
||||
let self = stdenvNoCC.mkDerivation {
|
||||
pname = "clightning-rest";
|
||||
version = "0.8.0";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/Ride-The-Lightning/c-lightning-REST/archive/refs/tags/v${self.version}.tar.gz";
|
||||
hash = "sha256-Rg0/lN7exNFlsMj+HQcFwVqNRzCd1ztu56q5VIkglko=";
|
||||
};
|
||||
|
||||
passthru = {
|
||||
nodejs = nodejs-16_x;
|
||||
nodejsRuntime = nodejs-slim-16_x;
|
||||
|
||||
nodeModules = fetchNodeModules {
|
||||
inherit (self) src nodejs;
|
||||
hash = "sha256-aG60RANqmWQ4sbm450MS2DWEoRksjj9/z6PoKBLtDB4=";
|
||||
};
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
makeWrapper ${nodejs}/bin/node $out/bin/cl-rest \
|
||||
--add-flags $out/lib/node_modules/c-lightning-rest/cl-rest
|
||||
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
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
@ -20,4 +52,4 @@ nodePackages.package.overrideAttrs (old: {
|
||||
maintainers = with maintainers; [ nixbitcoin earvstedt ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
})
|
||||
}; in self
|
||||
|
@ -1,44 +1,40 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p nodePackages.node2nix gnupg wget jq gnused
|
||||
#! nix-shell -i bash -p gnupg wget gnused
|
||||
set -euo pipefail
|
||||
|
||||
TMPDIR="$(mktemp -d -p /tmp)"
|
||||
trap "rm -rf $TMPDIR" EXIT
|
||||
|
||||
version="0.7.2"
|
||||
version="0.8.0"
|
||||
repo=https://github.com/Ride-The-Lightning/c-lightning-REST
|
||||
|
||||
scriptDir=$(cd "${BASH_SOURCE[0]%/*}" && pwd)
|
||||
|
||||
updateSrc() {
|
||||
TMPDIR="$(mktemp -d /tmp/clightning-rest.XXX)"
|
||||
trap "rm -rf $TMPDIR" EXIT
|
||||
|
||||
# Fetch and verify source tarball
|
||||
file=v${version}.tar.gz
|
||||
url=$repo/archive/refs/tags/$file
|
||||
export GNUPGHOME=$TMPDIR
|
||||
# Fetch saubyk's key
|
||||
gpg --keyserver hkps://keyserver.ubuntu.com --recv-key 3E9BD4436C288039CA827A9200C9E2BC2E45666F
|
||||
wget -P $TMPDIR $url
|
||||
file=v${version}.tar.gz
|
||||
wget -P $TMPDIR $repo/archive/refs/tags/$file
|
||||
wget -P $TMPDIR $repo/releases/download/v${version}/$file.asc
|
||||
gpg --verify $TMPDIR/$file.asc $TMPDIR/$file
|
||||
hash=$(nix hash file $TMPDIR/$file)
|
||||
|
||||
# Extract source
|
||||
src=$TMPDIR/src
|
||||
mkdir $src
|
||||
tar xvf $TMPDIR/$file -C $src --strip-components 1 >/dev/null
|
||||
sed -i "
|
||||
s|\bversion = .*;|version = \"$version\";|
|
||||
s|\bhash = .*;|hash = \"$hash\";|
|
||||
" default.nix
|
||||
}
|
||||
|
||||
# Generate nix pkg
|
||||
node2nix \
|
||||
--input $src/package.json \
|
||||
--lock $src/package-lock.json \
|
||||
--composition composition.nix \
|
||||
--no-copy-node-env
|
||||
updateNodeModulesHash() {
|
||||
$scriptDir/../../helper/update-fixed-output-derivation.sh ./default.nix clightning-rest.nodeModules nodeModules
|
||||
}
|
||||
|
||||
# Use node-env.nix from nixpkgs
|
||||
nodeEnvImport='import "${toString pkgs.path}/pkgs/development/node-packages/node-env.nix"'
|
||||
sed -i "s|import ./node-env.nix|$nodeEnvImport|" composition.nix
|
||||
|
||||
# Use the verified package src
|
||||
read -d '' fetchurl <<EOF || :
|
||||
fetchurl {
|
||||
url = "$url";
|
||||
hash = "$hash";
|
||||
};
|
||||
EOF
|
||||
sed -i "s|src = .*/src;|src = ${fetchurl//$'\n'/\\n}|" node-packages.nix
|
||||
if [[ $# == 0 ]]; then
|
||||
# Each of these can be run separately
|
||||
updateSrc
|
||||
updateNodeModulesHash
|
||||
else
|
||||
eval "$@"
|
||||
fi
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,3 +0,0 @@
|
||||
[
|
||||
{ "c-lightning-REST": "file:./package" }
|
||||
]
|
@ -10,7 +10,7 @@ in
|
||||
}
|
||||
}:
|
||||
let self = {
|
||||
clightning-rest = pkgs.callPackage ./clightning-rest { };
|
||||
clightning-rest = pkgs.callPackage ./clightning-rest { inherit (self) fetchNodeModules; };
|
||||
clboss = pkgs.callPackage ./clboss { };
|
||||
clightning-plugins = pkgs.recurseIntoAttrs (import ./clightning-plugins pkgs self.nbPython3Packages);
|
||||
joinmarket = pkgs.callPackage ./joinmarket { nbPythonPackageOverrides = import ./python-packages self; };
|
||||
|
Loading…
Reference in New Issue
Block a user