check / check (push) Canceled after 0s
The box's photo goes up top, by the paragraph that introduces it. The parts list, with the workbench photo, moves to the setup guide's What you need; the README's Make your own tells how mine was made. The machine that runs speech and the brain is named for its roles, speech server and agent host, not "home server". Generated-by: Claude Opus 5.5
50 lines
2.1 KiB
Nix
50 lines
2.1 KiB
Nix
# A box's whole system, from a few names: what lib.mkBox adds to the box's services.
|
|
# name the box's host name
|
|
# server the speech server and agent host's name: speech and the brain listen there
|
|
# wifi the Wi-Fi network the box joins; its PSK goes on the card after imaging (make wifi-secret)
|
|
# admin who looks after the box, and logs in with sshKeys to deploy
|
|
{ name, server, wifi, admin, sshKeys }:
|
|
{ config, pkgs, ... }:
|
|
{
|
|
networking.hostName = name;
|
|
hardware.enableRedistributableFirmware = true; # the Pi 3B's Wi-Fi (brcmfmac)
|
|
|
|
pdtv26.box = {
|
|
enable = true;
|
|
speechUrl = "ws://${server}:8024/";
|
|
askUrl = "ws://${server}:8025/";
|
|
};
|
|
|
|
# Wi-Fi: the PSK stays out of the Nix store (it's world-readable).
|
|
networking.wireless = {
|
|
enable = true;
|
|
secretsFile = "/etc/wifi-secrets";
|
|
networks.${wifi}.pskRaw = "ext:psk";
|
|
};
|
|
# wpa_supplicant runs as its own user; its group number exists only after the first boot.
|
|
systemd.tmpfiles.rules = [ "z /etc/wifi-secrets 0640 root wpa_supplicant -" ];
|
|
|
|
services.avahi = { enable = true; nssmdns4 = true; publish = { enable = true; addresses = true; }; };
|
|
services.openssh = {
|
|
enable = true;
|
|
settings = { PasswordAuthentication = false; KbdInteractiveAuthentication = false; PermitRootLogin = "no"; };
|
|
};
|
|
users.users.${admin} = {
|
|
isNormalUser = true;
|
|
extraGroups = [ "wheel" "dialout" "audio" ]; # dialout: the Pico's serial port; audio: the Voice HAT
|
|
openssh.authorizedKeys.keys = sshKeys;
|
|
};
|
|
security.sudo.wheelNeedsPassword = false; # keys only; nixos-rebuild --target-host needs sudo
|
|
nix.settings.trusted-users = [ "@wheel" ];
|
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
zramSwap.enable = true; # 1 GB of RAM
|
|
boot.zfs.forceImportRoot = false; # no ZFS here; the 26.11 default, and quiet now
|
|
sdImage.compressImage = false;
|
|
|
|
# For make say, volume, and record, over ssh.
|
|
environment.systemPackages = [ pkgs.alsa-utils pkgs.espeak-ng ];
|
|
environment.etc."pdtv26-earcons".source = config.pdtv26.box.packages.earcons;
|
|
system.stateVersion = "26.05";
|
|
}
|