nix/container/Iot.nix

71 lines
1.5 KiB
Nix
Raw Normal View History

2024-06-09 23:35:53 +03:00
{ container, ... } @args: let
cfg = container.config.iot;
in {
systemd.tmpfiles.rules = container.mkContainerDir cfg [
"data"
];
containers.iot = container.mkContainer cfg {
bindMounts = {
"/var/lib/hass" = {
hostPath = "${cfg.storage}/data";
isReadOnly = false;
};
2024-06-13 17:00:05 +03:00
"/dev/ttyACM0" = {
hostPath = "/dev/ttyACM0";
isReadOnly = false;
};
"/dev/serial/by-id" = {
hostPath = "/dev/serial/by-id";
isReadOnly = false;
};
} // container.attachMedia "photo" cfg.photo true;
allowedDevices = [
{
modifier = "rwm";
node = "/dev/ttyACM0";
}
];
config = { ... }: container.mkContainerConfig cfg {
# Allow Hass to talk to Zigbee dongle.
users.users.hass.extraGroups = [ "dialout" "tty" ];
2024-06-09 23:35:53 +03:00
services.home-assistant = {
# NOTE: Missing: hacs. Inside hacs: `card-mod`, `Clock Weather Card`, `WallPanel` and `Yandex.Station`.
enable = true;
extraComponents = [
"caldav"
"met"
"sun"
"systemmonitor"
"zha"
];
extraPackages = python3Packages: with python3Packages; [
aiodhcpwatcher
aiodiscover
2024-06-13 17:00:05 +03:00
aiogithubapi
2024-06-09 23:35:53 +03:00
async-upnp-client
ha-av
ha-ffmpeg
hassil
home-assistant-intents
mutagen
numpy
pynacl
pyturbojpeg
2024-06-13 17:00:05 +03:00
python-telegram-bot
2024-06-09 23:35:53 +03:00
zeroconf
];
configDir = "/var/lib/hass";
# lovelaceConfig = {
# title = "Home IoT control center.";
# };
# NOTE: Using imperative config because of secrets.
config = null;
};
};
};
}