From d6ee1209ce08103dd2b8294c9399d628d1394f9e Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sat, 11 Sep 2021 20:57:11 +0200 Subject: obs-qmlview for nix --- nix-obs-qmlview/Readme.org | 7 +++++ nix-obs-qmlview/fix-qmlview.patch | 57 +++++++++++++++++++++++++++++++++++++++ nix-obs-qmlview/obs-qmlview.nix | 46 +++++++++++++++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 nix-obs-qmlview/Readme.org create mode 100644 nix-obs-qmlview/fix-qmlview.patch create mode 100644 nix-obs-qmlview/obs-qmlview.nix diff --git a/nix-obs-qmlview/Readme.org b/nix-obs-qmlview/Readme.org new file mode 100644 index 0000000..72a8b24 --- /dev/null +++ b/nix-obs-qmlview/Readme.org @@ -0,0 +1,7 @@ +#+TITLE: obs-qmlview for nix + +Adds qml as a source type to obs. + +Based on [[https://github.com/danieloneill/obs-qmlview][obs-qmlview by danieloneill]] and packages for nix; should be +usable by just adding it to the ~programs.obs-studio.plugins~ option +when using ~home-manager~. diff --git a/nix-obs-qmlview/fix-qmlview.patch b/nix-obs-qmlview/fix-qmlview.patch new file mode 100644 index 0000000..78e263a --- /dev/null +++ b/nix-obs-qmlview/fix-qmlview.patch @@ -0,0 +1,57 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b060dc4..c46af92 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -3,6 +3,10 @@ project(obs-qmlview) + set(CMAKE_INCLUDE_CURRENT_DIR TRUE) + set(CMAKE_AUTOMOC TRUE) + ++include(FindLibobs.cmake) ++find_package(LibObs REQUIRED) ++ ++ + find_package(Qt5Quick REQUIRED) + if(NOT Qt5Quick_FOUND) + if (ENABLE_UI) +@@ -64,4 +68,14 @@ target_link_libraries(obs-qmlview + Qt5::Widgets + Qt5::WebEngine + ) +-install_obs_plugin_with_data(obs-qmlview data) ++ ++#install_obs_plugin_with_data(obs-qmlview data) ++ ++set_target_properties(obs-qmlview PROPERTIES PREFIX "") ++ ++install(TARGETS obs-qmlview ++ LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/obs-plugins) ++ ++#install(DIRECTORY data/locale/ ++# DESTINATION ++# "${CMAKE_INSTALL_PREFIX}/share/obs/obs-plugins/obs-qmlview/locale") +diff --git a/qmlview.h b/qmlview.h +index 6919f55..c9cc37e 100644 +--- a/qmlview.h ++++ b/qmlview.h +@@ -83,7 +83,7 @@ signals: + void qmlWarnings(QStringList warnings); + + private slots: +- void doSnap(); ++// void doSnap(); + void doLoad(); + void doUnload(); + void doResize(quint32 w, quint32 h); +diff --git a/renderer.h b/renderer.h +index 5ed5f51..01fe0c4 100644 +--- a/renderer.h ++++ b/renderer.h +@@ -145,7 +145,7 @@ public slots: + + bool initialised() { return m_quickInitialized; } + QVariant getQuery(); +- void requestUpdate(); ++ //void requestUpdate(); + + QStringList loadMessages() { return m_loadMessages; } + void addMessages(const QStringList &msgs) { m_loadMessages << msgs; } diff --git a/nix-obs-qmlview/obs-qmlview.nix b/nix-obs-qmlview/obs-qmlview.nix new file mode 100644 index 0000000..8dba42a --- /dev/null +++ b/nix-obs-qmlview/obs-qmlview.nix @@ -0,0 +1,46 @@ +let + nixpkgs = import {}; +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} + ''; +} -- cgit v1.2.3