173 lines
4.2 KiB
Nix
173 lines
4.2 KiB
Nix
{ config, lib, pkgs, inputs, ... }:
|
|
|
|
{
|
|
imports = [
|
|
./hardware-configuration.nix
|
|
../server.nix
|
|
];
|
|
|
|
networking.hostId = "731d1660";
|
|
|
|
hardware = {
|
|
raspberry-pi."4" = {
|
|
apply-overlays-dtmerge.enable = true;
|
|
audio.enable = false;
|
|
fkms-3d.enable = false;
|
|
xhci.enable = false;
|
|
};
|
|
deviceTree = {
|
|
enable = true;
|
|
overlays = [
|
|
{
|
|
# Adapted from: https://github.com/raspberrypi/linux/blob/rpi-6.1.y/arch/arm/boot/dts/overlays/hifiberry-digi-pro-overlay.dts
|
|
# changes:
|
|
# - modified top-level "compatible" field from bcm2835 to bcm2711
|
|
# - s/i2s_clk_consumer/i2s/ (name on bcm2711 platform)
|
|
name = "hifiberry-digi-pro";
|
|
dtsText = ''
|
|
/dts-v1/;
|
|
/plugin/;
|
|
|
|
/ {
|
|
compatible = "brcm,bcm2711";
|
|
|
|
fragment@0 {
|
|
target = <&i2s>;
|
|
__overlay__ {
|
|
status = "okay";
|
|
};
|
|
};
|
|
|
|
fragment@1 {
|
|
target = <&i2c1>;
|
|
__overlay__ {
|
|
#address-cells = <1>;
|
|
#size-cells = <0>;
|
|
status = "okay";
|
|
|
|
wm8804@3b {
|
|
#sound-dai-cells = <0>;
|
|
compatible = "wlf,wm8804";
|
|
reg = <0x3b>;
|
|
PVDD-supply = <&vdd_3v3_reg>;
|
|
DVDD-supply = <&vdd_3v3_reg>;
|
|
status = "okay";
|
|
};
|
|
};
|
|
};
|
|
|
|
fragment@2 {
|
|
target = <&sound>;
|
|
__overlay__ {
|
|
compatible = "hifiberry,hifiberry-digi";
|
|
i2s-controller = <&i2s>;
|
|
status = "okay";
|
|
clock44-gpio = <&gpio 5 0>;
|
|
clock48-gpio = <&gpio 6 0>;
|
|
};
|
|
};
|
|
};
|
|
'';
|
|
};
|
|
];
|
|
};
|
|
firmware = with pkgs; [
|
|
firmwareLinuxNonfree
|
|
wireless-regdb
|
|
];
|
|
};
|
|
|
|
sound.enable = true;
|
|
|
|
security.rtkit.enable = true;
|
|
services.pipewire = {
|
|
enable = true;
|
|
alsa.enable = true;
|
|
alsa.support32Bit = true;
|
|
pulse.enable = true;
|
|
systemWide = true;
|
|
};
|
|
|
|
virtualisation.oci-containers = {
|
|
backend = "podman";
|
|
containers.homeassistant = {
|
|
volumes = [ "home-assistant:/config" ];
|
|
environment.TZ = config.time.timeZone;
|
|
image = "ghcr.io/home-assistant/home-assistant:stable";
|
|
extraOptions = [
|
|
"--network=host"
|
|
"--device=/dev/ttyUSB0:/dev/ttyUSB0"
|
|
];
|
|
};
|
|
};
|
|
|
|
services.mosquitto = {
|
|
enable = true;
|
|
listeners = [{
|
|
port = 1883;
|
|
settings = {
|
|
allow_anonymous = true;
|
|
};
|
|
}];
|
|
};
|
|
|
|
age.secrets."files/services/zigbee2mqtt/secret.yaml" = {
|
|
file = "${inputs.secrets}/files/services/zigbee2mqtt/secret.yaml.age";
|
|
path = "${config.services.zigbee2mqtt.dataDir}/secret.yaml";
|
|
owner = "zigbee2mqtt";
|
|
group = "zigbee2mqtt";
|
|
};
|
|
|
|
services.zigbee2mqtt = {
|
|
enable = true;
|
|
dataDir = "/var/lib/zigbee2mqtt";
|
|
settings = {
|
|
homeassistant = true;
|
|
frontend = true;
|
|
device_options = {
|
|
retain = true;
|
|
};
|
|
serial = {
|
|
port = "/dev/serial/by-id/usb-Silicon_Labs_Sonoff_Zigbee_3.0_USB_Dongle_Plus_0001-if00-port0";
|
|
};
|
|
advanced = {
|
|
channel = 20;
|
|
network_key = "!secret.yaml network_key";
|
|
pan_id = 13001;
|
|
ext_pan_id = [ 79 1 73 47 250 136 124 222 ];
|
|
};
|
|
mqtt = {
|
|
version = 5;
|
|
server = "mqtt://localhost:1883";
|
|
};
|
|
};
|
|
};
|
|
|
|
modules = {
|
|
networking = {
|
|
wireless = {
|
|
enable = true;
|
|
interfaces = [ "wlan0" ];
|
|
};
|
|
};
|
|
services = {
|
|
borgmatic = {
|
|
enable = true;
|
|
directories = [
|
|
"/var/lib/mosquitto"
|
|
"/var/lib/zigbee2mqtt"
|
|
];
|
|
repoPath = "ssh://qcw86s11@qcw86s11.repo.borgbase.com/./repo";
|
|
};
|
|
};
|
|
};
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
libraspberrypi
|
|
raspberrypi-eeprom
|
|
];
|
|
|
|
system.stateVersion = "22.11";
|
|
}
|
|
|