Merge pull request #324585 from timschumi/gsr-2024-07-04

gpu-screen-recorder{,-gtk}: Update to unstable-2024-07-05 (+ systemd unit and capabilities)
This commit is contained in:
Guillaume Girol 2024-07-13 17:05:00 +02:00 committed by GitHub
commit 98f7683671
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 126 additions and 22 deletions

View File

@ -20276,6 +20276,12 @@
githubId = 2845239;
name = "Tim Put";
};
timschumi = {
email = "timschumi@gmx.de";
github = "timschumi";
githubId = 16820960;
name = "Tim Schumacher";
};
timstott = {
email = "stott.timothy@gmail.com";
github = "timstott";

View File

@ -205,6 +205,7 @@
./programs/goldwarden.nix
./programs/gpaste.nix
./programs/gphoto2.nix
./programs/gpu-screen-recorder.nix
./programs/haguichi.nix
./programs/hamster.nix
./programs/htop.nix

View File

@ -0,0 +1,40 @@
{ config, lib, pkgs, ... }:
let
cfg = config.programs.gpu-screen-recorder;
package = cfg.package.override {
inherit (config.security) wrapperDir;
};
in {
options = {
programs.gpu-screen-recorder = {
package = lib.mkPackageOption pkgs "gpu-screen-recorder" {};
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to install gpu-screen-recorder and generate setcap
wrappers for promptless recording.
'';
};
};
};
config = lib.mkIf cfg.enable {
security.wrappers."gsr-kms-server" = {
owner = "root";
group = "root";
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 ];
}

View File

@ -0,0 +1,25 @@
From cd8c6561079ee4c53b4bed390edd75a730ac685d Mon Sep 17 00:00:00 2001
From: Tim Schumacher <timschumi@gmx.de>
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

View File

@ -2,6 +2,8 @@
, lib
, fetchurl
, makeWrapper
, meson
, ninja
, pkg-config
, libXcomposite
, libpulseaudio
@ -10,24 +12,30 @@
, libdrm
, libva
, libglvnd
, libXdamage
, libXi
, libXrandr
, libXfixes
, wrapperDir ? "/run/wrappers/bin"
}:
stdenv.mkDerivation {
pname = "gpu-screen-recorder";
version = "unstable-2024-05-21";
version = "unstable-2024-07-05";
# 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.r594.e572073.tar.gz";
hash = "sha256-MTBxhvkoyotmRUx1sRN/7ruXBYwIbOFQNdJHhZ3DdDk=";
url = "https://dec05eba.com/snapshot/gpu-screen-recorder.git.r641.48cd80f.tar.gz";
hash = "sha256-hIEK8EYIxQTTiFePPZf4V0nsxqxkfcDeOG9GK9whn+0=";
};
sourceRoot = ".";
nativeBuildInputs = [
pkg-config
makeWrapper
meson
ninja
];
buildInputs = [
@ -37,20 +45,29 @@ stdenv.mkDerivation {
wayland
libdrm
libva
libXdamage
libXi
libXrandr
libXfixes
];
buildPhase = ''
./build.sh
'';
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"
];
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 : ${wrapperDir} \
--suffix PATH : $out/bin
'';

View File

@ -1,47 +1,62 @@
{ stdenv
, lib
, fetchgit
, 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.mkDerivation {
pname = "gpu-screen-recorder-gtk";
version = "3.7.6";
version = "unstable-2024-07-05";
src = fetchgit {
url = "https://repo.dec05eba.com/gpu-screen-recorder-gtk";
rev = "cd777c1506e20514df4b97345e480051cbaf9693";
hash = "sha256-ZBYYsW75tq8TaZp0F4v7YIHKHk/DFBIGy3X781ho2oE=";
# 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=";
};
sourceRoot = ".";
nativeBuildInputs = [
desktop-file-utils
pkg-config
makeWrapper
meson
ninja
wrapGAppsHook3
];
buildInputs = [
gtk3
libayatana-appindicator
libpulseaudio
libdrm
libX11
libXrandr
wayland
];
buildPhase = ''
./build.sh
'';
installPhase = ''
install -Dt $out/bin/ gpu-screen-recorder-gtk
install -Dt $out/share/applications/ gpu-screen-recorder-gtk.desktop
gappsWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ gpu-screen-recorder ]})
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)
'';