diff --git a/nixos/modules/programs/gpu-screen-recorder.nix b/nixos/modules/programs/gpu-screen-recorder.nix index 39d0e2545241..5a9401943dfe 100644 --- a/nixos/modules/programs/gpu-screen-recorder.nix +++ b/nixos/modules/programs/gpu-screen-recorder.nix @@ -1,14 +1,20 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.programs.gpu-screen-recorder; package = cfg.package.override { inherit (config.security) wrapperDir; }; -in { +in +{ options = { programs.gpu-screen-recorder = { - package = lib.mkPackageOption pkgs "gpu-screen-recorder" {}; + package = lib.mkPackageOption pkgs "gpu-screen-recorder" { }; enable = lib.mkOption { type = lib.types.bool; @@ -28,12 +34,6 @@ in { capabilities = "cap_sys_admin+ep"; source = "${package}/bin/gsr-kms-server"; }; - security.wrappers."gpu-screen-recorder" = { - owner = "root"; - group = "root"; - capabilities = "cap_sys_nice+ep"; - source = "${package}/bin/gpu-screen-recorder"; - }; }; meta.maintainers = with lib.maintainers; [ timschumi ]; diff --git a/pkgs/applications/video/gpu-screen-recorder/0001-Don-t-install-systemd-unit-files-using-absolute-path.patch b/pkgs/applications/video/gpu-screen-recorder/0001-Don-t-install-systemd-unit-files-using-absolute-path.patch deleted file mode 100644 index 1403d59b86ba..000000000000 --- a/pkgs/applications/video/gpu-screen-recorder/0001-Don-t-install-systemd-unit-files-using-absolute-path.patch +++ /dev/null @@ -1,25 +0,0 @@ -From cd8c6561079ee4c53b4bed390edd75a730ac685d Mon Sep 17 00:00:00 2001 -From: Tim Schumacher -Date: Thu, 4 Jul 2024 16:26:36 +0200 -Subject: [PATCH] Don't install systemd unit files using absolute paths - ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/meson.build b/meson.build -index a188f16..7807abe 100644 ---- a/meson.build -+++ b/meson.build -@@ -54,7 +54,7 @@ executable('gsr-kms-server', 'kms/server/kms_server.c', dependencies : dependenc - executable('gpu-screen-recorder', src, dependencies : dep, install : true) - - if get_option('systemd') == true -- install_data(files('extra/gpu-screen-recorder.service'), install_dir : '/usr/lib/systemd/user') -+ install_data(files('extra/gpu-screen-recorder.service'), install_dir : 'lib/systemd/user') - endif - - if get_option('capabilities') == true --- -2.45.1 - diff --git a/pkgs/applications/video/gpu-screen-recorder/default.nix b/pkgs/applications/video/gpu-screen-recorder/default.nix index 663d82640247..3df7380579eb 100644 --- a/pkgs/applications/video/gpu-screen-recorder/default.nix +++ b/pkgs/applications/video/gpu-screen-recorder/default.nix @@ -5,11 +5,15 @@ makeWrapper, meson, ninja, + addDriverRunpath, pkg-config, libXcomposite, libpulseaudio, + dbus, ffmpeg, wayland, + vulkan-headers, + pipewire, libdrm, libva, libglvnd, @@ -20,16 +24,15 @@ wrapperDir ? "/run/wrappers/bin", }: -stdenv.mkDerivation { +stdenv.mkDerivation (finalAttrs: { pname = "gpu-screen-recorder"; - version = "unstable-2024-07-05"; + version = "4.2.1"; - # Snapshot tarballs use the following versioning format: - # 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.r641.48cd80f.tar.gz"; - hash = "sha256-hIEK8EYIxQTTiFePPZf4V0nsxqxkfcDeOG9GK9whn+0="; + url = "https://dec05eba.com/snapshot/gpu-screen-recorder.git.${finalAttrs.version}.tar.gz"; + hash = "sha256-eCjAlPEg8lkL8T0lgxr0F8ouFGwqfsRxDSQuG6RbpZE="; }; + sourceRoot = "."; nativeBuildInputs = [ @@ -42,8 +45,11 @@ stdenv.mkDerivation { buildInputs = [ libXcomposite libpulseaudio + dbus ffmpeg + pipewire wayland + vulkan-headers libdrm libva libXdamage @@ -52,30 +58,35 @@ stdenv.mkDerivation { libXfixes ]; - patches = [ ./0001-Don-t-install-systemd-unit-files-using-absolute-path.patch ]; - mesonFlags = [ - "-Dsystemd=true" - - # Capabilities are handled by security.wrappers if possible. - "-Dcapabilities=false" + # Enable Wayland support + (lib.mesonBool "portal" true) + # Handle by the module + (lib.mesonBool "capabilities" false) + (lib.mesonBool "systemd" false) + (lib.mesonBool "nvidia_suspend_fix" false) ]; postInstall = '' 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 : ${wrapperDir} \ - --suffix PATH : $out/bin + --prefix LD_LIBRARY_PATH : "${ + lib.makeLibraryPath [ + libglvnd + addDriverRunpath.driverLink + ] + }" \ + --prefix PATH : "${wrapperDir}" \ + --suffix PATH : "$out/bin" ''; meta = { description = "Screen recorder that has minimal impact on system performance by recording a window using the GPU only"; - mainProgram = "gpu-screen-recorder"; homepage = "https://git.dec05eba.com/gpu-screen-recorder/about/"; license = lib.licenses.gpl3Only; + mainProgram = "gpu-screen-recorder"; maintainers = [ lib.maintainers.babbaj ]; platforms = [ "x86_64-linux" ]; }; -} +}) 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 b0c19e80a0be..d84527dcaebb 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,34 +1,35 @@ -{ stdenv -, lib -, fetchurl -, pkg-config -, desktop-file-utils -, makeWrapper -, meson -, ninja -, gtk3 -, libayatana-appindicator -, libpulseaudio -, libdrm -, gpu-screen-recorder -, libglvnd -, libX11 -, libXrandr -, wayland -, wrapGAppsHook3 -, wrapperDir ? "/run/wrappers/bin" +{ + stdenv, + lib, + fetchurl, + pkg-config, + addDriverRunpath, + desktop-file-utils, + makeWrapper, + meson, + ninja, + gtk3, + libayatana-appindicator, + libpulseaudio, + libdrm, + gpu-screen-recorder, + libglvnd, + libX11, + libXrandr, + wayland, + wrapGAppsHook3, + wrapperDir ? "/run/wrappers/bin", }: -stdenv.mkDerivation { +stdenv.mkDerivation (finalAttrs: { pname = "gpu-screen-recorder-gtk"; - version = "unstable-2024-07-05"; + version = "4.2.1"; - # Snapshot tarballs use the following versioning format: - # 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-gtk.git.r311.c611c51.tar.gz"; - hash = "sha256-86EdmeZ2dlffSfJOrTVGPtYyL3j6DmCQIALX2rpeS1Y="; + url = "https://dec05eba.com/snapshot/gpu-screen-recorder-gtk.git.${finalAttrs.version}.tar.gz"; + hash = "sha256-qk5bI23fypvv0yN9Ql7TOerBhoRzj65EcoAy3lMGMqc="; }; + sourceRoot = "."; nativeBuildInputs = [ @@ -50,23 +51,30 @@ stdenv.mkDerivation { wayland ]; - preFixup = let - gpu-screen-recorder-wrapped = gpu-screen-recorder.override { - inherit wrapperDir; - }; - in '' - gappsWrapperArgs+=(--prefix PATH : ${wrapperDir}) - gappsWrapperArgs+=(--suffix PATH : ${lib.makeBinPath [ gpu-screen-recorder-wrapped ]}) - # 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) - ''; + preFixup = + let + gpu-screen-recorder-wrapped = gpu-screen-recorder.override { + inherit wrapperDir; + }; + in + '' + gappsWrapperArgs+=(--prefix PATH : ${wrapperDir}) + gappsWrapperArgs+=(--suffix PATH : ${lib.makeBinPath [ gpu-screen-recorder-wrapped ]}) + gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : ${ + lib.makeLibraryPath [ + libglvnd + addDriverRunpath.driverLink + ] + }) + ''; meta = { + changelog = "https://git.dec05eba.com/gpu-screen-recorder-gtk/tree/com.dec05eba.gpu_screen_recorder.appdata.xml#n82"; description = "GTK frontend for gpu-screen-recorder."; - mainProgram = "gpu-screen-recorder-gtk"; homepage = "https://git.dec05eba.com/gpu-screen-recorder-gtk/about/"; license = lib.licenses.gpl3Only; + mainProgram = "gpu-screen-recorder-gtk"; maintainers = with lib.maintainers; [ babbaj ]; platforms = [ "x86_64-linux" ]; }; -} +})