From 0f547264cdc1c61c6fdd6145b5a8527f93f02ff2 Mon Sep 17 00:00:00 2001 From: coopi Date: Fri, 7 Aug 2026 06:12:16 +0400 Subject: gnu: packages: Add gpu-screen-recorder. * gnu/packages/video.scm (gpu-screen-recorder): New variable. Signed-off-by: Liliana Marie Prikler --- gnu/local.mk | 1 + ...gpu-screen-recorder-privileged-kms-helper.patch | 24 +++++++ gnu/packages/video.scm | 73 ++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 gnu/packages/patches/gpu-screen-recorder-privileged-kms-helper.patch diff --git a/gnu/local.mk b/gnu/local.mk index 10ab386e580..f90c12810fd 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1550,6 +1550,7 @@ dist_patch_DATA = \ %D%/packages/patches/gpaste-fix-paths.patch \ %D%/packages/patches/gpm-glibc-2.26.patch \ %D%/packages/patches/gpodder-disable-updater.patch \ + %D%/packages/patches/gpu-screen-recorder-privileged-kms-helper.patch \ %D%/packages/patches/grantlee-fix-i586-precision.patch \ %D%/packages/patches/grantlee-register-metaenumvariable.patch \ %D%/packages/patches/graphite2-non-linux.patch \ diff --git a/gnu/packages/patches/gpu-screen-recorder-privileged-kms-helper.patch b/gnu/packages/patches/gpu-screen-recorder-privileged-kms-helper.patch new file mode 100644 index 00000000000..078ccee23e7 --- /dev/null +++ b/gnu/packages/patches/gpu-screen-recorder-privileged-kms-helper.patch @@ -0,0 +1,24 @@ +Look for the capability-bearing gsr-kms-server installed by Guix System before +using the unprivileged copy next to gpu-screen-recorder. + +When the privileged helper is absent, retain the existing lookup and pkexec +fallback. + +diff --git a/kms/client/kms_client.c b/kms/client/kms_client.c +--- a/kms/client/kms_client.c ++++ b/kms/client/kms_client.c +@@ -255,6 +255,14 @@ int gsr_kms_client_init(gsr_kms_client *self, const char *card_path) { + return -1; + } + ++#ifdef __linux__ ++ const char *privileged_server_filepath = "/run/privileged/bin/gsr-kms-server"; ++ if(access(privileged_server_filepath, X_OK) == 0) { ++ snprintf(server_filepath, sizeof(server_filepath), "%s", ++ privileged_server_filepath); ++ } ++#endif ++ + if(access(server_filepath, F_OK) != 0) { + fprintf(stderr, "gsr info: gsr_kms_client_init: gsr-kms-server is not installed in the same directory as gpu-screen-recorder (%s not found), looking for gsr-kms-server in PATH instead\n", server_filepath); + if(!find_program_in_path("gsr-kms-server", server_filepath, sizeof(server_filepath)) || access(server_filepath, F_OK) != 0) { \ No newline at end of file diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm index 482ff685d6c..7358276ecef 100644 --- a/gnu/packages/video.scm +++ b/gnu/packages/video.scm @@ -2561,6 +2561,79 @@ combination of audio, video, subtitles, metadata, scalable graphics, encrypted media, 2D/3D graphics and ECMAScript.") (license license:lgpl2.1+)))) +(define-public gpu-screen-recorder + (package + (name "gpu-screen-recorder") + (version "5.15.3") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://repo.dec05eba.com/gpu-screen-recorder") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1kiqvbs9fbgm5gxlxfybnyfmd0chgi7gzm6wr1cpafnvg1x203dm")) + (patches + (search-patches + "gpu-screen-recorder-privileged-kms-helper.patch")))) + (build-system meson-build-system) + (arguments + (list + #:configure-flags + #~(list "-Dsystemd=false" + "-Dcapabilities=false" + "-Dnvidia_suspend_fix=false") + #:tests? #f ;no test suite + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'patch-runtime-paths + (lambda* (#:key inputs #:allow-other-keys) + (substitute* '("src/egl.c" + "src/codec_query/vulkan.c" + "src/capture/v4l2.c" + "src/image_writer.c") + (("dlopen\\(\"([^\"]*)\"," match library) + (format #f "dlopen(~s," + (search-input-file + inputs (string-append "lib/" library))))) + + (substitute* "kms/client/kms_client.c" + (("const char \\*args\\[\\] = \\{ \"pkexec\",") + (format #f "const char *args[] = { ~s," + (search-input-file inputs "bin/pkexec"))))))))) + (native-inputs + (list pkg-config + wayland)) + (inputs + (list dbus + ffmpeg + libcap + libdrm + libglvnd + libjpeg-turbo + libva + libx11 + libxcomposite + libxdamage + libxfixes + libxrandr + pipewire + polkit + pulseaudio + vulkan-headers + vulkan-loader + wayland)) + (home-page "https://git.dec05eba.com/gpu-screen-recorder/about") + (synopsis "GPU-accelerated screen recorder") + (description + "GPU Screen Recorder records monitors, windows, regions, and applications +using hardware-accelerated video encoding. It supports X11 and Wayland, +desktop-portal capture, application audio capture, screenshots, streaming, and +replay buffering.") + (license license:gpl3))) + (define-public vlc (package (name "vlc") -- cgit v1.2.3