{ pkgs , config , lib , ... }: with lib; let cfg = config.eboskma.backscrub; in { options.eboskma.backscrub = { enable = mkEnableOption "enable v4l2loopback kernel module"; }; config = mkIf cfg.enable { boot.extraModulePackages = [ config.boot.kernelPackages.v4l2loopback ]; # Register a v4l2loopback device at boot boot.kernelModules = [ "v4l2loopback" ]; boot.extraModprobeConfig = '' options v4l2loopback max_buffers=2 options v4l2loopback exclusive_caps=1 options v4l2loopback video_nr=10 options v4l2loopback card_label="VirtualCam" ''; environment.systemPackages = with pkgs; [ backscrub ]; }; }