timelapse: change creds
This commit is contained in:
@@ -30,31 +30,6 @@ let
|
||||
done
|
||||
'';
|
||||
};
|
||||
timelapseScript = pkgs.writeShellApplication {
|
||||
name = "timelapse-r11";
|
||||
runtimeInputs = with pkgs; [ ffmpeg ];
|
||||
text = ''
|
||||
set -x
|
||||
NOW=$(date +%F_%T)
|
||||
DATE=''${NOW%_*}
|
||||
TIME=''${NOW#*_}
|
||||
mkdir -p /var/lib/timelapse-r11/"''${DATE}"
|
||||
EXITCODE=0
|
||||
ffmpeg -hide_banner -y \
|
||||
-rtsp_transport tcp \
|
||||
-i "rtsp://frigate:''${FRIGATE_RTSP_PASSWORD}@192.168.188.10/cam/realmonitor?channel=2&subtype=0" \
|
||||
-vframes 1 \
|
||||
/var/lib/timelapse-r11/"''${DATE}"/"ptz-''${DATE}_''${TIME}.jpg" || EXITCODE=$?
|
||||
|
||||
ffmpeg -hide_banner -y \
|
||||
-rtsp_transport tcp \
|
||||
-i "rtsp://frigate:''${FRIGATE_RTSP_PASSWORD}@192.168.188.10/cam/realmonitor?channel=1&subtype=0" \
|
||||
-vframes 1 \
|
||||
/var/lib/timelapse-r11/"''${DATE}"/"panorama-''${DATE}_''${TIME}.jpg" || EXITCODE=$?
|
||||
|
||||
exit "$EXITCODE"
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
options.mj.services.frigate = with lib.types; {
|
||||
@@ -64,17 +39,10 @@ in
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
mj.base.unitstatus.units = [
|
||||
"timelapse-r11"
|
||||
"go2rtc"
|
||||
"frigate"
|
||||
];
|
||||
|
||||
systemd.timers.timelapse-r11 = {
|
||||
#timerConfig.OnCalendar = "*-*-* 7..19:00/5 Europe/Vilnius";
|
||||
timerConfig.OnCalendar = "*:0/5";
|
||||
wantedBy = [ "timers.target" ];
|
||||
};
|
||||
|
||||
systemd.services = {
|
||||
go2rtc-prober = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
@@ -84,17 +52,6 @@ in
|
||||
Restart = "always";
|
||||
};
|
||||
};
|
||||
timelapse-r11 = {
|
||||
preStart = "ln -sf $CREDENTIALS_DIRECTORY/secrets.env /run/timelapse-r11/secrets.env";
|
||||
serviceConfig = {
|
||||
ExecStart = lib.getExe timelapseScript;
|
||||
EnvironmentFile = [ "-/run/timelapse-r11/secrets.env" ];
|
||||
LoadCredential = [ "secrets.env:${cfg.secretsEnv}" ];
|
||||
RuntimeDirectory = "timelapse-r11";
|
||||
StateDirectory = "timelapse-r11";
|
||||
DynamicUser = true;
|
||||
};
|
||||
};
|
||||
go2rtc = {
|
||||
preStart = "ln -sf $CREDENTIALS_DIRECTORY/secrets.env /run/go2rtc/secrets.env";
|
||||
serviceConfig = {
|
||||
|
||||
Reference in New Issue
Block a user