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:
@@ -113,7 +113,7 @@ in
|
||||
"rtsp://admin:@reolink-living-room:554/h264Preview_01_main"
|
||||
];
|
||||
webcam_office = [
|
||||
"ffmpeg:device?video=/dev/video0&video_size=1024x576#video=h264"
|
||||
"ffmpeg:device?video=/dev/hass-webcam/video0&video_size=1024x576#video=h264"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user