xpraWithNvenc: add nvjpeg support

This commit is contained in:
Corbin Wunderlich
2025-01-25 12:05:05 -05:00
parent fb8a07b82e
commit 941f3d430a
+27 -11
View File
@@ -9,6 +9,7 @@
atk,
cairo,
cudatoolkit,
cudaPackages,
ffmpeg,
gdk-pixbuf,
getopt,
@@ -40,7 +41,7 @@
xorgserver,
xxHash,
clang,
}:
}@args:
let
inherit (python3.pkgs) cython buildPythonApplication;
@@ -73,11 +74,18 @@ let
cp ${nv-codec-headers-10}/include/ffnvcodec/nvEncodeAPI.h $out/include
substituteAll ${./nvenc.pc} $out/lib/pkgconfig/nvenc.pc
'';
nvjpegHeaders = runCommand "nvjpeg-headers" { } ''
mkdir -p $out/include $out/lib/pkgconfig
substituteAll ${cudaPackages.libnvjpeg.dev}/share/pkgconfig/nvjpeg.pc $out/lib/pkgconfig/nvjpeg.pc
'';
in
buildPythonApplication rec {
pname = "xpra";
version = "6.2.2";
stdenv = if withNvenc then cudaPackages.backendStdenv else args.stdenv;
src = fetchFromGitHub {
owner = "Xpra-org";
repo = "xpra";
@@ -148,7 +156,10 @@ buildPythonApplication rec {
x265
xxHash
]
++ lib.optional withNvenc nvencHeaders;
++ lib.optional withNvenc [
nvencHeaders
nvjpegHeaders
];
propagatedBuildInputs =
with python3.pkgs;
@@ -185,15 +196,20 @@ buildPythonApplication rec {
# error: 'import_cairo' defined but not used
env.NIX_CFLAGS_COMPILE = "-Wno-error=unused-function";
setupPyBuildFlags = [
"--with-Xdummy"
"--without-Xdummy_wrapper"
"--without-strict"
"--with-gtk3"
# Override these, setup.py checks for headers in /usr/* paths
"--with-pam"
"--with-vsock"
] ++ lib.optional withNvenc "--with-nvenc";
setupPyBuildFlags =
[
"--with-Xdummy"
"--without-Xdummy_wrapper"
"--without-strict"
"--with-gtk3"
# Override these, setup.py checks for headers in /usr/* paths
"--with-pam"
"--with-vsock"
]
++ lib.optional withNvenc [
"--with-nvenc"
"--with-nvjpeg_encoder"
];
dontWrapGApps = true;