2024-07-20 19:56:59 -04:00
|
|
|
{
|
2024-11-15 13:39:20 -05:00
|
|
|
runtimeInputs,
|
|
|
|
npmDepsHash,
|
|
|
|
src,
|
2024-07-20 19:56:59 -04:00
|
|
|
lib,
|
|
|
|
buildNpmPackage,
|
|
|
|
makeWrapper,
|
|
|
|
nodejs_latest,
|
2024-11-15 13:39:20 -05:00
|
|
|
jq,
|
2024-07-20 19:56:59 -04:00
|
|
|
...
|
|
|
|
}: let
|
|
|
|
inherit (lib) concatMapStringsSep getBin;
|
|
|
|
|
2024-11-15 13:39:20 -05:00
|
|
|
packageJSON = builtins.fromJSON (builtins.readFile "${src}/package.json");
|
2024-07-20 19:56:59 -04:00
|
|
|
in
|
|
|
|
buildNpmPackage rec {
|
2024-08-06 20:35:11 -04:00
|
|
|
pname = packageJSON.name;
|
2024-07-20 19:56:59 -04:00
|
|
|
inherit (packageJSON) version;
|
|
|
|
|
2024-11-15 13:39:20 -05:00
|
|
|
inherit src runtimeInputs npmDepsHash;
|
|
|
|
|
|
|
|
prePatch = ''
|
|
|
|
mv ./tsconfig.json ./project.json
|
|
|
|
sed 's/^ *\/\/.*//' ${./tsconfig.json} > ./base.json
|
|
|
|
${jq}/bin/jq -sr '.[0] * .[1] | del(.extends)' ./project.json ./base.json > ./tsconfig.json
|
|
|
|
rm base.json project.json
|
|
|
|
'';
|
2024-07-20 19:56:59 -04:00
|
|
|
|
|
|
|
nativeBuildInputs = [makeWrapper];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/${pname} \
|
2024-10-20 21:42:54 -04:00
|
|
|
--prefix PATH : ${concatMapStringsSep ":" (p: getBin p) runtimeInputs}
|
2024-07-20 19:56:59 -04:00
|
|
|
'';
|
|
|
|
|
|
|
|
nodejs = nodejs_latest;
|
|
|
|
meta.mainProgram = pname;
|
|
|
|
}
|