refactor(gsr): clean up packaging
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
58b75ee224
commit
ef11b36f84
5 changed files with 62 additions and 18 deletions
|
@ -5,28 +5,27 @@
|
|||
self,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) concatStringsSep removePrefix;
|
||||
|
||||
inherit (lib) concatStringsSep getExe removePrefix;
|
||||
inherit (config.vars) mainUser;
|
||||
inherit (self.packages.${pkgs.system}) gpu-screen-recorder gsr-kms-server;
|
||||
|
||||
hyprPkgs = config.home-manager.users.${mainUser}.wayland.windowManager.hyprland.finalPackage;
|
||||
|
||||
cfgDesktop = config.roles.desktop;
|
||||
|
||||
pkg = self.packages.${pkgs.system}.gpu-screen-recorder;
|
||||
hyprPkgs = config.home-manager.users.${mainUser}.wayland.windowManager.hyprland.finalPackage;
|
||||
in {
|
||||
security.wrappers = {
|
||||
gpu-screen-recorder = {
|
||||
owner = "root";
|
||||
group = "video";
|
||||
capabilities = "cap_sys_nice+ep";
|
||||
source = "${pkg.gsr}/bin/gpu-screen-recorder";
|
||||
source = getExe gpu-screen-recorder;
|
||||
};
|
||||
|
||||
gsr-kms-server = {
|
||||
owner = "root";
|
||||
group = "video";
|
||||
capabilities = "cap_sys_admin+ep";
|
||||
source = "${pkg.kms}/bin/gsr-kms-server";
|
||||
source = getExe gsr-kms-server;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -34,7 +33,9 @@ in {
|
|||
home.packages = [
|
||||
(pkgs.writeShellApplication {
|
||||
name = "gpu-save-replay";
|
||||
runtimeInputs = [pkgs.procps];
|
||||
|
||||
runtimeInputs = with pkgs; [procps];
|
||||
|
||||
text = ''
|
||||
pkill --signal SIGUSR1 -f gpu-screen-recorder
|
||||
'';
|
||||
|
@ -42,7 +43,16 @@ in {
|
|||
|
||||
(pkgs.writeShellApplication {
|
||||
name = "gsr-start";
|
||||
runtimeInputs = [pkgs.pulseaudio hyprPkgs pkgs.xorg.xrandr];
|
||||
|
||||
runtimeInputs = [
|
||||
pkgs.pulseaudio
|
||||
pkgs.xorg.xrandr
|
||||
|
||||
gpu-screen-recorder
|
||||
gsr-kms-server
|
||||
hyprPkgs
|
||||
];
|
||||
|
||||
text = ''
|
||||
main="${removePrefix "desc:" cfgDesktop.mainMonitor}"
|
||||
WINDOW=$(hyprctl -j monitors | jq '.[] |= (.description |= gsub(","; ""))' | jq -r ".[] | select(.description | test(\"$main\")) | .name")
|
||||
|
|
|
@ -4,7 +4,10 @@
|
|||
pkgs,
|
||||
...
|
||||
}: {
|
||||
gpu-screen-recorder = pkgs.callPackage ./gpu-screen-recorder {
|
||||
gpu-screen-recorder = pkgs.callPackage ./gpu-screen-recorder/gpu-screen-recorder.nix {
|
||||
inherit (inputs) gpu-screen-recorder-src;
|
||||
};
|
||||
gsr-kms-server = pkgs.callPackage ./gpu-screen-recorder/gsr-kms-server.nix {
|
||||
inherit (inputs) gpu-screen-recorder-src;
|
||||
};
|
||||
|
||||
|
|
|
@ -62,6 +62,8 @@ in
|
|||
];
|
||||
|
||||
fixupPhase = ''
|
||||
runHook preFixup
|
||||
|
||||
wrapProgram $out/bin/gpu-screen-recorder \
|
||||
--prefix LD_LIBRARY_PATH : "${
|
||||
makeLibraryPath [
|
||||
|
@ -70,16 +72,9 @@ in
|
|||
]
|
||||
}"
|
||||
|
||||
# This is needed to force gsr to lookup kms in PATH
|
||||
# to get the security wrapper
|
||||
mkdir -p $gsr $kms/bin
|
||||
cp -r $out/bin $gsr
|
||||
mv $gsr/bin/gsr-kms-server $kms/bin
|
||||
rm $out/bin/gsr-kms-server
|
||||
runHook postFixup
|
||||
'';
|
||||
|
||||
outputs = ["out" "gsr" "kms"];
|
||||
|
||||
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/";
|
16
packages/gpu-screen-recorder/gpu-screen-recorder.nix
Normal file
16
packages/gpu-screen-recorder/gpu-screen-recorder.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
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;};
|
||||
})
|
20
packages/gpu-screen-recorder/gsr-kms-server.nix
Normal file
20
packages/gpu-screen-recorder/gsr-kms-server.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
callPackage,
|
||||
gpu-screen-recorder-src,
|
||||
...
|
||||
}: let
|
||||
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;};
|
||||
})
|
Loading…
Reference in a new issue