Files
nixpkgs/pkgs/by-name/ir/ironcalc/nodejs.nix
2026-07-07 14:35:12 +02:00

85 lines
1.4 KiB
Nix

{
lib,
stdenv,
pnpm,
pnpmConfigHook,
fetchPnpmDeps,
rustPlatform,
pkg-config,
bzip2,
zstd,
ironcalc,
nodejs,
cargo,
rustc,
writableTmpDirAsHomeHook,
}:
stdenv.mkDerivation {
pname = "ironcalc-nodejs";
inherit (ironcalc) version src;
postPatch = ''
cd bindings/nodejs
'';
strictDeps = true;
__structuredAttrs = true;
pnpmDeps = fetchPnpmDeps {
inherit (ironcalc) src;
pname = "ironcalc-nodejs";
hash = "sha256-WBISZTISqnti5MiI+/rECZw31YumSm7VPN+MYZNoS28=";
fetcherVersion = 4;
preInstall = ''
cd bindings/nodejs
'';
};
makeCacheWritable = true;
cargoDeps = rustPlatform.fetchCargoVendor {
inherit (ironcalc) src;
hash = ironcalc.cargoHash;
};
cargoRoot = "../..";
nativeBuildInputs = [
pkg-config
pnpm
nodejs
cargo
rustc
pnpmConfigHook
rustPlatform.cargoSetupHook
rustPlatform.cargoCheckHook
writableTmpDirAsHomeHook
];
buildPhase = ''
runHook preBuild
pnpm run build
runHook postBuild
'';
doCheck = true;
checkPhase = ''
runHook preCheck
pnpm run test
runHook postCheck
'';
installPhase = ''
runHook preInstall
mkdir -p $out/lib/node_modules/@ironcalc/nodejs
cp index.js index.d.ts package.json *.node $out/lib/node_modules/@ironcalc/nodejs/
runHook postInstall
'';
meta = ironcalc.meta // {
description = "Node.js bindings for IronCalc";
};
}