nixpkgs/pkgs/tools/X11/xpra/default.nix

145 lines
4.1 KiB
Nix
Raw Normal View History

{ lib
, fetchurl
2021-05-25 07:07:52 +02:00
, substituteAll, python3, pkg-config, runCommand, writeText
2021-05-06 10:00:55 +02:00
, xorg, gtk3, glib, pango, cairo, gdk-pixbuf, atk, pandoc
2020-11-24 16:29:28 +01:00
, wrapGAppsHook, xorgserver, getopt, xauth, util-linux, which
, ffmpeg, x264, libvpx, libwebp, x265, librsvg
2016-09-03 15:52:39 +02:00
, libfakeXinerama
, gst_all_1, pulseaudio, gobject-introspection
2021-05-25 07:07:52 +02:00
, withNvenc ? false, cudatoolkit, nv-codec-headers-10, nvidia_x11 ? null
2016-12-04 22:26:43 +01:00
, pam }:
2016-09-03 15:52:39 +02:00
with lib;
let
inherit (python3.pkgs) cython buildPythonApplication;
2018-07-15 10:32:53 +02:00
2020-03-31 08:29:46 +02:00
xf86videodummy = xorg.xf86videodummy.overrideDerivation (p: {
patches = [
2021-05-06 10:00:55 +02:00
# patch provided by Xpra upstream
2020-03-31 08:29:46 +02:00
./0002-Constant-DPI.patch
2021-05-06 10:00:55 +02:00
# https://github.com/Xpra-org/xpra/issues/349
2020-03-31 08:29:46 +02:00
./0003-fix-pointer-limits.patch
2021-05-06 10:00:55 +02:00
# patch provided by Xpra upstream
2020-03-31 08:29:46 +02:00
./0005-support-for-30-bit-depth-in-dummy-driver.patch
];
});
xorgModulePaths = writeText "module-paths" ''
Section "Files"
ModulePath "${xorgserver}/lib/xorg/modules"
ModulePath "${xorgserver}/lib/xorg/modules/extensions"
ModulePath "${xorgserver}/lib/xorg/modules/drivers"
ModulePath "${xf86videodummy}/lib/xorg/modules/drivers"
EndSection
'';
2021-05-25 07:07:52 +02:00
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 {
2018-07-15 10:32:53 +02:00
pname = "xpra";
2022-01-22 10:41:09 +01:00
version = "4.3.1";
src = fetchurl {
2022-01-22 10:41:09 +01:00
url = "https://xpra.org/src/${pname}-${version}.tar.xz";
hash = "sha256-v0Abn0oYcl1I4H9GLN1pV9hk9tTE+Wlv2gPTtEE6t6k=";
};
patches = [
2021-05-06 10:00:55 +02:00
(substituteAll { # correct hardcoded paths
src = ./fix-paths.patch;
2020-05-16 21:19:00 +02:00
inherit libfakeXinerama;
})
2021-05-06 10:00:55 +02:00
./fix-41106.patch # https://github.com/NixOS/nixpkgs/issues/41106
];
2022-01-22 10:41:09 +01:00
INCLUDE_DIRS = "${pam}/include";
2019-03-22 20:27:55 +01:00
2021-05-25 07:07:52 +02:00
nativeBuildInputs = [ pkg-config wrapGAppsHook pandoc ]
++ lib.optional withNvenc cudatoolkit;
buildInputs = with xorg; [
2022-01-22 10:41:09 +01:00
libX11 xorgproto libXrender libXi libXres
libXtst libXfixes libXcomposite libXdamage
libXrandr libxkbfile
] ++ [
cython
librsvg
2019-05-22 13:03:39 +02:00
pango cairo gdk-pixbuf atk.out gtk3 glib
2020-06-13 04:31:01 +02:00
ffmpeg libvpx x264 libwebp x265
2015-02-25 00:34:58 +01:00
2016-09-03 15:52:39 +02:00
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-bad
gst_all_1.gst-libav
2016-12-04 22:26:43 +01:00
pam
2019-03-22 20:27:55 +01:00
gobject-introspection
2021-05-25 07:07:52 +02:00
] ++ lib.optional withNvenc nvencHeaders;
propagatedBuildInputs = with python3.pkgs; [
pillow rencode pycrypto cryptography pycups lz4 dbus-python
2019-03-22 20:27:55 +01:00
netifaces numpy pygobject3 pycairo gst-python pam
pyopengl paramiko opencv4 python-uinput pyxdg
ipaddress idna pyinotify
2021-05-25 07:07:52 +02:00
] ++ lib.optionals withNvenc (with python3.pkgs; [pynvml pycuda]);
# error: 'import_cairo' defined but not used
2019-10-30 12:34:47 +01:00
NIX_CFLAGS_COMPILE = "-Wno-error=unused-function";
2013-03-29 02:30:18 +01:00
setupPyBuildFlags = [
"--with-Xdummy"
"--without-Xdummy_wrapper"
"--without-strict"
"--with-gtk3"
2019-03-22 20:27:55 +01:00
# Override these, setup.py checks for headers in /usr/* paths
"--with-pam"
"--with-vsock"
2021-05-25 07:07:52 +02:00
] ++ lib.optional withNvenc "--with-nvenc";
dontWrapGApps = true;
preFixup = ''
makeWrapperArgs+=(
"''${gappsWrapperArgs[@]}"
--set XPRA_INSTALL_PREFIX "$out"
2020-08-22 22:38:10 +02:00
--set XPRA_COMMAND "$out/bin/xpra"
--set XPRA_XKB_CONFIG_ROOT "${xorg.xkeyboardconfig}/share/X11/xkb"
--prefix LD_LIBRARY_PATH : ${libfakeXinerama}/lib
2021-01-15 10:19:50 +01:00
--prefix PATH : ${lib.makeBinPath [ getopt xorgserver xauth which util-linux pulseaudio ]}
2021-05-25 07:07:52 +02:00
'' + lib.optionalString withNvenc ''
--prefix LD_LIBRARY_PATH : ${nvidia_x11}/lib
'' + ''
)
2015-02-25 00:34:58 +01:00
'';
# append module paths to xorg.conf
postInstall = ''
cat ${xorgModulePaths} >> $out/etc/xpra/xorg.conf
'';
doCheck = false;
2015-02-25 00:34:58 +01:00
2019-03-22 20:27:55 +01:00
enableParallelBuilding = true;
2021-01-10 19:21:27 +01:00
passthru = {
inherit xf86videodummy;
updateScript = ./update.sh;
};
2015-02-25 00:34:58 +01:00
meta = {
homepage = "https://xpra.org/";
downloadPage = "https://xpra.org/src/";
downloadURLRegexp = "xpra-.*[.]tar[.][gx]z$";
description = "Persistent remote applications for X";
2016-09-03 15:52:39 +02:00
platforms = platforms.linux;
2018-09-12 21:42:39 +02:00
license = licenses.gpl2;
maintainers = with maintainers; [ tstrobel offline numinit mvnetbiz ];
};
}