summary refs log tree commit diff
path: root/pkgs/tools/X11/xpra
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-08-04 10:43:07 +0000
committerAlyssa Ross <hi@alyssa.is>2021-08-04 10:43:07 +0000
commit62614cbef7da005c1eda8c9400160f6bcd6546b8 (patch)
treec2630f69080637987b68acb1ee8676d2681fe304 /pkgs/tools/X11/xpra
parentd9c82ed3044c72cecf01c6ea042489d30914577c (diff)
parente24069138dfec3ef94f211f1da005bb5395adc11 (diff)
downloadnixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.gz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.bz2
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.lz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.xz
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.tar.zst
nixpkgs-62614cbef7da005c1eda8c9400160f6bcd6546b8.zip
Merge branch 'nixpkgs-update' into master
Diffstat (limited to 'pkgs/tools/X11/xpra')
-rw-r--r--pkgs/tools/X11/xpra/default.nix68
-rw-r--r--pkgs/tools/X11/xpra/fix-paths.patch13
-rw-r--r--pkgs/tools/X11/xpra/libfakeXinerama.nix4
-rw-r--r--pkgs/tools/X11/xpra/nvenc.pc11
-rwxr-xr-xpkgs/tools/X11/xpra/update.sh5
5 files changed, 66 insertions, 35 deletions
diff --git a/pkgs/tools/X11/xpra/default.nix b/pkgs/tools/X11/xpra/default.nix
index 7f46e017c36..c3cea1ed061 100644
--- a/pkgs/tools/X11/xpra/default.nix
+++ b/pkgs/tools/X11/xpra/default.nix
@@ -1,9 +1,13 @@
-{ stdenv, lib, fetchurl, callPackage, substituteAll, python3, pkgconfig, writeText
-, xorg, gtk3, glib, pango, cairo, gdk-pixbuf, atk
-, wrapGAppsHook, xorgserver, getopt, xauth, utillinux, which
-, ffmpeg, x264, libvpx, libwebp, x265
+{ lib
+, fetchurl
+, fetchpatch
+, substituteAll, python3, pkg-config, runCommand, writeText
+, xorg, gtk3, glib, pango, cairo, gdk-pixbuf, atk, pandoc
+, wrapGAppsHook, xorgserver, getopt, xauth, util-linux, which
+, ffmpeg, x264, libvpx, libwebp, x265, librsvg
 , libfakeXinerama
 , gst_all_1, pulseaudio, gobject-introspection
+, withNvenc ? false, cudatoolkit, nv-codec-headers-10, nvidia_x11 ? null
 , pam }:
 
 with lib;
@@ -13,8 +17,11 @@ let
 
   xf86videodummy = xorg.xf86videodummy.overrideDerivation (p: {
     patches = [
+      # patch provided by Xpra upstream
       ./0002-Constant-DPI.patch
+      # https://github.com/Xpra-org/xpra/issues/349
       ./0003-fix-pointer-limits.patch
+      # patch provided by Xpra upstream
       ./0005-support-for-30-bit-depth-in-dummy-driver.patch
     ];
   });
@@ -28,35 +35,48 @@ let
     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 {
   pname = "xpra";
-  version = "4.0.2";
+  version = "4.2";
 
   src = fetchurl {
-    url = "https://xpra.org/src/${pname}-${version}.tar.xz";
-    sha256 = "1cs39jzi59hkl421xmhi549ndmdfzkg0ap45f4nlsn9zr9zwmp3x";
+    url = "https://xpra.org/src/${pname}-${version}.tar.gz";
+    hash = "sha256-KkQw4FJeH4G5jZ4GdP3aXZ3zxu4GALbiOI6POKJW6fk=";
   };
 
   patches = [
-    (substituteAll {
+    (substituteAll {  # correct hardcoded paths
       src = ./fix-paths.patch;
-      inherit (xorg) xkeyboardconfig;
       inherit libfakeXinerama;
     })
-    ./fix-41106.patch
+    ./fix-41106.patch  # https://github.com/NixOS/nixpkgs/issues/41106
+    # Xorg won't start without. Remove on next version!
+    (fetchpatch {
+      url = "https://github.com/Xpra-org/xpra/commit/f9f242abad69363dfa558e1f6f7956ae99164b67.patch";
+      sha256 = "sha256-TOP9RuXPuqxyKY/7LSSrCWnAmJstEE+D5EwjMiVmchM=";
+    })
   ];
 
   postPatch = ''
     substituteInPlace setup.py --replace '/usr/include/security' '${pam}/include/security'
   '';
 
-  nativeBuildInputs = [ pkgconfig wrapGAppsHook ];
+  nativeBuildInputs = [ pkg-config wrapGAppsHook pandoc ]
+    ++ lib.optional withNvenc cudatoolkit;
   buildInputs = with xorg; [
     libX11 xorgproto libXrender libXi
     libXtst libXfixes libXcomposite libXdamage
     libXrandr libxkbfile
     ] ++ [
     cython
+    librsvg
 
     pango cairo gdk-pixbuf atk.out gtk3 glib
 
@@ -70,25 +90,26 @@ in buildPythonApplication rec {
 
     pam
     gobject-introspection
-  ];
+  ] ++ lib.optional withNvenc nvencHeaders;
   propagatedBuildInputs = with python3.pkgs; [
     pillow rencode pycrypto cryptography pycups lz4 dbus-python
     netifaces numpy pygobject3 pycairo gst-python pam
     pyopengl paramiko opencv4 python-uinput pyxdg
-    ipaddress idna
-  ];
+    ipaddress idna pyinotify
+  ] ++ lib.optionals withNvenc (with python3.pkgs; [pynvml pycuda]);
 
     # error: 'import_cairo' defined but not used
   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";
 
   dontWrapGApps = true;
   preFixup = ''
@@ -96,8 +117,12 @@ in buildPythonApplication rec {
       "''${gappsWrapperArgs[@]}"
       --set XPRA_INSTALL_PREFIX "$out"
       --set XPRA_COMMAND "$out/bin/xpra"
+      --set XPRA_XKB_CONFIG_ROOT "${xorg.xkeyboardconfig}/share/X11/xkb"
       --prefix LD_LIBRARY_PATH : ${libfakeXinerama}/lib
-      --prefix PATH : ${stdenv.lib.makeBinPath [ getopt xorgserver xauth which utillinux pulseaudio ]}
+      --prefix PATH : ${lib.makeBinPath [ getopt xorgserver xauth which util-linux pulseaudio ]}
+  '' + lib.optionalString withNvenc ''
+      --prefix LD_LIBRARY_PATH : ${nvidia_x11}/lib
+  '' + ''
     )
   '';
 
@@ -110,15 +135,18 @@ in buildPythonApplication rec {
 
   enableParallelBuilding = true;
 
-  passthru = { inherit xf86videodummy; };
+  passthru = {
+    inherit xf86videodummy;
+    updateScript = ./update.sh;
+  };
 
   meta = {
-    homepage = "http://xpra.org/";
+    homepage = "https://xpra.org/";
     downloadPage = "https://xpra.org/src/";
-    downloadURLRegexp = "xpra-.*[.]tar[.]xz$";
+    downloadURLRegexp = "xpra-.*[.]tar[.][gx]z$";
     description = "Persistent remote applications for X";
     platforms = platforms.linux;
     license = licenses.gpl2;
-    maintainers = with maintainers; [ tstrobel offline numinit ];
+    maintainers = with maintainers; [ tstrobel offline numinit mvnetbiz ];
   };
 }
diff --git a/pkgs/tools/X11/xpra/fix-paths.patch b/pkgs/tools/X11/xpra/fix-paths.patch
index 70bd9027a1a..b5a58bb03f8 100644
--- a/pkgs/tools/X11/xpra/fix-paths.patch
+++ b/pkgs/tools/X11/xpra/fix-paths.patch
@@ -16,19 +16,6 @@ index f962330..b02b6dd 100755
              f.write(b"DEF ENABLE_DEVICE_CAPS=%i" % ENABLE_DEVICE_CAPS)
      cython_add(Extension("xpra.codecs.v4l2.pusher",
      
-diff --git a/xpra/x11/bindings/keyboard_bindings.pyx b/xpra/x11/bindings/keyboard_bindings.pyx
-index bd7023d..064c6b5 100644
---- a/xpra/x11/bindings/keyboard_bindings.pyx
-+++ b/xpra/x11/bindings/keyboard_bindings.pyx
-@@ -21,7 +21,7 @@ from libc.stdlib cimport free, malloc
-
- DEF PATH_MAX = 1024
- DEF DFLT_XKB_RULES_FILE = b"base"
--DEF DFLT_XKB_CONFIG_ROOT = b"/usr/share/X11/xkb"
-+DEF DFLT_XKB_CONFIG_ROOT = b"@xkeyboardconfig@/share/X11/xkb"
-
- ###################################
- # Headers, python magic
 diff --git a/xpra/x11/fakeXinerama.py b/xpra/x11/fakeXinerama.py
 index c867258..617af7c 100755
 --- a/xpra/x11/fakeXinerama.py
diff --git a/pkgs/tools/X11/xpra/libfakeXinerama.nix b/pkgs/tools/X11/xpra/libfakeXinerama.nix
index e43043d78f2..bad43c39eef 100644
--- a/pkgs/tools/X11/xpra/libfakeXinerama.nix
+++ b/pkgs/tools/X11/xpra/libfakeXinerama.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libX11, libXinerama }:
+{ lib, stdenv, fetchurl, libX11, libXinerama }:
 
 stdenv.mkDerivation  rec {
   pname = "libfakeXinerama";
@@ -23,7 +23,7 @@ stdenv.mkDerivation  rec {
     ln -s libXinerama.so.1 $out/lib/libXinerama.so
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = "http://xpra.org/";
     description = "fakeXinerama for Xpra";
     platforms = platforms.linux;
diff --git a/pkgs/tools/X11/xpra/nvenc.pc b/pkgs/tools/X11/xpra/nvenc.pc
new file mode 100644
index 00000000000..6d8d916a025
--- /dev/null
+++ b/pkgs/tools/X11/xpra/nvenc.pc
@@ -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}
diff --git a/pkgs/tools/X11/xpra/update.sh b/pkgs/tools/X11/xpra/update.sh
new file mode 100755
index 00000000000..c1b408a0bee
--- /dev/null
+++ b/pkgs/tools/X11/xpra/update.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i bash -p curl perl common-updater-scripts
+
+version=$(curl https://xpra.org/src/ | perl -ne 'print "$1\n" if /xpra-([[:digit:].]+)\./' | sort -V | tail -n1)
+update-source-version xpra "$version"