fix up timelapse-r11
This commit is contained in:
@@ -1,26 +1,25 @@
|
|||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
#pkgs,
|
pkgs,
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.mj.services.frigate;
|
cfg = config.mj.services.frigate;
|
||||||
timelapseScript = pkgs.writeShellApplication {
|
timelapseScript = pkgs.writeShellApplication {
|
||||||
name = "timelapse-r11-ptz";
|
name = "timelapse-r11";
|
||||||
runtimeInputs = with pkgs; [ ffmpeg ];
|
runtimeInputs = with pkgs; [ ffmpeg ];
|
||||||
text = ''
|
text = ''
|
||||||
set -x
|
set -x
|
||||||
NOW=$(date +%F_%T)
|
NOW=$(date +%F_%T)
|
||||||
DATE=$\{NOW%_*}
|
DATE=''${NOW%_*}
|
||||||
TIME=$\{NOW#*_}
|
TIME=''${NOW#*_}
|
||||||
mkdir -p /var/lib/timelapse/$\{DATE}
|
mkdir -p /var/lib/timelapse-r11/"''${DATE}"
|
||||||
exec ffmpeg -y \
|
exec ffmpeg -y \
|
||||||
-loglevel fatal \
|
|
||||||
-rtsp_transport tcp \
|
-rtsp_transport tcp \
|
||||||
-i "rtsp://frigate:$\{FRIGATE_RTSP_PASSWORD}@192.168.188.10/cam/realmonitor?channel=2&subtype=0" \
|
-i "rtsp://frigate:''${FRIGATE_RTSP_PASSWORD}@192.168.188.10/cam/realmonitor?channel=2&subtype=0" \
|
||||||
-vframes 1 \
|
-vframes 1 \
|
||||||
/var/lib/timelapse/$DATE/$TIME.jpg
|
/var/lib/timelapse-r11/"''${DATE}"/"''${TIME}.jpg"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
@@ -32,24 +31,25 @@ in
|
|||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
mj.base.unitstatus.units = [
|
mj.base.unitstatus.units = [
|
||||||
"timelapse"
|
"timelapse-r11"
|
||||||
"go2rtc"
|
"go2rtc"
|
||||||
"frigate"
|
"frigate"
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.timers.timelapse = {
|
systemd.timers.timelapse-r11 = {
|
||||||
timerConfig.OnCalendar = "*-*-* 7..19:00,30:00 Europe/Vilnius";
|
timerConfig.OnCalendar = "*-*-* 7..19:00,30:00 Europe/Vilnius";
|
||||||
wantedBy = [ "timers.target" ];
|
wantedBy = [ "timers.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services = {
|
systemd.services = {
|
||||||
timelapse = {
|
timelapse-r11 = {
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = lib.getExe timelapseScript;
|
ExecStart = lib.getExe timelapseScript;
|
||||||
EnvironmentFile = [ "-/run/timelapse/secrets.env" ];
|
EnvironmentFile = [ "-/run/timelapse-r11/secrets.env" ];
|
||||||
LoadCredential = [ "secrets.env:${cfg.secretsEnv}" ];
|
LoadCredential = [ "secrets.env:${cfg.secretsEnv}" ];
|
||||||
RuntimeDirectory = "timelapse";
|
RuntimeDirectory = "timelapse-r11";
|
||||||
StateDirectory = "timelapse";
|
StateDirectory = "timelapse-r11";
|
||||||
|
DynamicUser = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
go2rtc = {
|
go2rtc = {
|
||||||
|
|||||||
Reference in New Issue
Block a user