Restore frigate functionality by reverting to an older tensorflow version for libedgetpu

This commit is contained in:
Zuckerberg 2024-05-26 17:16:59 -06:00
parent efe50be604
commit b482a8c106
4 changed files with 64 additions and 36 deletions

17
flake.lock generated
View File

@ -215,6 +215,22 @@
"type": "indirect" "type": "indirect"
} }
}, },
"nixpkgs-frigate": {
"locked": {
"lastModified": 1695825837,
"narHash": "sha256-4Ne11kNRnQsmSJCRSSNkFRSnHC4Y5gPDBIQGjjPfJiU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5cfafa12d57374f48bcc36fda3274ada276cf69e",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5cfafa12d57374f48bcc36fda3274ada276cf69e",
"type": "github"
}
},
"nixpkgs-xone-fix": { "nixpkgs-xone-fix": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -276,6 +292,7 @@
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nix-index-database": "nix-index-database", "nix-index-database": "nix-index-database",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-frigate": "nixpkgs-frigate",
"nixpkgs-xone-fix": "nixpkgs-xone-fix", "nixpkgs-xone-fix": "nixpkgs-xone-fix",
"radio": "radio", "radio": "radio",
"radio-web": "radio-web", "radio-web": "radio-web",

View File

@ -1,6 +1,7 @@
{ {
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
nixpkgs-frigate.url = "github:NixOS/nixpkgs/5cfafa12d57374f48bcc36fda3274ada276cf69e";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
@ -123,7 +124,7 @@
"aarch64-linux"."iso" = mkIso "aarch64-linux"; "aarch64-linux"."iso" = mkIso "aarch64-linux";
}; };
overlays.default = import ./overlays; overlays.default = import ./overlays { inherit inputs; };
nixosModules.kernel-modules = import ./overlays/kernel-modules; nixosModules.kernel-modules = import ./overlays/kernel-modules;
deploy.nodes = deploy.nodes =

View File

@ -3,6 +3,40 @@
let let
frigateHostname = "frigate.s0"; frigateHostname = "frigate.s0";
frigatePort = 61617; frigatePort = 61617;
mkEsp32Cam = address: {
ffmpeg = {
input_args = "";
inputs = [{
path = address;
roles = [ "detect" "record" ];
}];
output_args.record = "-f segment -pix_fmt yuv420p -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v libx264 -preset ultrafast -an ";
};
rtmp.enabled = false;
snapshots = {
enabled = true;
bounding_box = true;
};
record = {
enabled = true;
retain.days = 10; # Keep video for 10 days
events.retain = {
default = 30; # Keep video with detections for 30 days
mode = "active_objects";
};
};
detect = {
enabled = true;
width = 800;
height = 600;
fps = 10;
};
objects = {
track = [ "person" ];
};
};
in in
{ {
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
@ -21,40 +55,7 @@ in
host = "localhost:1883"; host = "localhost:1883";
}; };
cameras = { cameras = {
dahlia-cam = { dahlia-cam = mkEsp32Cam "http://dahlia-cam.lan:8080";
ffmpeg = {
input_args = "";
inputs = [{
path = "http://dahlia-cam.lan:8080";
roles = [ "detect" "record" ];
}];
output_args.record = "-f segment -pix_fmt yuv420p -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v libx264 -preset ultrafast -an ";
};
rtmp.enabled = false;
snapshots = {
enabled = true;
bounding_box = true;
};
record = {
enabled = false;
retain.days = 0; # To not retain any recording if there is no detection of any events
events.retain = {
default = 3; # To retain recording for 3 days of only the events that happened
mode = "active_objects";
};
};
detect = {
enabled = true;
width = 800;
height = 600;
fps = 20;
};
objects = {
track = [ "dog" ];
filters.dog.threshold = 0.4;
};
};
}; };
# ffmpeg = { # ffmpeg = {
# hwaccel_args = "preset-vaapi"; # hwaccel_args = "preset-vaapi";

View File

@ -1,6 +1,15 @@
{ inputs }:
final: prev: final: prev:
let
system = prev.system;
frigatePkgs = inputs.nixpkgs-frigate.legacyPackages.${system};
in
{ {
libedgetpu = prev.callPackage ./libedgetpu { }; # It seems that libedgetpu needs to be built with the newer version of tensorflow in nixpkgs
# but I am lazy so I instead just downgrade by using the old nixpkgs
libedgetpu = frigatePkgs.callPackage ./libedgetpu { };
frigate = frigatePkgs.frigate;
actual-server = prev.callPackage ./actualbudget { }; actual-server = prev.callPackage ./actualbudget { };
} }