feat(octoprint): motion and notifs

This commit is contained in:
arcnmx 2024-07-14 18:44:05 -07:00
parent 6bf729ffe9
commit 7fe6d48ff0
11 changed files with 263 additions and 47 deletions

34
nixos/cameras/kitchen.nix Normal file
View file

@ -0,0 +1,34 @@
{
config,
gensokyo-zone,
lib,
...
}: let
inherit (gensokyo-zone.lib) mapDefaults;
inherit (config.services) motion;
in {
services.motion.cameras.kitchencam.settings = mapDefaults {
videodevice = "/dev/kitchencam";
v4l2_palette = 8;
width = 640;
height = 480;
framerate = 5;
camera_id = 1;
text_left = "kitchen";
};
services.udev.extraRules = let
inherit (lib.strings) concatStringsSep;
rules = [
''SUBSYSTEM=="video4linux"''
''ACTION=="add"''
''ATTR{index}=="0"''
''ATTRS{idProduct}=="2a25"''
''ATTRS{idVendor}=="1224"''
''SYMLINK+="kitchencam"''
''OWNER="${motion.user}"''
''TAG+="systemd"''
''ENV{SYSTEMD_WANTS}="motion.service"''
];
rulesLine = concatStringsSep ", " rules;
in rulesLine;
}

View file

@ -0,0 +1,12 @@
{
gensokyo-zone,
...
}: let
inherit (gensokyo-zone.lib) mapDefaults;
in {
services.motion.cameras.webcam.settings = mapDefaults {
videodevice = "/dev/video0";
camera_id = 3;
text_left = "logistics";
};
}

34
nixos/cameras/printer.nix Normal file
View file

@ -0,0 +1,34 @@
{
config,
gensokyo-zone,
lib,
...
}: let
inherit (gensokyo-zone.lib) mapDefaults;
inherit (config.services) motion;
in {
services.motion.cameras.printercam.settings = mapDefaults {
videodevice = "/dev/printercam";
width = 640;
height = 480;
framerate = 5;
camera_id = 2;
text_left = "";
#text_right = "";
};
services.udev.extraRules = let
inherit (lib.strings) concatStringsSep;
rules = [
''SUBSYSTEM=="video4linux"''
''ACTION=="add"''
''ATTR{index}=="0"''
''ATTRS{idProduct}=="6366"''
''ATTRS{idVendor}=="0c45"''
''SYMLINK+="printercam"''
''OWNER="${motion.user}"''
''TAG+="systemd"''
''ENV{SYSTEMD_WANTS}="motion.service"''
];
rulesLine = concatStringsSep ", " rules;
in rulesLine;
}