about summary refs log tree commit diff
path: root/pkgs/applications/video
diff options
context:
space:
mode:
authorBabbaj <babbaj45@gmail.com>2023-11-19 16:42:58 -0500
committerJörg Thalheim <Mic92@users.noreply.github.com>2023-11-20 08:34:46 +0100
commitae1908845f453f2279e33c9b60b2ee47f979c6ca (patch)
tree24f22ac1add654e5461b7d470a6a15b074bef587 /pkgs/applications/video
parent9f7be03edada9898ddc81064d70dad92f22be15b (diff)
gpu-screen-recorder: 1.0.0 -> unstable-2023.11.18
gpu-screen-recorder-gtk: 0.1.0 -> 3.2.5
Diffstat (limited to 'pkgs/applications/video')
-rw-r--r--pkgs/applications/video/gpu-screen-recorder/default.nix54
-rw-r--r--pkgs/applications/video/gpu-screen-recorder/fix-nvfbc-check.patch38
-rw-r--r--pkgs/applications/video/gpu-screen-recorder/gpu-screen-recorder-gtk.nix38
3 files changed, 57 insertions, 73 deletions
diff --git a/pkgs/applications/video/gpu-screen-recorder/default.nix b/pkgs/applications/video/gpu-screen-recorder/default.nix
index be02bb5c690ee..052548f32f272 100644
--- a/pkgs/applications/video/gpu-screen-recorder/default.nix
+++ b/pkgs/applications/video/gpu-screen-recorder/default.nix
@@ -1,15 +1,28 @@
-{ stdenv, lib, fetchgit, makeWrapper, pkg-config, cudatoolkit, glew, libX11
-, libXcomposite, glfw, libpulseaudio, ffmpeg }:
-
-stdenv.mkDerivation rec {
+{ stdenv
+, lib
+, fetchurl
+, makeWrapper
+, pkg-config
+, libXcomposite
+, libpulseaudio
+, ffmpeg
+, wayland
+, libdrm
+, libva
+, libglvnd
+, libXrandr
+}:
+
+stdenv.mkDerivation {
   pname = "gpu-screen-recorder";
-  version = "1.0.0";
+  version = "unstable-2023-11-18";
 
-  src = fetchgit {
-    url = "https://repo.dec05eba.com/gpu-screen-recorder";
-    rev = "36fd4516db06bcb192e49055319d1778bbed0322";
-    sha256 = "sha256-hYEHM4FOYcPmQ5Yxh520PKy8HiD+G0xv9hrn8SmA07w=";
+  # printf "r%s.%s\n" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+  src = fetchurl {
+    url = "https://dec05eba.com/snapshot/gpu-screen-recorder.git.r418.5a8900e.tar.gz";
+    hash = "sha256-Dal6KxQOTqoNH6e8lYk5XEXGFG/vzbguNFZ9yk9nKe0=";
   };
+  sourceRoot = ".";
 
   nativeBuildInputs = [
     pkg-config
@@ -17,27 +30,26 @@ stdenv.mkDerivation rec {
   ];
 
   buildInputs = [
-    glew
-    libX11
     libXcomposite
-    glfw
     libpulseaudio
     ffmpeg
+    wayland
+    libdrm
+    libva
+    libXrandr
   ];
 
-  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
+  postInstall = ''
+    install -Dt $out/bin gpu-screen-recorder gsr-kms-server
+    mkdir $out/bin/.wrapped
+    mv $out/bin/gpu-screen-recorder $out/bin/.wrapped/
+    makeWrapper "$out/bin/.wrapped/gpu-screen-recorder" "$out/bin/gpu-screen-recorder" \
+    --prefix LD_LIBRARY_PATH : ${libglvnd}/lib \
+    --prefix PATH : $out/bin
   '';
 
   meta = with lib; {
diff --git a/pkgs/applications/video/gpu-screen-recorder/fix-nvfbc-check.patch b/pkgs/applications/video/gpu-screen-recorder/fix-nvfbc-check.patch
deleted file mode 100644
index bd0d7111c80a3..0000000000000
--- a/pkgs/applications/video/gpu-screen-recorder/fix-nvfbc-check.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-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/pkgs/applications/video/gpu-screen-recorder/gpu-screen-recorder-gtk.nix b/pkgs/applications/video/gpu-screen-recorder/gpu-screen-recorder-gtk.nix
index 6bfb425f0af9b..cc3a5033bd11c 100644
--- a/pkgs/applications/video/gpu-screen-recorder/gpu-screen-recorder-gtk.nix
+++ b/pkgs/applications/video/gpu-screen-recorder/gpu-screen-recorder-gtk.nix
@@ -1,28 +1,36 @@
-{ stdenv, lib, fetchgit, pkg-config, makeWrapper, gtk3, libX11, libXrandr
-, libpulseaudio, gpu-screen-recorder }:
-
-stdenv.mkDerivation rec {
+{ stdenv
+, lib
+, fetchurl
+, pkg-config
+, makeWrapper
+, gtk3
+, libpulseaudio
+, libdrm
+, gpu-screen-recorder
+, libglvnd
+, wrapGAppsHook
+}:
+
+stdenv.mkDerivation {
   pname = "gpu-screen-recorder-gtk";
-  version = "0.1.0";
+  version = "3.2.5";
 
-  src = fetchgit {
-    url = "https://repo.dec05eba.com/gpu-screen-recorder-gtk";
-    rev = "4c317abd0531f8e155fbbbcd32850bbeebbf2ead";
-    sha256 = "sha256-5W6qmUMP31ndRDxMHuQ/XnZysPQgaie0vVlMTzfODU4=";
+  src = fetchurl {
+    url = "https://dec05eba.com/snapshot/gpu-screen-recorder-gtk.git.r175.cfd18af.tar.gz";
+    hash = "sha256-HhZe22Hm9yGoy5WoyuP2+Wj8E3nMs4uf96mzmP6CMqU=";
   };
-
-  patches = [ ./fix-nvfbc-check.patch ];
+  sourceRoot = ".";
 
   nativeBuildInputs = [
     pkg-config
     makeWrapper
+    wrapGAppsHook
   ];
 
   buildInputs = [
     gtk3
-    libX11
-    libXrandr
     libpulseaudio
+    libdrm
   ];
 
   buildPhase = ''
@@ -33,7 +41,9 @@ stdenv.mkDerivation rec {
     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 ]}
+    gappsWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ gpu-screen-recorder ]})
+    # we also append /run/opengl-driver/lib as it otherwise fails to find libcuda.
+    gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libglvnd ]}:/run/opengl-driver/lib)
   '';
 
   meta = with lib; {