12 cfg = config.services.mjpg-streamer;
19 services.mjpg-streamer = {
21 enable = mkEnableOption "mjpg-streamer webcam streamer";
23 inputPlugin = mkOption {
25 default = "input_uvc.so";
27 Input plugin. See plugins documentation for more information.
31 outputPlugin = mkOption {
33 default = "output_http.so -w @www@ -n -p 5050";
35 Output plugin. `@www@` is substituted for default mjpg-streamer www directory.
36 See plugins documentation for more information.
42 default = "mjpg-streamer";
43 description = "mjpg-streamer user name.";
49 description = "mjpg-streamer group name.";
56 config = mkIf cfg.enable {
58 users.users = optionalAttrs (cfg.user == "mjpg-streamer") {
60 uid = config.ids.uids.mjpg-streamer;
65 systemd.services.mjpg-streamer = {
66 description = "mjpg-streamer webcam streamer";
67 wantedBy = [ "multi-user.target" ];
72 Restart = "on-failure";
77 IPLUGIN="${cfg.inputPlugin}"
78 OPLUGIN="${cfg.outputPlugin}"
79 OPLUGIN="''${OPLUGIN//@www@/${pkgs.mjpg-streamer}/share/mjpg-streamer/www}"
80 exec ${pkgs.mjpg-streamer}/bin/mjpg_streamer -i "$IPLUGIN" -o "$OPLUGIN"