# pdtv26-brain: the brain's channel: MCP to the brain, and the ask capability to the box. # npm runs here, in Nix's build sandbox, from package-lock.json; so do the tests. # gate.js is speech's, copied in: one copy in git, and no package to share it. # 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-brain/*.js. { lib, buildNpmPackage }: buildNpmPackage { pname = "pdtv26-brain"; version = "0.1.0"; src = lib.fileset.toSource { root = ./.; fileset = lib.fileset.unions [ ./package.json ./package-lock.json ./ask.js ./ask.test.js ./report.js ./report.test.js ./channel.js ]; }; postPatch = '' cp ${../speech/gate.js} gate.js ''; npmDepsHash = "sha256-S2EuPu4u2sy43Tkf4SLMWIRw98w/QcljuQEkHXFgV3k="; 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 channel included: no test imports them. for f in *.js; do node --check "$f"; done node --test runHook postCheck ''; allowedReferences = [ ]; }