From e221c4178fdc3330b3780b3508dc4e867c679702 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Tue, 26 Nov 2024 20:48:07 -0500 Subject: [PATCH] fix(gsr): remove from path of script --- devices/binto/modules/gpu-replay.nix | 2 -- packages/gpu-screen-recorder/generic.nix | 20 ++++++++++++++++++- .../gpu-screen-recorder.nix | 17 +++++----------- .../gpu-screen-recorder/gsr-kms-server.nix | 19 ++++-------------- 4 files changed, 28 insertions(+), 30 deletions(-) diff --git a/devices/binto/modules/gpu-replay.nix b/devices/binto/modules/gpu-replay.nix index 998cda1d..bce81293 100644 --- a/devices/binto/modules/gpu-replay.nix +++ b/devices/binto/modules/gpu-replay.nix @@ -48,8 +48,6 @@ in { pkgs.pulseaudio pkgs.xorg.xrandr - gpu-screen-recorder - gsr-kms-server hyprPkgs ]; diff --git a/packages/gpu-screen-recorder/generic.nix b/packages/gpu-screen-recorder/generic.nix index af45ab7d..009b2fbd 100644 --- a/packages/gpu-screen-recorder/generic.nix +++ b/packages/gpu-screen-recorder/generic.nix @@ -17,6 +17,7 @@ vulkan-headers, wayland, xorg, + pname, ... }: let inherit (lib) makeLibraryPath; @@ -28,7 +29,7 @@ .version; in stdenv.mkDerivation { - pname = "gpu-screen-recorder"; + inherit pname; version = "${tag}+${gpu-screen-recorder-src.shortRev}"; src = gpu-screen-recorder-src; @@ -75,10 +76,27 @@ in runHook postFixup ''; + # This is needed to force gsr to lookup kms in PATH + # to get the security wrapper + postFixup = + if pname == "gpu-screen-recorder" + then + # bash + '' + rm $out/bin/gsr-kms-server + '' + else + # bash + '' + rm $out/bin/gpu-screen-recorder + rm $out/bin/.gpu-screen-recorder-wrapped + ''; + meta = { description = "Screen recorder that has minimal impact on system performance by recording a window using the GPU only"; homepage = "https://git.dec05eba.com/gpu-screen-recorder/about/"; license = lib.licenses.gpl3Only; platforms = ["x86_64-linux"]; + mainProgram = pname; }; } diff --git a/packages/gpu-screen-recorder/gpu-screen-recorder.nix b/packages/gpu-screen-recorder/gpu-screen-recorder.nix index 8728e399..431128ba 100644 --- a/packages/gpu-screen-recorder/gpu-screen-recorder.nix +++ b/packages/gpu-screen-recorder/gpu-screen-recorder.nix @@ -2,15 +2,8 @@ callPackage, gpu-screen-recorder-src, ... -}: let - gsr = callPackage ./generic.nix {inherit gpu-screen-recorder-src;}; -in - gsr.overrideAttrs (o: { - postFixup = '' - # This is needed to force gsr to lookup kms in PATH - # to get the security wrapper - rm $out/bin/gsr-kms-server - ''; - - meta = o.meta // {mainProgram = o.pname;}; - }) +}: +callPackage ./generic.nix { + pname = "gpu-screen-recorder"; + inherit gpu-screen-recorder-src; +} diff --git a/packages/gpu-screen-recorder/gsr-kms-server.nix b/packages/gpu-screen-recorder/gsr-kms-server.nix index 6155984e..5278c3eb 100644 --- a/packages/gpu-screen-recorder/gsr-kms-server.nix +++ b/packages/gpu-screen-recorder/gsr-kms-server.nix @@ -2,19 +2,8 @@ callPackage, gpu-screen-recorder-src, ... -}: let +}: +callPackage ./generic.nix { pname = "gsr-kms-server"; - gsr = callPackage ./generic.nix {inherit gpu-screen-recorder-src;}; -in - gsr.overrideAttrs (o: { - inherit pname; - - postFixup = '' - # This is needed to force gsr to lookup kms in PATH - # to get the security wrapper - rm $out/bin/gpu-screen-recorder - rm $out/bin/.gpu-screen-recorder-wrapped - ''; - - meta = o.meta // {mainProgram = pname;}; - }) + inherit gpu-screen-recorder-src; +}