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,
|
self,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) concatStringsSep removePrefix;
|
inherit (lib) concatStringsSep getExe removePrefix;
|
||||||
|
|
||||||
inherit (config.vars) mainUser;
|
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;
|
cfgDesktop = config.roles.desktop;
|
||||||
|
|
||||||
pkg = self.packages.${pkgs.system}.gpu-screen-recorder;
|
|
||||||
hyprPkgs = config.home-manager.users.${mainUser}.wayland.windowManager.hyprland.finalPackage;
|
|
||||||
in {
|
in {
|
||||||
security.wrappers = {
|
security.wrappers = {
|
||||||
gpu-screen-recorder = {
|
gpu-screen-recorder = {
|
||||||
owner = "root";
|
owner = "root";
|
||||||
group = "video";
|
group = "video";
|
||||||
capabilities = "cap_sys_nice+ep";
|
capabilities = "cap_sys_nice+ep";
|
||||||
source = "${pkg.gsr}/bin/gpu-screen-recorder";
|
source = getExe gpu-screen-recorder;
|
||||||
};
|
};
|
||||||
|
|
||||||
gsr-kms-server = {
|
gsr-kms-server = {
|
||||||
owner = "root";
|
owner = "root";
|
||||||
group = "video";
|
group = "video";
|
||||||
capabilities = "cap_sys_admin+ep";
|
capabilities = "cap_sys_admin+ep";
|
||||||
source = "${pkg.kms}/bin/gsr-kms-server";
|
source = getExe gsr-kms-server;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -34,7 +33,9 @@ in {
|
||||||
home.packages = [
|
home.packages = [
|
||||||
(pkgs.writeShellApplication {
|
(pkgs.writeShellApplication {
|
||||||
name = "gpu-save-replay";
|
name = "gpu-save-replay";
|
||||||
runtimeInputs = [pkgs.procps];
|
|
||||||
|
runtimeInputs = with pkgs; [procps];
|
||||||
|
|
||||||
text = ''
|
text = ''
|
||||||
pkill --signal SIGUSR1 -f gpu-screen-recorder
|
pkill --signal SIGUSR1 -f gpu-screen-recorder
|
||||||
'';
|
'';
|
||||||
|
@ -42,7 +43,16 @@ in {
|
||||||
|
|
||||||
(pkgs.writeShellApplication {
|
(pkgs.writeShellApplication {
|
||||||
name = "gsr-start";
|
name = "gsr-start";
|
||||||
runtimeInputs = [pkgs.pulseaudio hyprPkgs pkgs.xorg.xrandr];
|
|
||||||
|
runtimeInputs = [
|
||||||
|
pkgs.pulseaudio
|
||||||
|
pkgs.xorg.xrandr
|
||||||
|
|
||||||
|
gpu-screen-recorder
|
||||||
|
gsr-kms-server
|
||||||
|
hyprPkgs
|
||||||
|
];
|
||||||
|
|
||||||
text = ''
|
text = ''
|
||||||
main="${removePrefix "desc:" cfgDesktop.mainMonitor}"
|
main="${removePrefix "desc:" cfgDesktop.mainMonitor}"
|
||||||
WINDOW=$(hyprctl -j monitors | jq '.[] |= (.description |= gsub(","; ""))' | jq -r ".[] | select(.description | test(\"$main\")) | .name")
|
WINDOW=$(hyprctl -j monitors | jq '.[] |= (.description |= gsub(","; ""))' | jq -r ".[] | select(.description | test(\"$main\")) | .name")
|
||||||
|
|
|
@ -4,7 +4,10 @@
|
||||||
pkgs,
|
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;
|
inherit (inputs) gpu-screen-recorder-src;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,8 @@ in
|
||||||
];
|
];
|
||||||
|
|
||||||
fixupPhase = ''
|
fixupPhase = ''
|
||||||
|
runHook preFixup
|
||||||
|
|
||||||
wrapProgram $out/bin/gpu-screen-recorder \
|
wrapProgram $out/bin/gpu-screen-recorder \
|
||||||
--prefix LD_LIBRARY_PATH : "${
|
--prefix LD_LIBRARY_PATH : "${
|
||||||
makeLibraryPath [
|
makeLibraryPath [
|
||||||
|
@ -70,16 +72,9 @@ in
|
||||||
]
|
]
|
||||||
}"
|
}"
|
||||||
|
|
||||||
# This is needed to force gsr to lookup kms in PATH
|
runHook postFixup
|
||||||
# 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
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
outputs = ["out" "gsr" "kms"];
|
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "Screen recorder that has minimal impact on system performance by recording a window using the GPU only";
|
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/";
|
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