The box within reach of the couch: a Raspberry Pi 3B with the AIY Voice HAT, from the first household's configuration, made generic. - box/body: the button service, in Python: press and talk, turns by voice, a press interrupts; the look signal - box/*.js: the ir and look capabilities, behind gates, for the brain; the ask client, the box's side of a conversation - box/module.nix: the services, each confined to the devices and addresses it needs; the private network as an option (a tailnet by default); the Pico found by its USB IDs, as /dev/pdtv26-ir - box/voicehat.nix: the Voice HAT's device tree overlay and ALSA setup - lib.mkBox: a box's whole system from its name, the home server's, the Wi-Fi network's, and who looks after it - checks: box-js, box-py (doctests and pyflakes), and box-system (an example box's system evaluates) Generated-by: Claude Opus 5.5
37 lines
1.3 KiB
Nix
37 lines
1.3 KiB
Nix
# 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 = [ ];
|
|
}
|