diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 92e8db5ee8e1c..8c06875bb1c64 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -217,6 +217,7 @@ ./programs/gpaste.nix ./programs/gphoto2.nix ./programs/gpu-screen-recorder.nix + ./programs/gpu-screen-recorder-ui.nix ./programs/haguichi.nix ./programs/hamster.nix ./programs/htop.nix diff --git a/nixos/modules/programs/gpu-screen-recorder-ui.nix b/nixos/modules/programs/gpu-screen-recorder-ui.nix new file mode 100644 index 0000000000000..a28dbc26c6299 --- /dev/null +++ b/nixos/modules/programs/gpu-screen-recorder-ui.nix @@ -0,0 +1,46 @@ +{ + config, + lib, + pkgs, + ... +}: + +let + cfg = config.programs.gpu-screen-recorder-ui; + package = cfg.package.override { + inherit (config.security) wrapperDir; + }; +in +{ + options = { + programs.gpu-screen-recorder-ui = { + package = lib.mkPackageOption pkgs "gpu-screen-recorder-ui" { }; + + enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Whether to install gpu-screen-recorder-ui and generate setcap + wrappers for global hotkeys. + ''; + }; + }; + }; + + config = lib.mkIf cfg.enable { + programs.gpu-screen-recorder.enable = lib.mkDefault true; + + environment.systemPackages = [ package ]; + + systemd.packages = [ package ]; + + security.wrappers."gsr-global-hotkeys" = { + owner = "root"; + group = "root"; + capabilities = "cap_setuid+ep"; + source = lib.getExe' package "gsr-global-hotkeys"; + }; + }; + + meta.maintainers = with lib.maintainers; [ js6pak ]; +} diff --git a/pkgs/applications/video/gpu-screen-recorder/gpu-screen-recorder-notification.nix b/pkgs/applications/video/gpu-screen-recorder/gpu-screen-recorder-notification.nix new file mode 100644 index 0000000000000..098be383a7dae --- /dev/null +++ b/pkgs/applications/video/gpu-screen-recorder/gpu-screen-recorder-notification.nix @@ -0,0 +1,58 @@ +{ + lib, + stdenv, + fetchurl, + pkg-config, + meson, + ninja, + libX11, + libXrender, + libXrandr, + libXext, + libglvnd, + gitUpdater, +}: + +stdenv.mkDerivation rec { + pname = "gpu-screen-recorder-notification"; + version = "1.0.0"; + + src = fetchurl { + url = "https://dec05eba.com/snapshot/${pname}.git.${version}.tar.gz"; + hash = "sha256-cyM3y1MYZNEHKyiyAqYXcSwZe0tcnPNukxErm/dIo6Y="; + }; + + sourceRoot = "."; + + postPatch = '' + substituteInPlace depends/mglpp/depends/mgl/src/gl.c \ + --replace-fail "libGL.so.1" "${lib.getLib libglvnd}/lib/libGL.so.1" \ + --replace-fail "libGLX.so.0" "${lib.getLib libglvnd}/lib/libGLX.so.0" \ + --replace-fail "libEGL.so.1" "${lib.getLib libglvnd}/lib/libEGL.so.1" + ''; + + nativeBuildInputs = [ + pkg-config + meson + ninja + ]; + + buildInputs = [ + libX11 + libXrender + libXrandr + libXext + libglvnd + ]; + + passthru.updateScript = gitUpdater { url = "https://repo.dec05eba.com/${pname}"; }; + + meta = { + description = "Notification in the style of ShadowPlay"; + homepage = "https://git.dec05eba.com/${pname}/about/"; + license = lib.licenses.gpl3Only; + mainProgram = "gsr-notify"; + maintainers = with lib.maintainers; [ js6pak ]; + platforms = lib.platforms.linux; + }; +} diff --git a/pkgs/applications/video/gpu-screen-recorder/gpu-screen-recorder-ui.nix b/pkgs/applications/video/gpu-screen-recorder/gpu-screen-recorder-ui.nix new file mode 100644 index 0000000000000..1a292fe963cd0 --- /dev/null +++ b/pkgs/applications/video/gpu-screen-recorder/gpu-screen-recorder-ui.nix @@ -0,0 +1,90 @@ +{ + lib, + stdenv, + fetchurl, + pkg-config, + meson, + ninja, + makeWrapper, + gpu-screen-recorder, + gpu-screen-recorder-notification, + libX11, + libXrender, + libXrandr, + libXcomposite, + libXi, + libglvnd, + wrapperDir ? "/run/wrappers/bin", + gitUpdater, +}: + +stdenv.mkDerivation rec { + pname = "gpu-screen-recorder-ui"; + version = "1.0.0"; + + src = fetchurl { + url = "https://dec05eba.com/snapshot/${pname}.git.${version}.tar.gz"; + hash = "sha256-2gB6FWys5RGDlwc1OZ0NnjU8eIGJefpjc94YKJSnyPI="; + }; + + sourceRoot = "."; + + postPatch = '' + substituteInPlace depends/mglpp/depends/mgl/src/gl.c \ + --replace-fail "libGL.so.1" "${lib.getLib libglvnd}/lib/libGL.so.1" \ + --replace-fail "libGLX.so.0" "${lib.getLib libglvnd}/lib/libGLX.so.0" \ + --replace-fail "libEGL.so.1" "${lib.getLib libglvnd}/lib/libEGL.so.1" + + substituteInPlace extra/gpu-screen-recorder-ui.service \ + --replace-fail "ExecStart=${meta.mainProgram}" "ExecStart=$out/bin/${meta.mainProgram}" + ''; + + nativeBuildInputs = [ + pkg-config + meson + ninja + makeWrapper + ]; + + buildInputs = [ + libX11 + libXrender + libXrandr + libXcomposite + libXi + libglvnd + ]; + + mesonFlags = [ + # Handled by the module + (lib.mesonBool "capabilities" false) + ]; + + postInstall = + let + gpu-screen-recorder-wrapped = gpu-screen-recorder.override { + inherit wrapperDir; + }; + in + '' + wrapProgram "$out/bin/${meta.mainProgram}" \ + --prefix PATH : "${wrapperDir}" \ + --suffix PATH : "${ + lib.makeBinPath [ + gpu-screen-recorder-wrapped + gpu-screen-recorder-notification + ] + }" + ''; + + passthru.updateScript = gitUpdater { url = "https://repo.dec05eba.com/${pname}"; }; + + meta = { + description = "A fullscreen overlay UI for GPU Screen Recorder in the style of ShadowPlay"; + homepage = "https://git.dec05eba.com/${pname}/about/"; + license = lib.licenses.gpl3Only; + mainProgram = "gsr-ui"; + maintainers = with lib.maintainers; [ js6pak ]; + platforms = lib.platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a459d34c15bc1..9a0ad17948c25 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13960,6 +13960,10 @@ with pkgs; gpu-screen-recorder-gtk = callPackage ../applications/video/gpu-screen-recorder/gpu-screen-recorder-gtk.nix { }; + gpu-screen-recorder-notification = callPackage ../applications/video/gpu-screen-recorder/gpu-screen-recorder-notification.nix { }; + + gpu-screen-recorder-ui = callPackage ../applications/video/gpu-screen-recorder/gpu-screen-recorder-ui.nix { }; + gpxsee-qt5 = libsForQt5.callPackage ../applications/misc/gpxsee { }; gpxsee-qt6 = qt6Packages.callPackage ../applications/misc/gpxsee { };