mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
feat(motion): living
This commit is contained in:
parent
56b81f3d34
commit
44ab4225e5
6 changed files with 65 additions and 7 deletions
|
|
@ -51,7 +51,7 @@ in {
|
|||
};
|
||||
virtualHosts = let
|
||||
printerCams = [2];
|
||||
kitchenCams = [1 3];
|
||||
kitchenCams = [1 3 4];
|
||||
mkSubFilter = port: path: ''
|
||||
sub_filter '${port.protocol}://$host:${toString port.port}/' '${path}';
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
in {
|
||||
services.motion.cameras.kitchencam.settings = mapDefaults {
|
||||
video_device = "/dev/kitchencam";
|
||||
video_params = "auto_brightness=2,palette=${toString params.${format}.palette}";
|
||||
video_params = "auto_brightness=2,power_line_frequency=2,palette=${toString params.${format}.palette}";
|
||||
inherit (params.${format}) width height;
|
||||
framerate = 2;
|
||||
camera_id = 1;
|
||||
|
|
@ -32,10 +32,9 @@ in {
|
|||
inherit (lib.strings) concatStringsSep;
|
||||
rules = [
|
||||
''SUBSYSTEM=="video4linux"''
|
||||
''ACTION=="add"''
|
||||
''ATTR{index}=="0"''
|
||||
''ATTRS{idProduct}=="2a25"''
|
||||
''ATTRS{idVendor}=="1224"''
|
||||
''ATTRS{idProduct}=="2a25"''
|
||||
''SYMLINK+="kitchencam"''
|
||||
''OWNER="${motion.user}"''
|
||||
''TAG+="systemd"''
|
||||
|
|
|
|||
49
nixos/cameras/living.nix
Normal file
49
nixos/cameras/living.nix
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
config,
|
||||
gensokyo-zone,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (gensokyo-zone.lib) mapDefaults;
|
||||
inherit (config.services) motion;
|
||||
format = "mjpeg"; # or "yuyv"
|
||||
params = {
|
||||
mjpeg = {
|
||||
palette = 8;
|
||||
width = 1280;
|
||||
height = 720;
|
||||
};
|
||||
yuyv = {
|
||||
palette = 15;
|
||||
width = 640;
|
||||
height = 480;
|
||||
};
|
||||
};
|
||||
in {
|
||||
services.motion.cameras.livingcam.settings = mapDefaults {
|
||||
video_device = "/dev/livingcam";
|
||||
video_params = "auto_brightness=2,brightness=72,power_line_frequency=2,palette=${toString params.${format}.palette}";
|
||||
inherit (params.${format}) width height;
|
||||
#framerate = 30;
|
||||
framerate = 20;
|
||||
camera_id = 4;
|
||||
text_left = "";
|
||||
text_right = "";
|
||||
stream_quality = 85;
|
||||
};
|
||||
services.udev.extraRules = let
|
||||
inherit (lib.strings) concatStringsSep;
|
||||
rules = [
|
||||
''SUBSYSTEM=="video4linux"''
|
||||
''ATTR{index}=="0"''
|
||||
''ATTRS{idVendor}=="1d3f"''
|
||||
''ATTRS{idProduct}=="1120"''
|
||||
''SYMLINK+="livingcam"''
|
||||
''OWNER="${motion.user}"''
|
||||
''TAG+="systemd"''
|
||||
''ENV{SYSTEMD_WANTS}="motion.service"''
|
||||
];
|
||||
rulesLine = concatStringsSep ", " rules;
|
||||
in
|
||||
rulesLine;
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
in {
|
||||
services.motion.cameras.printercam.settings = mapDefaults {
|
||||
video_device = "/dev/printercam";
|
||||
video_params = "auto_brightness=1,palette=8"; # MJPG=8, YUYV=15
|
||||
video_params = "auto_brightness=0,sharpness=5,palette=8"; # MJPG=8, YUYV=15
|
||||
width = 1920;
|
||||
height = 1080;
|
||||
framerate = 4;
|
||||
|
|
@ -21,10 +21,9 @@ in {
|
|||
inherit (lib.strings) concatStringsSep;
|
||||
rules = [
|
||||
''SUBSYSTEM=="video4linux"''
|
||||
''ACTION=="add"''
|
||||
''ATTR{index}=="0"''
|
||||
''ATTRS{idProduct}=="6366"''
|
||||
''ATTRS{idVendor}=="0c45"''
|
||||
''ATTRS{idProduct}=="6366"''
|
||||
''SYMLINK+="printercam"''
|
||||
''OWNER="${motion.user}"''
|
||||
''TAG+="systemd"''
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ in {
|
|||
nixos.barcodebuddy-scanner
|
||||
nixos.motion
|
||||
nixos.cameras.kitchen
|
||||
nixos.cameras.living
|
||||
nixos.cameras.logistics-webcam
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
|
|
|||
|
|
@ -16,6 +16,16 @@
|
|||
nixos.motion
|
||||
nixos.cameras.printer
|
||||
];
|
||||
|
||||
services.motion.cameras.printercam.settings = {
|
||||
# TODO: try to limit CPU usage for now...
|
||||
width = 1280;
|
||||
height = 720;
|
||||
framerate = 2;
|
||||
text_right = "";
|
||||
stream_quality = 60;
|
||||
};
|
||||
|
||||
boot.loader = {
|
||||
grub.enable = false;
|
||||
generic-extlinux-compatible.enable = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue