Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ buildNpmPackage 2, darwin 3, fetchFromGitHub 4, lib 5, nodePackages 6, nodejs 7, python3 8, stdenv 9}: 10 11buildNpmPackage { 12 pname = "nodehun"; 13 version = "3.0.2"; 14 15 src = fetchFromGitHub { 16 owner = "Wulf"; 17 repo = "nodehun"; 18 rev = "03c9dcf1fcd965031a68553ccaf6487d1fe87f79"; 19 hash = "sha256-MoY95lSIQK1K4aIlMdPm93YxJuez9HYx2zlUhHvDao0="; 20 }; 21 22 patches = [ 23 # fsevents is needed on Darwin, but its dependency "nan" in the upstream package-lock.json 24 # is too old for the Node 18.x in Nixpkgs. 25 # This patch is generated by checking out the upstream source and running 26 # npm update nan --lockfile-version 1 27 ./update-nan.patch 28 ]; 29 30 npmDepsHash = "sha256-mV6rWNf2p2w4H0ESUT0/Ybtx9YEdvO5l2gCvlWFXK+U="; 31 32 buildInputs = lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.CoreServices ]; 33 nativeBuildInputs = [ nodePackages.node-gyp python3 ] 34 ++ lib.optionals stdenv.isDarwin [ darwin.cctools ]; 35 36 postInstall = '' 37 # Only keep the necessary parts of build/Release to reduce closure size 38 cd $out/lib/node_modules/nodehun 39 mv build build_old 40 mkdir build 41 cp -r build_old/Release build/ 42 rm -rf build_old 43 rm -rf build/Release/.deps 44 # Remove a development script to eliminate runtime dependency on node 45 rm node_modules/node-addon-api/tools/conversion.js 46 ''; 47 48 doInstallCheck = true; 49 nativeCheckInputs = [ nodejs ]; 50 postInstallCheck = '' 51 # Smoke check: require() works 52 export NODE_PATH=$out/lib/node_modules 53 echo 'require("nodehun")' | node - 54 ''; 55 56 disallowedReferences = [ nodejs ]; 57 58 meta = with lib; { 59 description = "The Hunspell binding for NodeJS that exposes as much of Hunspell as possible and also adds new features"; 60 homepage = "https://github.com/Wulf/nodehun"; 61 license = licenses.mit; 62 maintainers = [ maintainers.thomasjm ]; 63 }; 64}