9 cfg = config.programs.obs-studio;
12 options.programs.obs-studio = {
13 enable = lib.mkEnableOption "Free and open source software for video recording and live streaming";
15 package = lib.mkPackageOption pkgs "obs-studio" { example = "obs-studio"; };
17 finalPackage = lib.mkOption {
18 type = lib.types.package;
21 description = "Resulting customized OBS Studio package.";
24 plugins = lib.mkOption {
26 example = lib.literalExpression "[ pkgs.obs-studio-plugins.wlrobs ]";
27 description = "Optional OBS plugins.";
28 type = lib.types.listOf lib.types.package;
31 enableVirtualCamera = lib.mkOption {
32 type = lib.types.bool;
35 Installs and sets up the v4l2loopback kernel module, necessary for OBS
36 to start a virtual camera.
41 config = lib.mkIf cfg.enable {
42 programs.obs-studio.finalPackage = pkgs.wrapOBS.override { obs-studio = cfg.package; } {
43 plugins = cfg.plugins;
46 environment.systemPackages = [ cfg.finalPackage ];
48 boot = lib.mkIf cfg.enableVirtualCamera {
49 kernelModules = [ "v4l2loopback" ];
50 extraModulePackages = [ config.boot.kernelPackages.v4l2loopback ];
52 extraModprobeConfig = ''
53 options v4l2loopback devices=1 video_nr=1 card_label="OBS Cam" exclusive_caps=1
57 security.polkit.enable = lib.mkIf cfg.enableVirtualCamera true;
60 meta.maintainers = with lib.maintainers; [