summaryrefslogtreecommitdiff
path: root/nix-obs-qmlview/obs-qmlview.nix
blob: 8dba42a97abd1c15c2916b570c639bfe66717b66 (plain)
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
let
  nixpkgs = import <nixpkgs> {};
in
with nixpkgs;
stdenv.mkDerivation rec {
  pname = "obs-qmlview";
  version = "git";

  src = fetchFromGitHub {
    owner = "danieloneill";
    repo = "obs-qmlview";
    rev = "15248037ce735876481aef962e0f6645f3c527a6";
    sha256 = "0s09pwi3pd00z83kalna764yn21c901j6rpvlj8q524p0rx4sg3f";
  };

  patches = [ ./fix-qmlview.patch ];

  nativeBuildInputs = [ cmake qt515.qttools pkg-config ];
  buildInputs = with qt515; [
    obs-studio
    qtbase
    qtdeclarative
    qtwebengine
  ];

  cmakeFlags = with lib; [
    "-DLIBOBS_INCLUDE_DIR=${obs-studio.src}/libobs"
    "-Wno-dev"
  ];

  preConfigure = ''
    cp ${obs-studio.src}/cmake/external/FindLibobs.cmake FindLibobs.cmake
  '';

  dontWrapQtApps = true;

  postInstall = let
    pluginPath = {
      i686-linux = "bin/32bit";
      x86_64-linux = "bin/64bit";
    }.${stdenv.targetPlatform.system} or (throw "Unsupported system ${stdenv.targetPlatform.system}");
  in ''
    mkdir -p $out/share/obs/obs-plugins/obs-qmlview/${pluginPath}
    ln -s $out/lib/obs-plugins/obs-qmlview.so $out/share/obs/obs-plugins/obs-qmlview/${pluginPath}
  '';
}