xpra: Add NVENC support
This commit is contained in:
parent
13f114593b
commit
80e86f8871
|
@ -1,12 +1,13 @@
|
||||||
{ lib
|
{ lib
|
||||||
, fetchurl
|
, fetchurl
|
||||||
, fetchpatch
|
, fetchpatch
|
||||||
, substituteAll, python3, pkg-config, writeText
|
, substituteAll, python3, pkg-config, runCommand, writeText
|
||||||
, xorg, gtk3, glib, pango, cairo, gdk-pixbuf, atk, pandoc
|
, xorg, gtk3, glib, pango, cairo, gdk-pixbuf, atk, pandoc
|
||||||
, wrapGAppsHook, xorgserver, getopt, xauth, util-linux, which
|
, wrapGAppsHook, xorgserver, getopt, xauth, util-linux, which
|
||||||
, ffmpeg, x264, libvpx, libwebp, x265, librsvg
|
, ffmpeg, x264, libvpx, libwebp, x265, librsvg
|
||||||
, libfakeXinerama
|
, libfakeXinerama
|
||||||
, gst_all_1, pulseaudio, gobject-introspection
|
, gst_all_1, pulseaudio, gobject-introspection
|
||||||
|
, withNvenc ? false, cudatoolkit, nv-codec-headers-10, nvidia_x11 ? null
|
||||||
, pam }:
|
, pam }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
@ -34,6 +35,13 @@ let
|
||||||
EndSection
|
EndSection
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
nvencHeaders = runCommand "nvenc-headers" {
|
||||||
|
inherit nvidia_x11;
|
||||||
|
} ''
|
||||||
|
mkdir -p $out/include $out/lib/pkgconfig
|
||||||
|
cp ${nv-codec-headers-10}/include/ffnvcodec/nvEncodeAPI.h $out/include
|
||||||
|
substituteAll ${./nvenc.pc} $out/lib/pkgconfig/nvenc.pc
|
||||||
|
'';
|
||||||
in buildPythonApplication rec {
|
in buildPythonApplication rec {
|
||||||
pname = "xpra";
|
pname = "xpra";
|
||||||
version = "4.2";
|
version = "4.2";
|
||||||
|
@ -60,7 +68,8 @@ in buildPythonApplication rec {
|
||||||
substituteInPlace setup.py --replace '/usr/include/security' '${pam}/include/security'
|
substituteInPlace setup.py --replace '/usr/include/security' '${pam}/include/security'
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = [ pkg-config wrapGAppsHook pandoc ];
|
nativeBuildInputs = [ pkg-config wrapGAppsHook pandoc ]
|
||||||
|
++ lib.optional withNvenc cudatoolkit;
|
||||||
buildInputs = with xorg; [
|
buildInputs = with xorg; [
|
||||||
libX11 xorgproto libXrender libXi
|
libX11 xorgproto libXrender libXi
|
||||||
libXtst libXfixes libXcomposite libXdamage
|
libXtst libXfixes libXcomposite libXdamage
|
||||||
|
@ -81,13 +90,13 @@ in buildPythonApplication rec {
|
||||||
|
|
||||||
pam
|
pam
|
||||||
gobject-introspection
|
gobject-introspection
|
||||||
];
|
] ++ lib.optional withNvenc nvencHeaders;
|
||||||
propagatedBuildInputs = with python3.pkgs; [
|
propagatedBuildInputs = with python3.pkgs; [
|
||||||
pillow rencode pycrypto cryptography pycups lz4 dbus-python
|
pillow rencode pycrypto cryptography pycups lz4 dbus-python
|
||||||
netifaces numpy pygobject3 pycairo gst-python pam
|
netifaces numpy pygobject3 pycairo gst-python pam
|
||||||
pyopengl paramiko opencv4 python-uinput pyxdg
|
pyopengl paramiko opencv4 python-uinput pyxdg
|
||||||
ipaddress idna pyinotify
|
ipaddress idna pyinotify
|
||||||
];
|
] ++ lib.optionals withNvenc (with python3.pkgs; [pynvml pycuda]);
|
||||||
|
|
||||||
# error: 'import_cairo' defined but not used
|
# error: 'import_cairo' defined but not used
|
||||||
NIX_CFLAGS_COMPILE = "-Wno-error=unused-function";
|
NIX_CFLAGS_COMPILE = "-Wno-error=unused-function";
|
||||||
|
@ -100,7 +109,7 @@ in buildPythonApplication rec {
|
||||||
# Override these, setup.py checks for headers in /usr/* paths
|
# Override these, setup.py checks for headers in /usr/* paths
|
||||||
"--with-pam"
|
"--with-pam"
|
||||||
"--with-vsock"
|
"--with-vsock"
|
||||||
];
|
] ++ lib.optional withNvenc "--with-nvenc";
|
||||||
|
|
||||||
dontWrapGApps = true;
|
dontWrapGApps = true;
|
||||||
preFixup = ''
|
preFixup = ''
|
||||||
|
@ -111,6 +120,9 @@ in buildPythonApplication rec {
|
||||||
--set XPRA_XKB_CONFIG_ROOT "${xorg.xkeyboardconfig}/share/X11/xkb"
|
--set XPRA_XKB_CONFIG_ROOT "${xorg.xkeyboardconfig}/share/X11/xkb"
|
||||||
--prefix LD_LIBRARY_PATH : ${libfakeXinerama}/lib
|
--prefix LD_LIBRARY_PATH : ${libfakeXinerama}/lib
|
||||||
--prefix PATH : ${lib.makeBinPath [ getopt xorgserver xauth which util-linux pulseaudio ]}
|
--prefix PATH : ${lib.makeBinPath [ getopt xorgserver xauth which util-linux pulseaudio ]}
|
||||||
|
'' + lib.optionalString withNvenc ''
|
||||||
|
--prefix LD_LIBRARY_PATH : ${nvidia_x11}/lib
|
||||||
|
'' + ''
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
11
pkgs/tools/X11/xpra/nvenc.pc
Normal file
11
pkgs/tools/X11/xpra/nvenc.pc
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
prefix=@out@
|
||||||
|
includedir=${prefix}/include
|
||||||
|
libdir=@nvidia_x11@/lib
|
||||||
|
|
||||||
|
Name: nvenc
|
||||||
|
Description: NVENC
|
||||||
|
Version: 10
|
||||||
|
Requires:
|
||||||
|
Conflicts:
|
||||||
|
Libs: -L${libdir} -lnvidia-encode
|
||||||
|
Cflags: -I${includedir}
|
|
@ -27614,6 +27614,10 @@ in
|
||||||
libxpdf = callPackage ../applications/misc/xpdf/libxpdf.nix { };
|
libxpdf = callPackage ../applications/misc/xpdf/libxpdf.nix { };
|
||||||
|
|
||||||
xpra = callPackage ../tools/X11/xpra { };
|
xpra = callPackage ../tools/X11/xpra { };
|
||||||
|
xpraWithNvenc = callPackage ../tools/X11/xpra {
|
||||||
|
withNvenc = true;
|
||||||
|
nvidia_x11 = linuxPackages.nvidia_x11.override { libsOnly = true; };
|
||||||
|
};
|
||||||
libfakeXinerama = callPackage ../tools/X11/xpra/libfakeXinerama.nix { };
|
libfakeXinerama = callPackage ../tools/X11/xpra/libfakeXinerama.nix { };
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue