This repository has been archived on 2026-03-10. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
nixos/home/programs/obs-studio/default.nix
Torjus Håkestad aef84d3c05
All checks were successful
Run nix flake check / flake-check (push) Successful in 1m38s
Periodic flake update / flake-update (push) Successful in 2m20s
obs-studio: update obs-backgroundremoval to 1.3.6
Fixes GPU device selection on Linux, broken by a preprocessor macro
typo that was fixed in 1.3.4.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 12:53:50 +01:00

65 lines
1.8 KiB
Nix

{
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.6";
src = pkgs.fetchFromGitHub {
owner = "occ-ai";
repo = "obs-backgroundremoval";
rev = final.version;
hash = "sha256-2BVcOH7wh1ibHZmaTMmRph/jYchHcCbq8mn9wo4LQOU=";
};
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
];
};
};
}