1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7let
8
9 cfg = config.services.uvcvideo;
10
11 uvcdynctrl-udev-rules =
12 packages:
13 pkgs.callPackage ./uvcdynctrl-udev-rules.nix {
14 drivers = packages;
15 udevDebug = false;
16 };
17
18in
19
20{
21
22 options = {
23 services.uvcvideo.dynctrl = {
24
25 enable = lib.mkOption {
26 type = lib.types.bool;
27 default = false;
28 description = ''
29 Whether to enable {command}`uvcvideo` dynamic controls.
30
31 Note that enabling this brings the {command}`uvcdynctrl` tool
32 into your environment and register all dynamic controls from
33 specified {command}`packages` to the {command}`uvcvideo` driver.
34 '';
35 };
36
37 packages = lib.mkOption {
38 type = lib.types.listOf lib.types.path;
39 example = lib.literalExpression "[ pkgs.tiscamera ]";
40 description = ''
41 List of packages containing {command}`uvcvideo` dynamic controls
42 rules. All files found in
43 {file}`«pkg»/share/uvcdynctrl/data`
44 will be included.
45
46 Note that these will serve as input to the {command}`libwebcam`
47 package which through its own {command}`udev` rule will register
48 the dynamic controls from specified packages to the {command}`uvcvideo`
49 driver.
50 '';
51 apply = map lib.getBin;
52 };
53 };
54 };
55
56 config = lib.mkIf cfg.dynctrl.enable {
57
58 services.udev.packages = [
59 (uvcdynctrl-udev-rules cfg.dynctrl.packages)
60 ];
61
62 environment.systemPackages = [
63 pkgs.libwebcam
64 ];
65
66 };
67}