{ pkgs, lib, config, ... }: { options.torjus.home = { obs = { enable = lib.mkOption { type = lib.types.bool; default = false; description = "Whether to enable obs."; }; withCuda = lib.mkOption { type = lib.types.bool; default = false; description = "Enable cuda for obs-related packages."; }; }; }; config = lib.mkIf config.torjus.home.obs.enable { programs.obs-studio = let withCuda = config.torjus.home.obs.withCuda; onnxruntime-gpu = (pkgs.onnxruntime.override { cudaSupport = withCuda; }); obs-backgroundremoval-gpu = ( (pkgs.obs-studio-plugins.obs-backgroundremoval.override { onnxruntime = onnxruntime-gpu; }) .overrideAttrs ( final: prev: { version = "1.3.3"; src = pkgs.fetchFromGitHub { owner = "royshil"; repo = "obs-backgroundremoval"; rev = final.version; hash = "sha256-NDe71iDnVcnMilGr5kdbemq8jEKd3WW45tbMwxjqUwo="; }; nativeBuildInputs = prev.nativeBuildInputs ++ [ pkgs.pkg-config ]; cmakeFlags = [ "--preset ubuntu-x86_64" "-DCMAKE_MODULE_PATH:PATH=${final.src}/cmake" "-DUSE_SYSTEM_ONNXRUNTIME=ON" "-DVCPKG_TARGET_TRIPLET=" "-DUSE_PKGCONFIG=ON" ]; } ) ); in { enable = true; package = pkgs.obs-studio.override { cudaSupport = withCuda; }; plugins = with pkgs.obs-studio-plugins; [ obs-pipewire-audio-capture obs-shaderfilter obs-backgroundremoval-gpu ]; }; }; }