diff options
author | Martin Weinelt <hexa@darmstadt.ccc.de> | 2023-03-30 13:06:31 +0200 |
---|---|---|
committer | Martin Weinelt <hexa@darmstadt.ccc.de> | 2023-05-22 16:29:55 +0200 |
commit | c7ad6560b0f5eb606a03698b7a123473725d57db (patch) | |
tree | 41be2f80fe9e518b42778e800b8c04d0bf9b003d /nixos | |
parent | f11d33afb7cc37b90a3b350621522e80da000dd8 (diff) |
nixos/tests/frigate: init
Starts a frigate instance with a dummy video stream provided by ffmpeg. Co-Authored-By: fleaz <mail@felixbreidenstein.de>
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/tests/all-tests.nix | 1 | ||||
-rw-r--r-- | nixos/tests/frigate.nix | 60 |
2 files changed, 61 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 3718eea4228ad..33fa767c66bd4 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -273,6 +273,7 @@ in { freeswitch = handleTest ./freeswitch.nix {}; freshrss-sqlite = handleTest ./freshrss-sqlite.nix {}; freshrss-pgsql = handleTest ./freshrss-pgsql.nix {}; + frigate = handleTest ./frigate.nix {}; frr = handleTest ./frr.nix {}; fsck = handleTest ./fsck.nix {}; fsck-systemd-stage-1 = handleTest ./fsck.nix { systemdStage1 = true; }; diff --git a/nixos/tests/frigate.nix b/nixos/tests/frigate.nix new file mode 100644 index 0000000000000..836fe0d063f87 --- /dev/null +++ b/nixos/tests/frigate.nix @@ -0,0 +1,60 @@ +import ./make-test-python.nix ({ pkgs, lib, ...} : + +{ + name = "frigate"; + meta.maintainers = with lib.maintainers; [ hexa ]; + + nodes = { + machine = { config, ... }: { + services.frigate = { + enable = true; + + hostname = "localhost"; + + settings = { + mqtt.enabled = false; + + cameras.test = { + ffmpeg = { + input_args = "-fflags nobuffer -strict experimental -fflags +genpts+discardcorrupt -r 10 -use_wallclock_as_timestamps 1"; + inputs = [ { + path = "http://127.0.0.1:8080"; + roles = [ + "record" + ]; + } ]; + }; + }; + + record.enabled = true; + }; + }; + + systemd.services.video-stream = { + description = "Start a test stream that frigate can capture"; + before = [ + "frigate.service" + ]; + wantedBy = [ + "multi-user.target" + ]; + serviceConfig = { + DynamicUser = true; + 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"; + }; + }; + }; + }; + + testScript = '' + start_all() + + machine.wait_for_unit("frigate.service") + + machine.wait_for_open_port(5001) + + machine.succeed("curl http://localhost:5001") + + machine.wait_for_file("/var/cache/frigate/test-*.mp4") + ''; +}) |