1import ./make-test-python.nix ({ pkgs, lib, ...} :
2
3{
4 name = "frigate";
5 meta.maintainers = with lib.maintainers; [ hexa ];
6
7 nodes = {
8 machine = { config, ... }: {
9 services.frigate = {
10 enable = true;
11
12 hostname = "localhost";
13
14 settings = {
15 mqtt.enabled = false;
16
17 cameras.test = {
18 ffmpeg = {
19 input_args = "-fflags nobuffer -strict experimental -fflags +genpts+discardcorrupt -r 10 -use_wallclock_as_timestamps 1";
20 inputs = [ {
21 path = "http://127.0.0.1:8080";
22 roles = [
23 "record"
24 ];
25 } ];
26 };
27 };
28
29 record.enabled = true;
30 };
31 };
32
33 systemd.services.video-stream = {
34 description = "Start a test stream that frigate can capture";
35 before = [
36 "frigate.service"
37 ];
38 wantedBy = [
39 "multi-user.target"
40 ];
41 serviceConfig = {
42 DynamicUser = true;
43 ExecStart = "${lib.getBin pkgs.ffmpeg-headless}/bin/ffmpeg -re -f lavfi -i smptebars=size=800x600:rate=10 -f mpegts -listen 1 http://0.0.0.0:8080";
44 };
45 };
46 };
47 };
48
49 testScript = ''
50 start_all()
51
52 machine.wait_for_unit("frigate.service")
53
54 machine.wait_for_open_port(5001)
55
56 machine.succeed("curl http://localhost:5001")
57
58 machine.wait_for_file("/var/cache/frigate/test-*.mp4")
59 '';
60})