Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
./programs/gnupg.nix
./programs/gpaste.nix
./programs/gphoto2.nix
./programs/gpu-screen-recorder-ui.nix
./programs/gpu-screen-recorder.nix
./programs/haguichi.nix
./programs/hamster.nix
Expand Down
46 changes: 46 additions & 0 deletions nixos/modules/programs/gpu-screen-recorder-ui.nix
Original file line number Diff line number Diff line change
@@ -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 = {
Copy link
Member

Choose a reason for hiding this comment

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

+1 on having this be in programs.gpu-screen-recorder.ui or something similar instead of clogging up the namespace.

Copy link
Member Author

Choose a reason for hiding this comment

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

My thinking is that gpu-screen-recorder/gpu-screen-recorder-ui are designed in a way to be independent of each other, so it makes sense to treat them as separate projects. The frontend could have very well been made by a different person, in which case it would feel weird to merge the options.

Copy link
Member

Choose a reason for hiding this comment

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

gpu-screen-recorder-ui assumes that it can call gpu-screen-recorder with very specific options, so that sounds highly dependent to me (and we are even setting programs.gpu-screen-recorder.enabled if programs.gpu-screen-recorder-ui.enabled is given). Further, even if someone makes a compatible third-party backend in the future then the contract would still feasibly be named gpu-screen-recorder, since that is what the compatibility is measured by.

Therefore, it would be reasonable to have everything in programs.gpu-screen-recorder, since there will be programs.gpu-screen-recorder.package to adjust the backend implementation and programs.gpu-screen-recorder.ui.package to adjust the frontend implementation (and the respective enable options, obviously).

That said, according to the derivation, gpu-screen-recorder-ui currently strictly depends on the gpu-screen-recorder derivation with no way of changing that, so any argument about them being any kind of independent is moot anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

Current programs.gpu-screen-recorder/programs.gpu-screen-recorder-ui modules are really only for the setuid wrappers, so an alternative frontend wouldn't have a reason to reuse it. Like in my mind, what you are suggesting would be akin to adding a programs.ffmpeg.{vlc,mpv}.enable.

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 ];
}
61 changes: 61 additions & 0 deletions pkgs/by-name/gp/gpu-screen-recorder-notification/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
lib,
stdenv,
fetchgit,
pkg-config,
meson,
ninja,
libx11,
libxrender,
libxrandr,
libxext,
libglvnd,
wayland,
wayland-scanner,
gitUpdater,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "gpu-screen-recorder-notification";
version = "1.1.0";

src = fetchgit {
url = "https://repo.dec05eba.com/gpu-screen-recorder-notification";
tag = finalAttrs.version;
hash = "sha256-ODifZ046DEBNiGT3+S6pQyF8ekrb6LIHWton8nv1MBo=";
};

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
wayland
wayland-scanner
];

passthru.updateScript = gitUpdater { };

meta = {
description = "Notification in the style of ShadowPlay";
homepage = "https://git.dec05eba.com/gpu-screen-recorder-notification/about/";
license = lib.licenses.gpl3Only;
mainProgram = "gsr-notify";
maintainers = with lib.maintainers; [ js6pak ];
platforms = lib.platforms.linux;
};
})
108 changes: 108 additions & 0 deletions pkgs/by-name/gp/gpu-screen-recorder-ui/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
lib,
stdenv,
fetchgit,
pkg-config,
meson,
ninja,
makeWrapper,
gpu-screen-recorder,
gpu-screen-recorder-notification,
libx11,
libxrender,
libxrandr,
libxcomposite,
libxi,
libxcursor,
libglvnd,
libpulseaudio,
libdrm,
dbus,
wayland,
wayland-scanner,
wrapperDir ? "/run/wrappers/bin",
gitUpdater,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "gpu-screen-recorder-ui";
version = "1.10.8";

src = fetchgit {
url = "https://repo.dec05eba.com/gpu-screen-recorder-ui";
tag = finalAttrs.version;
hash = "sha256-x7MBTUWDKCzClq4ukgtFazOD/RLkX5lgmm9slN5BjVk=";
};

patches = [
./remove-gnome-postinstall.patch
];

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=gsr-ui" "ExecStart=$out/bin/gsr-ui"

substituteInPlace gpu-screen-recorder.desktop \
--replace-fail "Exec=gsr-ui" "Exec=$out/bin/gsr-ui"
'';

nativeBuildInputs = [
pkg-config
meson
ninja
makeWrapper
];

buildInputs = [
libx11
libxrender
libxrandr
libxcomposite
libxi
libxcursor
libglvnd
libpulseaudio
libdrm
dbus
wayland
wayland-scanner
];

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/gsr-ui" \
--prefix PATH : "${wrapperDir}" \
--suffix PATH : "${
lib.makeBinPath [
gpu-screen-recorder-wrapped
gpu-screen-recorder-notification
]
}"
'';

passthru.updateScript = gitUpdater { };

meta = {
description = "Fullscreen overlay UI for GPU Screen Recorder in the style of ShadowPlay";
homepage = "https://git.dec05eba.com/gpu-screen-recorder-ui/about/";
license = lib.licenses.gpl3Only;
mainProgram = "gsr-ui";
maintainers = with lib.maintainers; [ js6pak ];
platforms = lib.platforms.linux;
};
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/meson.build b/meson.build
index cf16e81..7c3629d 100644
--- a/meson.build
+++ b/meson.build
@@ -147,9 +147,6 @@ install_subdir('translations', install_dir : gsr_ui_resources_path)
if get_option('desktop-files') == true
install_data(files('gpu-screen-recorder.desktop'), install_dir : join_paths(prefix, datadir, 'applications'))
install_subdir('icons/hicolor', install_dir : icons_path)
-
- gnome = import('gnome')
- gnome.post_install(update_desktop_database : true)
endif

if get_option('systemd') == true
Loading