{ config, lib, pkgs, modulesPath, ... }: { # Pi 4 aarch64. Boot from the official NixOS sd-image; we don't generate # the image from this flake — flash the upstream aarch64 sd-image once, # then `nixos-rebuild switch --flake .#dayplanner --target-host` swaps # the running system over and comin takes over from there. imports = [ "${modulesPath}/installer/sd-card/sd-image-aarch64.nix" ]; # Drop the default channel; we deploy from the flake. sdImage.compressImage = false; boot.loader.grub.enable = false; boot.loader.generic-extlinux-compatible.enable = true; # The Waveshare 12.48" HAT is driven entirely from userspace Python via # /dev/spidev*. We only need SPI enabled in the device tree and the # gpio/spi groups available to the renderer user. boot.kernelParams = [ "console=serial0,115200" "console=tty1" ]; # Enable SPI0 (CE0/CE1) and the extra GPIOs the HAT needs. # See: https://www.waveshare.com/wiki/12.48inch_e-Paper_Module hardware.deviceTree = { enable = true; overlays = [ { name = "spi-on"; dtsText = '' /dts-v1/; /plugin/; / { compatible = "brcm,bcm2711"; fragment@0 { target = <&spi0>; __overlay__ { status = "okay"; }; }; }; ''; } ]; }; users.groups.spi = {}; users.groups.gpio = {}; services.udev.extraRules = '' SUBSYSTEM=="spidev", GROUP="spi", MODE="0660" SUBSYSTEM=="gpio", GROUP="gpio", MODE="0660" ''; }