-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gpu-screen-recorder-ui: init at 1.0.0 #369574
Draft
js6pak
wants to merge
3
commits into
NixOS:master
Choose a base branch
from
js6pak:gpu-screen-recorder-ui/init
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+199
−0
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = { | ||
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 ]; | ||
} |
58 changes: 58 additions & 0 deletions
58
pkgs/applications/video/gpu-screen-recorder/gpu-screen-recorder-notification.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 \ | ||
Atemu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
--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; | ||
}; | ||
} |
90 changes: 90 additions & 0 deletions
90
pkgs/applications/video/gpu-screen-recorder/gpu-screen-recorder-ui.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 = "."; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for this |
||
|
||
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" | ||
Atemu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stdenv
expects thesrc
to have a single directory after extracting if you don't setsourceRoot
. But this tarball isn't like that, it has the source files directly in rootThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the src a tarball anyways? Why not use
fetchgit
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just followed what @babbaj did for
gpu-screen-recorder{,-gtk}
, found reasoning for the initial change here: #268443 (comment) (upstream asked for it)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. I don't think that reasoning is sound though as fetchgit does indeed do a "shallow" clone (
--depth=1
) and, unless the speed is abhorrently slow, this doesn't really matter. Each revision needs to be fetched once by a handful of instances:Most everyone else will either get the cached binary output path and doesn't need to fetch the source at all or they will fetch the cached source path from hydra.
If you really don't want
fetchgit
, you should at least usefetchzip
instead.cc @dec05eba
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src taraball is preferred as its faster on the slow server and increases the load less. But in this case where it does a shallow clone and clone is only done by the ones you mentioned then fetchgit is ok, if it provides a benefit. The git link is primarly intended for development, not distribution, so it's discouraged unless there is a reason to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Atemu What's even the advantage of
fetchgit
here? And forfetchzip
vsfetchurl
, I guess the only difference is whether you hash the contents or the compressed file?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fetchgit is the closest to the actual source.
As we've learned in April, a tarball can contain anything Jia Tan wants it to and it's quite a lot easier to hide stuff in a rando tarball download vs. a git history.
fetchzip unpacks a given archive and thereby abstracts away any oddities in how it's packaged up which you had to work around here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On my machine fetching the tarball takes about 0.3s, while doing a shallow clone takes ~0.6s.
So with the increased load concern being solved by hydra, I'll go with
fetchgit
.