Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{nixos/gpu-screen-recorder,gpu-screen-recorder{-,gtk}}: update to 4.1.11, remove cap_sys_nice #339874

Merged
merged 12 commits into from
Oct 14, 2024
Merged
18 changes: 9 additions & 9 deletions nixos/modules/programs/gpu-screen-recorder.nix
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 ];
Expand Down

This file was deleted.

45 changes: 28 additions & 17 deletions pkgs/applications/video/gpu-screen-recorder/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@
makeWrapper,
meson,
ninja,
addDriverRunpath,
pkg-config,
libXcomposite,
libpulseaudio,
dbus,
ffmpeg,
wayland,
DontEatOreo marked this conversation as resolved.
Show resolved Hide resolved
vulkan-headers,
pipewire,
libdrm,
libva,
libglvnd,
Expand All @@ -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 = [
Expand All @@ -42,8 +45,11 @@ stdenv.mkDerivation {
buildInputs = [
libXcomposite
libpulseaudio
dbus
ffmpeg
pipewire
wayland
DontEatOreo marked this conversation as resolved.
Show resolved Hide resolved
vulkan-headers
libdrm
libva
libXdamage
Expand All @@ -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)
DontEatOreo marked this conversation as resolved.
Show resolved Hide resolved
(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" ];
};
}
})
Original file line number Diff line number Diff line change
@@ -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 = [
Expand All @@ -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})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can amend a list to the var

gappsWrapperArgs+=(--suffix PATH : ${lib.makeBinPath [ gpu-screen-recorder-wrapped ]})
gappsWrapperArgs+=(--prefix LD_LIBRARY_PATH : ${
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot use patchelf?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not exactly sure how that would be implemented..

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" ];
};
}
})