about summary refs log tree commit diff
path: root/pkgs/applications/video/obs-studio/plugins/obs-backgroundremoval/default.nix
blob: 638d0785f4c803eb96b4f53c9f279ddeff9c30f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ lib
, stdenv
, fetchFromGitHub
, cmake
, ninja
, obs-studio
, onnxruntime
, opencv
, qt6
, curl
}:

stdenv.mkDerivation rec {
  pname = "obs-backgroundremoval";
  version = "1.1.13";

  src = fetchFromGitHub {
    owner = "occ-ai";
    repo = "obs-backgroundremoval";
    rev = version;
    hash = "sha256-QoC9/HkwOXMoFNvcOxQkGCLLAJmsja801LKCNT9O9T0=";
  };

  nativeBuildInputs = [ cmake ninja ];
  buildInputs = [ obs-studio onnxruntime opencv qt6.qtbase curl ];

  dontWrapQtApps = true;

  cmakeFlags = [
    "--preset linux-x86_64"
    "-DCMAKE_MODULE_PATH:PATH=${src}/cmake"
    "-DUSE_SYSTEM_ONNXRUNTIME=ON"
    "-DUSE_SYSTEM_OPENCV=ON"
    "-DDISABLE_ONNXRUNTIME_GPU=ON"
  ];

  buildPhase = ''
     cd ..
     cmake --build build_x86_64 --parallel
  '';

  installPhase = ''
    cmake --install build_x86_64 --prefix "$out"
  '';

  meta = with lib; {
    description = "OBS plugin to replace the background in portrait images and video";
    homepage = "https://github.com/royshil/obs-backgroundremoval";
    maintainers = with maintainers; [ zahrun ];
    license = licenses.mit;
    platforms = [ "x86_64-linux" ];
  };
}