nixos/sfh: Start Home Assistant without the webcam

An absent webcam made the nspawn bind mount fail before Home
Assistant could start. Give the container an always-present
directory and bind the video device into it when it is available.
Point go2rtc at the device in that directory.
This commit is contained in:
2026-11-18 22:01:54 +00:00
parent 4307939aab
commit 89cc4b679c
3 changed files with 18 additions and 8 deletions
+13 -5
View File
@@ -175,10 +175,15 @@ in
};
systemd.services = {
"systemd-nspawn@hass".serviceConfig.DeviceAllow = [
"char-ttyUSB rw"
"char-video4linux rw"
];
"systemd-nspawn@hass".serviceConfig = {
DeviceAllow = [
"char-ttyUSB rw"
"char-video4linux rw"
];
# Pass an empty directory to nspawn when the webcam is absent.
RuntimeDirectory = "hass-webcam";
BindPaths = [ "-/dev/video0:/run/hass-webcam/video0" ];
};
# Coding agents; keep the other containers responsive
"systemd-nspawn@slop-cannon".serviceConfig = {
CPUWeight = 20;
@@ -215,7 +220,10 @@ in
readOnly = false;
};
"/dev/bus/usb/001/002".readOnly = false;
"/dev/video0".readOnly = false;
"/run/hass-webcam" = {
mountPoint = "/dev/hass-webcam";
readOnly = false;
};
"/dev/serial/by-id/usb-Nabu_Casa_Home_Assistant_Connect_ZBT-1_ce549704fe38ef11a2c2e5d154516304-if00-port0" = {
readOnly = false;
mountPoint = "/dev/ttyUSB0";