mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
nixos/tests/frigate: init
Starts a frigate instance with a dummy video stream provided by ffmpeg. Co-Authored-By: fleaz <mail@felixbreidenstein.de>
This commit is contained in:
parent
f11d33afb7
commit
c7ad6560b0
@ -273,6 +273,7 @@ in {
|
|||||||
freeswitch = handleTest ./freeswitch.nix {};
|
freeswitch = handleTest ./freeswitch.nix {};
|
||||||
freshrss-sqlite = handleTest ./freshrss-sqlite.nix {};
|
freshrss-sqlite = handleTest ./freshrss-sqlite.nix {};
|
||||||
freshrss-pgsql = handleTest ./freshrss-pgsql.nix {};
|
freshrss-pgsql = handleTest ./freshrss-pgsql.nix {};
|
||||||
|
frigate = handleTest ./frigate.nix {};
|
||||||
frr = handleTest ./frr.nix {};
|
frr = handleTest ./frr.nix {};
|
||||||
fsck = handleTest ./fsck.nix {};
|
fsck = handleTest ./fsck.nix {};
|
||||||
fsck-systemd-stage-1 = handleTest ./fsck.nix { systemdStage1 = true; };
|
fsck-systemd-stage-1 = handleTest ./fsck.nix { systemdStage1 = true; };
|
||||||
|
60
nixos/tests/frigate.nix
Normal file
60
nixos/tests/frigate.nix
Normal file
@ -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")
|
||||||
|
'';
|
||||||
|
})
|
@ -6,6 +6,7 @@
|
|||||||
, fetchpatch
|
, fetchpatch
|
||||||
, frigate
|
, frigate
|
||||||
, opencv4
|
, opencv4
|
||||||
|
, nixosTests
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
@ -158,6 +159,9 @@ python.pkgs.buildPythonApplication rec {
|
|||||||
web = frigate-web;
|
web = frigate-web;
|
||||||
inherit python;
|
inherit python;
|
||||||
pythonPath =(python.pkgs.makePythonPath propagatedBuildInputs) + ":${frigate}/${python.sitePackages}";
|
pythonPath =(python.pkgs.makePythonPath propagatedBuildInputs) + ":${frigate}/${python.sitePackages}";
|
||||||
|
tests = {
|
||||||
|
inherit (nixosTests) frigate;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
Loading…
Reference in New Issue
Block a user