# 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"; }