about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/video/gpu-screen-recorder
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/video/gpu-screen-recorder')
-rw-r--r--nixpkgs/pkgs/applications/video/gpu-screen-recorder/default.nix50
-rw-r--r--nixpkgs/pkgs/applications/video/gpu-screen-recorder/fix-nvfbc-check.patch38
-rw-r--r--nixpkgs/pkgs/applications/video/gpu-screen-recorder/gpu-screen-recorder-gtk.nix46
3 files changed, 134 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/video/gpu-screen-recorder/default.nix b/nixpkgs/pkgs/applications/video/gpu-screen-recorder/default.nix
new file mode 100644
index 000000000000..be02bb5c690e
--- /dev/null
+++ b/nixpkgs/pkgs/applications/video/gpu-screen-recorder/default.nix
@@ -0,0 +1,50 @@
+{ stdenv, lib, fetchgit, makeWrapper, pkg-config, cudatoolkit, glew, libX11
+, libXcomposite, glfw, libpulseaudio, ffmpeg }:
+
+stdenv.mkDerivation rec {
+  pname = "gpu-screen-recorder";
+  version = "1.0.0";
+
+  src = fetchgit {
+    url = "https://repo.dec05eba.com/gpu-screen-recorder";
+    rev = "36fd4516db06bcb192e49055319d1778bbed0322";
+    sha256 = "sha256-hYEHM4FOYcPmQ5Yxh520PKy8HiD+G0xv9hrn8SmA07w=";
+  };
+
+  nativeBuildInputs = [
+    pkg-config
+    makeWrapper
+  ];
+
+  buildInputs = [
+    glew
+    libX11
+    libXcomposite
+    glfw
+    libpulseaudio
+    ffmpeg
+  ];
+
+  postPatch = ''
+    substituteInPlace ./build.sh \
+      --replace '/opt/cuda/targets/x86_64-linux/include' '${cudatoolkit}/targets/x86_64-linux/include' \
+      --replace '/usr/lib64/libcuda.so' '${cudatoolkit}/targets/x86_64-linux/lib/stubs/libcuda.so'
+  '';
+
+  buildPhase = ''
+    ./build.sh
+  '';
+
+  installPhase = ''
+    install -Dt $out/bin/ gpu-screen-recorder
+    wrapProgram $out/bin/gpu-screen-recorder --prefix LD_LIBRARY_PATH : /run/opengl-driver/lib
+  '';
+
+  meta = with lib; {
+    description = "A screen recorder that has minimal impact on system performance by recording a window using the GPU only";
+    homepage = "https://git.dec05eba.com/gpu-screen-recorder/about/";
+    license = licenses.gpl3Only;
+    maintainers = with maintainers; [ babbaj ];
+    platforms = [ "x86_64-linux" ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/video/gpu-screen-recorder/fix-nvfbc-check.patch b/nixpkgs/pkgs/applications/video/gpu-screen-recorder/fix-nvfbc-check.patch
new file mode 100644
index 000000000000..bd0d7111c80a
--- /dev/null
+++ b/nixpkgs/pkgs/applications/video/gpu-screen-recorder/fix-nvfbc-check.patch
@@ -0,0 +1,38 @@
+diff --git a/build.sh b/build.sh
+index 05603db..8c38b31 100755
+--- a/build.sh
++++ b/build.sh
+@@ -2,5 +2,5 @@
+ 
+ dependencies="gtk+-3.0 x11 xrandr libpulse"
+ includes="$(pkg-config --cflags $dependencies)"
+-libs="$(pkg-config --libs $dependencies)"
++libs="$(pkg-config --libs $dependencies) -ldl"
+ g++ -o gpu-screen-recorder-gtk -O2 src/main.cpp -s $includes $libs
+diff --git a/src/main.cpp b/src/main.cpp
+index ae2078f..9dcdce1 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -15,6 +15,7 @@
+ #include <pwd.h>
+ #include <libgen.h>
+ #include <functional>
++#include <dlfcn.h>
+ 
+ typedef struct {
+     Display *display;
+@@ -830,7 +831,13 @@ static void audio_input_change_callback(GtkComboBox *widget, gpointer userdata)
+ }
+ 
+ static bool is_nv_fbc_installed() {
+-    return access("/usr/lib/libnvidia-fbc.so.1", F_OK) == 0 || access("/usr/local/lib/libnvidia-fbc.so.1", F_OK) == 0;
++    auto handle = dlopen("libnvidia-fbc.so.1", RTLD_LAZY);
++    if (handle) {
++        dlclose(handle);
++        return true;
++    } else {
++        return false;
++    }
+ }
+ 
+ static GtkWidget* create_common_settings_page(GtkStack *stack, GtkApplication *app) {
diff --git a/nixpkgs/pkgs/applications/video/gpu-screen-recorder/gpu-screen-recorder-gtk.nix b/nixpkgs/pkgs/applications/video/gpu-screen-recorder/gpu-screen-recorder-gtk.nix
new file mode 100644
index 000000000000..6bfb425f0af9
--- /dev/null
+++ b/nixpkgs/pkgs/applications/video/gpu-screen-recorder/gpu-screen-recorder-gtk.nix
@@ -0,0 +1,46 @@
+{ stdenv, lib, fetchgit, pkg-config, makeWrapper, gtk3, libX11, libXrandr
+, libpulseaudio, gpu-screen-recorder }:
+
+stdenv.mkDerivation rec {
+  pname = "gpu-screen-recorder-gtk";
+  version = "0.1.0";
+
+  src = fetchgit {
+    url = "https://repo.dec05eba.com/gpu-screen-recorder-gtk";
+    rev = "4c317abd0531f8e155fbbbcd32850bbeebbf2ead";
+    sha256 = "sha256-5W6qmUMP31ndRDxMHuQ/XnZysPQgaie0vVlMTzfODU4=";
+  };
+
+  patches = [ ./fix-nvfbc-check.patch ];
+
+  nativeBuildInputs = [
+    pkg-config
+    makeWrapper
+  ];
+
+  buildInputs = [
+    gtk3
+    libX11
+    libXrandr
+    libpulseaudio
+  ];
+
+  buildPhase = ''
+    ./build.sh
+  '';
+
+  installPhase = ''
+    install -Dt $out/bin/ gpu-screen-recorder-gtk
+    install -Dt $out/share/applications/ gpu-screen-recorder-gtk.desktop
+
+    wrapProgram $out/bin/gpu-screen-recorder-gtk --prefix PATH : ${lib.makeBinPath [ gpu-screen-recorder ]}
+  '';
+
+  meta = with lib; {
+    description = "GTK frontend for gpu-screen-recorder.";
+    homepage = "https://git.dec05eba.com/gpu-screen-recorder-gtk/about/";
+    license = licenses.gpl3Only;
+    maintainers = with maintainers; [ babbaj ];
+    platforms = [ "x86_64-linux" ];
+  };
+}