# pdtv26-box: the box's JavaScript: the ir and look servers, and the ask client. # npm runs here, in Nix's build sandbox, from package-lock.json; so do the tests. # gate.js and run.js are speech's, copied in: one copy in git, and no package to share them. # The output is plain JavaScript, the same on every architecture (allowedReferences keeps it so): # each user supplies its own node, at lib/node_modules/pdtv26-box/*.js. { lib, buildNpmPackage }: buildNpmPackage { pname = "pdtv26-box"; version = "0.1.0"; src = lib.fileset.toSource { root = ./.; fileset = lib.fileset.unions [ ./package.json ./package-lock.json ./ir.js ./ir.test.js ./look.js ./look.test.js ./ir-server.js ./look-server.js ./ask-client.js ]; }; postPatch = '' cp ${../speech/gate.js} gate.js cp ${../speech/run.js} run.js ''; npmDepsHash = "sha256-/4+KAx3SpYssfpHDfheNziTY9fnPnjHNQo/SItPabHM="; dontNpmBuild = true; # The scripts' #!/usr/bin/env node stays as is: patched, it would tie the package to one node. dontPatchShebangs = true; npmInstallFlags = [ "--ignore-scripts" ]; doCheck = true; checkPhase = '' runHook preCheck # Every file parses, the servers and client included: no test imports them. for f in *.js; do node --check "$f"; done node --test runHook postCheck ''; allowedReferences = [ ]; }