about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/X11
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/X11')
-rw-r--r--nixpkgs/pkgs/tools/X11/alttab/default.nix45
-rw-r--r--nixpkgs/pkgs/tools/X11/arandr/default.nix40
-rw-r--r--nixpkgs/pkgs/tools/X11/autocutsel/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/X11/bgs/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/X11/bumblebee/default.nix143
-rw-r--r--nixpkgs/pkgs/tools/X11/bumblebee/nixos.patch80
-rw-r--r--nixpkgs/pkgs/tools/X11/caffeine-ng/default.nix44
-rw-r--r--nixpkgs/pkgs/tools/X11/ckbcomp/default.nix36
-rw-r--r--nixpkgs/pkgs/tools/X11/dex/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/X11/dispad/default.nix23
-rw-r--r--nixpkgs/pkgs/tools/X11/dragon-drop/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/X11/ffcast/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/X11/go-sct/default.nix27
-rw-r--r--nixpkgs/pkgs/tools/X11/go-sct/deps.nix11
-rw-r--r--nixpkgs/pkgs/tools/X11/grobi/default.nix22
-rw-r--r--nixpkgs/pkgs/tools/X11/hsetroot/default.nix36
-rw-r--r--nixpkgs/pkgs/tools/X11/imwheel/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/X11/jumpapp/default.nix31
-rw-r--r--nixpkgs/pkgs/tools/X11/keynav/default.nix39
-rw-r--r--nixpkgs/pkgs/tools/X11/ksuperkey/default.nix27
-rw-r--r--nixpkgs/pkgs/tools/X11/libstrangle/default.nix29
-rw-r--r--nixpkgs/pkgs/tools/X11/libstrangle/nixos.patch29
-rw-r--r--nixpkgs/pkgs/tools/X11/ncview/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/X11/nitrogen/default.nix35
-rw-r--r--nixpkgs/pkgs/tools/X11/numlockx/default.nix21
-rw-r--r--nixpkgs/pkgs/tools/X11/nx-libs/default.nix44
-rw-r--r--nixpkgs/pkgs/tools/X11/obconf/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/X11/primus/default.nix34
-rw-r--r--nixpkgs/pkgs/tools/X11/primus/lib.nix52
-rw-r--r--nixpkgs/pkgs/tools/X11/ratmen/default.nix35
-rw-r--r--nixpkgs/pkgs/tools/X11/run-scaled/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/X11/runningx/default.nix34
-rw-r--r--nixpkgs/pkgs/tools/X11/screen-message/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/X11/sct/DISPLAY-segfault.patch10
-rw-r--r--nixpkgs/pkgs/tools/X11/sct/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/X11/setroot/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/X11/skippy-xd/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/X11/srandrd/default.nix31
-rw-r--r--nixpkgs/pkgs/tools/X11/sselp/default.nix27
-rw-r--r--nixpkgs/pkgs/tools/X11/vdpauinfo/default.nix22
-rw-r--r--nixpkgs/pkgs/tools/X11/virtualgl/default.nix24
-rw-r--r--nixpkgs/pkgs/tools/X11/virtualgl/lib.nix29
-rw-r--r--nixpkgs/pkgs/tools/X11/wayv/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/X11/wmctrl/64-bit-data.patch32
-rw-r--r--nixpkgs/pkgs/tools/X11/wmctrl/default.nix33
-rw-r--r--nixpkgs/pkgs/tools/X11/wmutils-core/default.nix22
-rw-r--r--nixpkgs/pkgs/tools/X11/wmutils-opt/default.nix25
-rw-r--r--nixpkgs/pkgs/tools/X11/wpgtk/default.nix51
-rw-r--r--nixpkgs/pkgs/tools/X11/x11spice/default.nix36
-rw-r--r--nixpkgs/pkgs/tools/X11/x11vnc/default.nix49
-rw-r--r--nixpkgs/pkgs/tools/X11/x2vnc/default.nix23
-rw-r--r--nixpkgs/pkgs/tools/X11/x2x/default.nix29
-rw-r--r--nixpkgs/pkgs/tools/X11/xannotate/default.nix23
-rw-r--r--nixpkgs/pkgs/tools/X11/xautomation/default.nix22
-rw-r--r--nixpkgs/pkgs/tools/X11/xbanish/default.nix42
-rw-r--r--nixpkgs/pkgs/tools/X11/xbindkeys-config/default.nix38
-rw-r--r--nixpkgs/pkgs/tools/X11/xbindkeys-config/xbindkeys-config-patch1.patch108
-rw-r--r--nixpkgs/pkgs/tools/X11/xbindkeys-config/xbindkeys-config.121
-rw-r--r--nixpkgs/pkgs/tools/X11/xbindkeys/default.nix22
-rw-r--r--nixpkgs/pkgs/tools/X11/xbrightness/default.nix24
-rw-r--r--nixpkgs/pkgs/tools/X11/xcalib/default.nix27
-rw-r--r--nixpkgs/pkgs/tools/X11/xcape/default.nix41
-rw-r--r--nixpkgs/pkgs/tools/X11/xchainkeys/default.nix19
-rw-r--r--nixpkgs/pkgs/tools/X11/xcwd/default.nix31
-rw-r--r--nixpkgs/pkgs/tools/X11/xdg-user-dirs/default.nix26
-rw-r--r--nixpkgs/pkgs/tools/X11/xdg-utils/default.nix70
-rw-r--r--nixpkgs/pkgs/tools/X11/xdotool/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/X11/xgeometry-select/default.nix32
-rw-r--r--nixpkgs/pkgs/tools/X11/xidlehook/default.nix37
-rw-r--r--nixpkgs/pkgs/tools/X11/xinput_calibrator/default.nix23
-rw-r--r--nixpkgs/pkgs/tools/X11/xkb-switch/default.nix24
-rw-r--r--nixpkgs/pkgs/tools/X11/xkbset/default.nix33
-rw-r--r--nixpkgs/pkgs/tools/X11/xkbvalidate/default.nix15
-rw-r--r--nixpkgs/pkgs/tools/X11/xkbvalidate/xkbvalidate.c150
-rw-r--r--nixpkgs/pkgs/tools/X11/xlayoutdisplay/default.nix36
-rw-r--r--nixpkgs/pkgs/tools/X11/xloadimage/default.nix88
-rw-r--r--nixpkgs/pkgs/tools/X11/xmacro/default.nix20
-rw-r--r--nixpkgs/pkgs/tools/X11/xmagnify/default.nix24
-rw-r--r--nixpkgs/pkgs/tools/X11/xmousepasteblock/default.nix21
-rw-r--r--nixpkgs/pkgs/tools/X11/xnee/default.nix55
-rw-r--r--nixpkgs/pkgs/tools/X11/xob/default.nix35
-rw-r--r--nixpkgs/pkgs/tools/X11/xosview2/default.nix41
-rw-r--r--nixpkgs/pkgs/tools/X11/xpointerbarrier/default.nix22
-rw-r--r--nixpkgs/pkgs/tools/X11/xpra/0002-Constant-DPI.patch96
-rw-r--r--nixpkgs/pkgs/tools/X11/xpra/0003-fix-pointer-limits.patch39
-rw-r--r--nixpkgs/pkgs/tools/X11/xpra/0005-support-for-30-bit-depth-in-dummy-driver.patch41
-rw-r--r--nixpkgs/pkgs/tools/X11/xpra/default.nix120
-rw-r--r--nixpkgs/pkgs/tools/X11/xpra/fix-paths.patch31
-rw-r--r--nixpkgs/pkgs/tools/X11/xpra/libfakeXinerama.nix34
-rw-r--r--nixpkgs/pkgs/tools/X11/xprintidle-ng/default.nix44
-rw-r--r--nixpkgs/pkgs/tools/X11/xrectsel/default.nix28
-rw-r--r--nixpkgs/pkgs/tools/X11/xrestop/default.nix19
-rw-r--r--nixpkgs/pkgs/tools/X11/xsecurelock/default.nix42
-rw-r--r--nixpkgs/pkgs/tools/X11/xsettingsd/SConstruct.patch13
-rw-r--r--nixpkgs/pkgs/tools/X11/xsettingsd/default.nix38
-rw-r--r--nixpkgs/pkgs/tools/X11/xtrace/default.nix30
-rw-r--r--nixpkgs/pkgs/tools/X11/xtruss/default.nix18
-rw-r--r--nixpkgs/pkgs/tools/X11/xvkbd/default.nix33
-rw-r--r--nixpkgs/pkgs/tools/X11/xwinmosaic/default.nix23
-rw-r--r--nixpkgs/pkgs/tools/X11/xwinwrap/default.nix55
-rw-r--r--nixpkgs/pkgs/tools/X11/xzoom/default.nix38
101 files changed, 3701 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/X11/alttab/default.nix b/nixpkgs/pkgs/tools/X11/alttab/default.nix
new file mode 100644
index 000000000000..28c8efffa2a5
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/alttab/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, fetchFromGitHub, autoconf, automake, pkgconfig, ronn, libpng, uthash
+, xorg }:
+
+stdenv.mkDerivation rec {
+  version = "1.4.0";
+
+  pname = "alttab";
+
+  src = fetchFromGitHub {
+    owner = "sagb";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "028ifp54yl3xq5mj2ww9baga8p56nmrx4ypvj8k35akcaxdpyga9";
+  };
+
+  nativeBuildInputs = [ 
+    autoconf
+    automake
+    pkgconfig
+    ronn
+  ];
+
+  preConfigure = "./bootstrap.sh";
+
+  buildInputs = [
+    libpng
+    uthash
+    xorg.libX11
+    xorg.libXft
+    xorg.libXmu
+    xorg.libXpm
+    xorg.libXrandr
+    xorg.libXrender
+  ];
+
+  enableParallelBuild = true;
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/sagb/alttab";
+    description = "X11 window switcher designed for minimalistic window managers or standalone X11 session";
+    license = licenses.gpl3;
+    platforms = platforms.all;
+    maintainers = [ maintainers.sgraf ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/arandr/default.nix b/nixpkgs/pkgs/tools/X11/arandr/default.nix
new file mode 100644
index 000000000000..94e3ac36d078
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/arandr/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl, python3Packages
+, gobject-introspection, gsettings-desktop-schemas, gtk3
+, wrapGAppsHook, xrandr
+}:
+
+let
+  inherit (python3Packages) buildPythonApplication docutils pygobject3;
+  pname = "arandr";
+  version = "0.1.10";
+  name = "${pname}-${version}";
+in buildPythonApplication rec {
+  inherit pname version;
+
+  src = fetchurl {
+    url = "https://christian.amsuess.com/tools/arandr/files/${name}.tar.gz";
+    sha256 = "135q0llvm077jil2fr92ssw3p095m4r8jfj0lc5rr3m71n4srj6v";
+  };
+
+  patchPhase = ''
+    rm -rf data/po/*
+  '';
+
+  # no tests
+  doCheck = false;
+
+  # hook for gobject-introspection doesn't like strictDeps
+  # https://github.com/NixOS/nixpkgs/issues/56943
+  strictDeps = false;
+
+  buildInputs = [ docutils gsettings-desktop-schemas gtk3 ];
+  nativeBuildInputs = [ gobject-introspection wrapGAppsHook ];
+  propagatedBuildInputs = [ xrandr pygobject3 ];
+
+  meta = {
+    homepage = "http://christian.amsuess.com/tools/arandr/";
+    description = "A simple visual front end for XRandR";
+    license = stdenv.lib.licenses.gpl3;
+    maintainers = [ stdenv.lib.maintainers.domenkozar ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/autocutsel/default.nix b/nixpkgs/pkgs/tools/X11/autocutsel/default.nix
new file mode 100644
index 000000000000..ece42502d81c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/autocutsel/default.nix
@@ -0,0 +1,26 @@
+{stdenv, fetchurl, libX11, libXaw}:
+
+stdenv.mkDerivation rec {
+  version = "0.10.0";
+  pname = "autocutsel";
+ 
+  src = fetchurl {
+    url = "https://github.com/sigmike/autocutsel/releases/download/${version}/${pname}-${version}.tar.gz";
+    sha256 = "0gsys2dzh4az51ndcsabhlbbrjn2nm75lnjr45kg6r8sm8q66dx2";
+  };
+ 
+  buildInputs = [ libX11 libXaw ];
+  installPhase = ''
+    mkdir -p $out/bin
+    cp autocutsel $out/bin/
+  '';
+
+  meta = {
+    inherit version;
+    homepage = "https://www.nongnu.org/autocutsel/";
+    description = "Tracks changes in the server's cutbuffer and CLIPBOARD selection";
+    license = stdenv.lib.licenses.gpl2Plus;
+    platforms = with stdenv.lib.platforms; all;
+    updateWalker = true;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/bgs/default.nix b/nixpkgs/pkgs/tools/X11/bgs/default.nix
new file mode 100644
index 000000000000..66d845b0587f
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/bgs/default.nix
@@ -0,0 +1,25 @@
+{stdenv, fetchurl, pkgconfig, libX11, libXinerama, imlib2}:
+
+stdenv.mkDerivation rec {
+
+  pname = "bgs";
+  version = "0.8";
+
+  src = fetchurl {
+    url = "https://github.com/Gottox/bgs/archive/v${version}.tar.gz";
+    sha256 = "1rw9ingkkpvvr2dixx126ziim67a54r8k49918h1mbph0fjj08n5";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [ libX11 libXinerama imlib2 ];
+
+  preConfigure = ''sed -i "s@PREFIX = /usr/local@PREFIX = $out@g" config.mk'';
+
+  meta = with stdenv.lib; {
+    description = "Extremely fast and small background setter for X";
+    license = licenses.mit;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ pSub ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/bumblebee/default.nix b/nixpkgs/pkgs/tools/X11/bumblebee/default.nix
new file mode 100644
index 000000000000..8540cf6975dc
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/bumblebee/default.nix
@@ -0,0 +1,143 @@
+# The bumblebee package allows a program to be rendered on an
+# dedicated video card by spawning an additional X11 server and
+# streaming the results via VirtualGL or primus to the primary server.
+
+# The package is rather chaotic; it's also quite recent.
+# As it may change a lot, some of the hacks in this nix expression
+# will hopefully not be needed in the future anymore.
+
+# To test:
+# 1. make sure that the 'bbswitch' kernel module is installed,
+# 2. then run 'bumblebeed' as root
+# 3. Then either 'optirun glxinfo' or 'primusrun glxinfo' as user.
+#
+# The glxinfo output should indicate the NVidia driver is being used
+# and all expected extensions are supported.
+#
+# To use at startup, see hardware.bumblebee options.
+
+{ stdenv, lib, fetchurl, fetchpatch, pkgconfig, help2man, makeWrapper
+, glib, libbsd
+, libX11, xorgserver, kmod, xf86videonouveau
+, nvidia_x11, virtualgl, libglvnd
+, automake111x, autoconf
+# The below should only be non-null in a x86_64 system. On a i686
+# system the above nvidia_x11 and virtualgl will be the i686 packages.
+# TODO: Confusing. Perhaps use "SubArch" instead of i686?
+, nvidia_x11_i686 ? null
+, libglvnd_i686 ? null
+, useDisplayDevice ? false
+, extraNvidiaDeviceOptions ? ""
+, extraNouveauDeviceOptions ? ""
+, useNvidia ? true
+}:
+
+let
+  version = "3.2.1";
+
+  nvidia_x11s = [ nvidia_x11 ]
+                ++ lib.optional nvidia_x11.useGLVND libglvnd
+                ++ lib.optionals (nvidia_x11_i686 != null)
+                   ([ nvidia_x11_i686 ] ++ lib.optional nvidia_x11_i686.useGLVND libglvnd_i686);
+
+  nvidiaLibs = lib.makeLibraryPath nvidia_x11s;
+
+  bbdPath = lib.makeBinPath [ kmod xorgserver ];
+
+  xmodules = lib.concatStringsSep "," (map (x: "${x.out or x}/lib/xorg/modules") ([ xorgserver ] ++ lib.optional (!useNvidia) xf86videonouveau));
+
+  modprobePatch = fetchpatch {
+    url = "https://github.com/Bumblebee-Project/Bumblebee/commit/1ada79fe5916961fc4e4917f8c63bb184908d986.patch";
+    sha256 = "02vq3vba6nx7gglpjdfchws9vjhs1x02a543yvqrxqpvvdfim2x2";
+  };
+  libkmodPatch = fetchpatch {
+    url = "https://github.com/Bumblebee-Project/Bumblebee/commit/deceb14cdf2c90ff64ebd1010a674305464587da.patch";
+    sha256 = "00c05i5lxz7vdbv445ncxac490vbl5g9w3vy3gd71qw1f0si8vwh";
+  };
+
+in stdenv.mkDerivation rec {
+  pname = "bumblebee";
+  inherit version;
+
+  src = fetchurl {
+    url = "https://bumblebee-project.org/${pname}-${version}.tar.gz";
+    sha256 = "03p3gvx99lwlavznrpg9l7jnl1yfg2adcj8jcjj0gxp20wxp060h";
+  };
+
+  patches = [
+    ./nixos.patch
+
+    modprobePatch
+    libkmodPatch
+  ];
+
+  # By default we don't want to use a display device
+  nvidiaDeviceOptions = lib.optionalString (!useDisplayDevice) ''
+    # Disable display device
+    Option "UseEDID" "false"
+    Option "UseDisplayDevice" "none"
+  '' + extraNvidiaDeviceOptions;
+
+  nouveauDeviceOptions = extraNouveauDeviceOptions;
+
+  # the have() function is deprecated and not available to bash completions the
+  # way they are currently loaded in NixOS, so use _have. See #10936
+  postPatch = ''
+    substituteInPlace scripts/bash_completion/bumblebee \
+      --replace "have optirun" "_have optirun"
+  '';
+
+  preConfigure = ''
+    # Don't use a special group, just reuse wheel.
+    substituteInPlace configure \
+      --replace 'CONF_GID="bumblebee"' 'CONF_GID="wheel"'
+
+    # Apply configuration options
+    substituteInPlace conf/xorg.conf.nvidia \
+      --subst-var nvidiaDeviceOptions
+
+    substituteInPlace conf/xorg.conf.nouveau \
+      --subst-var nouveauDeviceOptions
+  '';
+
+  # Build-time dependencies of bumblebeed and optirun.
+  # Note that it has several runtime dependencies.
+  buildInputs = [ libX11 glib libbsd kmod ];
+  nativeBuildInputs = [ makeWrapper pkgconfig help2man automake111x autoconf ];
+
+  # The order of LDPATH is very specific: First X11 then the host
+  # environment then the optional sub architecture paths.
+  #
+  # The order for MODPATH is the opposite: First the environment that
+  # includes the acceleration driver. As this is used for the X11
+  # server, which runs under the host architecture, this does not
+  # include the sub architecture components.
+  configureFlags = [
+    "--with-udev-rules=$out/lib/udev/rules.d"
+    # see #10282
+    #"CONF_PRIMUS_LD_PATH=${primusLibs}"
+  ] ++ lib.optionals useNvidia [
+    "CONF_LDPATH_NVIDIA=${nvidiaLibs}"
+    "CONF_MODPATH_NVIDIA=${nvidia_x11.bin}/lib/xorg/modules"
+  ];
+
+  CFLAGS = [
+    "-DX_MODULE_APPENDS=\\\"${xmodules}\\\""
+  ];
+
+  postInstall = ''
+    wrapProgram "$out/sbin/bumblebeed" \
+      --prefix PATH : "${bbdPath}"
+
+    wrapProgram "$out/bin/optirun" \
+      --prefix PATH : "${virtualgl}/bin"
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/Bumblebee-Project/Bumblebee";
+    description = "Daemon for managing Optimus videocards (power-on/off, spawns xservers)";
+    platforms = platforms.linux;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/bumblebee/nixos.patch b/nixpkgs/pkgs/tools/X11/bumblebee/nixos.patch
new file mode 100644
index 000000000000..cf6ee5add98f
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/bumblebee/nixos.patch
@@ -0,0 +1,80 @@
+diff --git a/conf/xorg.conf.nouveau b/conf/xorg.conf.nouveau
+index 87e48cb..60d6eaf 100644
+--- a/conf/xorg.conf.nouveau
++++ b/conf/xorg.conf.nouveau
+@@ -15,4 +15,5 @@ Section "Device"
+ #   This Setting is needed on Ubuntu 13.04.
+ #   BusID "PCI:01:00:0"
+ 
++@nouveauDeviceOptions@
+ EndSection
+diff --git a/conf/xorg.conf.nvidia b/conf/xorg.conf.nvidia
+index c3107f9..17072f4 100644
+--- a/conf/xorg.conf.nvidia
++++ b/conf/xorg.conf.nvidia
+@@ -29,6 +29,6 @@ Section "Device"
+     Option "ProbeAllGpus" "false"
+ 
+     Option "NoLogo" "true"
+-    Option "UseEDID" "false"
+-    Option "UseDisplayDevice" "none"
++
++@nvidiaDeviceOptions@
+ EndSection
+diff --git a/src/bbsecondary.c b/src/bbsecondary.c
+index 71a6b73..a682d8a 100644
+--- a/src/bbsecondary.c
++++ b/src/bbsecondary.c
+@@ -145,6 +145,23 @@ bool start_secondary(bool need_secondary) {
+     }
+ 
+     bb_log(LOG_INFO, "Starting X server on display %s.\n", bb_config.x_display);
++    const char mod_appends[] = X_MODULE_APPENDS;
++
++    char *mod_path;
++    int pathlen = strlen(bb_config.mod_path);
++    if (pathlen == 0) {
++      mod_path = mod_appends;
++    } else {
++      mod_path = malloc(pathlen + 1 + sizeof(mod_appends));
++      if (!mod_path) {
++        set_bb_error("Could not allocate memory for modules path\n");
++        return false;
++      }
++      strcpy(mod_path, bb_config.mod_path);
++      mod_path[pathlen] = ',';
++      strcpy(mod_path + pathlen + 1, mod_appends);
++    }
++
+     char *x_argv[] = {
+       XORG_BINARY,
+       bb_config.x_display,
+@@ -153,24 +170,24 @@ bool start_secondary(bool need_secondary) {
+       "-sharevts",
+       "-nolisten", "tcp",
+       "-noreset",
++      "-logfile", "/var/log/X.bumblebee.log",
+       "-verbose", "3",
+       "-isolateDevice", pci_id,
+-      "-modulepath", bb_config.mod_path, // keep last
++      "-modulepath", mod_path,
+       NULL
+     };
+     enum {n_x_args = sizeof(x_argv) / sizeof(x_argv[0])};
+-    if (!*bb_config.mod_path) {
+-      x_argv[n_x_args - 3] = 0; //remove -modulepath if not set
+-    }
+     //close any previous pipe, if it (still) exists
+     if (bb_status.x_pipe[0] != -1){close(bb_status.x_pipe[0]); bb_status.x_pipe[0] = -1;}
+     if (bb_status.x_pipe[1] != -1){close(bb_status.x_pipe[1]); bb_status.x_pipe[1] = -1;}
+     //create a new pipe
+     if (pipe2(bb_status.x_pipe, O_NONBLOCK | O_CLOEXEC)){
+       set_bb_error("Could not create output pipe for X");
++      if (pathlen > 0) free(mod_path);
+       return false;
+     }
+     bb_status.x_pid = bb_run_fork_ld_redirect(x_argv, bb_config.ld_path, bb_status.x_pipe[1]);
++    if (pathlen > 0) free(mod_path);
+     //close the end of the pipe that is not ours
+     if (bb_status.x_pipe[1] != -1){close(bb_status.x_pipe[1]); bb_status.x_pipe[1] = -1;}
+   }
diff --git a/nixpkgs/pkgs/tools/X11/caffeine-ng/default.nix b/nixpkgs/pkgs/tools/X11/caffeine-ng/default.nix
new file mode 100644
index 000000000000..c161a7c77378
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/caffeine-ng/default.nix
@@ -0,0 +1,44 @@
+{ gdk-pixbuf, glib, gobject-introspection, gtk3, lib, libnotify,
+  python3Packages, wrapGAppsHook
+}:
+
+python3Packages.buildPythonApplication rec {
+  pname = "caffeine-ng";
+  version = "3.4.2";
+
+  src = python3Packages.fetchPypi{
+    inherit pname version;
+    sha256="05k8smjlfjcccgmp8qi04l7106k46fs4p8fl5bdqqjwv6pwl7y4w";
+  };
+
+  nativeBuildInputs = [ wrapGAppsHook glib ];
+  buildInputs = [ 
+    gdk-pixbuf gobject-introspection libnotify gtk3 
+    python3Packages.setuptools_scm
+  ];
+  pythonPath = with python3Packages; [
+    dbus-python docopt ewmh pygobject3 pyxdg
+    setproctitle 
+  ];
+
+  doCheck = false; # There are no tests.
+
+  postInstall = ''
+    mkdir -p $out/share
+    cp -r share $out/
+    # autostart file
+    cp -r $out/lib/python*/site-packages/etc $out/etc/
+    glib-compile-schemas --strict $out/share/glib-2.0/schemas
+    for i in $(find $out -name "*.desktop"); do
+      substituteInPlace $i --replace /usr $out
+    done
+  '';
+
+  meta = with lib; {
+    maintainers = with maintainers; [ marzipankaiser ];
+    description = "Status bar application to temporarily inhibit screensaver and sleep mode";
+    homepage = "https://github.com/caffeine-ng/caffeine-ng";
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/ckbcomp/default.nix b/nixpkgs/pkgs/tools/X11/ckbcomp/default.nix
new file mode 100644
index 000000000000..dc665bf9c41b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/ckbcomp/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitLab, perl, xkeyboard_config }:
+
+stdenv.mkDerivation rec {
+  pname = "ckbcomp";
+  version = "1.194";
+
+  src = fetchFromGitLab {
+    domain = "salsa.debian.org";
+    owner = "installer-team";
+    repo = "console-setup";
+    rev = version;
+    sha256 = "0fkabv05j5dj10mfrpjyvv7lnxl9qaqkbjhwj72r18i9i4019vgh";
+  };
+
+  buildInputs = [ perl ];
+
+  patchPhase = ''
+    substituteInPlace Keyboard/ckbcomp --replace "/usr/share/X11/xkb" "${xkeyboard_config}/share/X11/xkb"
+    substituteInPlace Keyboard/ckbcomp --replace "rules = 'xorg'" "rules = 'base'"
+  '';
+
+  dontBuild = true;
+
+  installPhase = ''
+    install -Dm0555 -t $out/bin Keyboard/ckbcomp
+    install -Dm0444 -t $out/share/man/man1 man/ckbcomp.1
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Compiles a XKB keyboard description to a keymap suitable for loadkeys";
+    homepage = "https://salsa.debian.org/installer-team/console-setup";
+    license = licenses.gpl2Plus;
+    maintainers = with stdenv.lib.maintainers; [ dezgeg ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/dex/default.nix b/nixpkgs/pkgs/tools/X11/dex/default.nix
new file mode 100644
index 000000000000..af8188883d9b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/dex/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, python3, fetchpatch }:
+
+stdenv.mkDerivation rec {
+  program = "dex";
+  name = "${program}-${version}";
+  version = "0.8.0";
+
+  src = fetchFromGitHub {
+    owner = "jceb";
+    repo = program;
+    rev = "v${version}";
+    sha256 = "13dkjd1373mbvskrdrp0865llr3zvdr90sc6a6jqswh3crmgmz4k";
+  };
+
+  propagatedBuildInputs = [ python3 ];
+  nativeBuildInputs = [ python3.pkgs.sphinx ];
+  makeFlags = [ "PREFIX=$(out)" "VERSION=$(version)" ];
+
+  patches = [
+    (fetchpatch {
+      url = "https://github.com/jceb/dex/commit/107358ddf5e1ca4fa56ef1a7ab161dc3b6adc45a.patch";
+      sha256 = "06dfkfzxp8199by0jc5wim8g8qw38j09dq9p6n9w4zaasla60pjq";
+    })
+  ];
+
+  meta = with stdenv.lib; {
+    description = "A program to generate and execute DesktopEntry files of the Application type";
+    homepage = "https://github.com/jceb/dex";
+    platforms = platforms.linux;
+    license = licenses.gpl3Plus;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/dispad/default.nix b/nixpkgs/pkgs/tools/X11/dispad/default.nix
new file mode 100644
index 000000000000..fccb28489efd
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/dispad/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, libX11, libXi, libconfuse }:
+
+stdenv.mkDerivation rec {
+  pname = "dispad";
+  version = "0.3.1";
+
+  src = fetchFromGitHub {
+    owner = "BlueDragonX";
+    repo = "dispad";
+    rev = "v${version}";
+    sha256 = "0y0n9mf1hs3s706gkpmg1lh74m6vvkqc9rdbzgc6s2k7vdl2zp1y";
+  };
+
+  buildInputs = [ libX11 libXi libconfuse ];
+
+  meta = with stdenv.lib; {
+    description = "A small daemon for disabling trackpads while typing";
+    homepage = "https://github.com/BlueDragonX/dispad";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ zimbatm ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/dragon-drop/default.nix b/nixpkgs/pkgs/tools/X11/dragon-drop/default.nix
new file mode 100644
index 000000000000..86c867b16ba8
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/dragon-drop/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, gtk, pkgconfig, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  pname = "dragon-drop";
+  version = "1.1.1";
+
+  src = fetchFromGitHub {
+    owner = "mwh";
+    repo = "dragon";
+    rev = "v${version}";
+    sha256 = "0fgzz39007fdjwq72scp0qygp2v3zc5f1xkm0sxaa8zxm25g1bra";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ gtk ];
+
+  installPhase = ''
+    install -D dragon -t $out/bin
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Simple drag-and-drop source/sink for X";
+    homepage = "https://github.com/mwh/dragon";
+    maintainers = with maintainers; [ jb55 markus1189 ];
+    license = licenses.gpl3;
+    platforms = with platforms; unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/ffcast/default.nix b/nixpkgs/pkgs/tools/X11/ffcast/default.nix
new file mode 100644
index 000000000000..1378d5e6b982
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/ffcast/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, perl, libX11 }:
+
+stdenv.mkDerivation rec {
+  pname = "ffcast";
+  version = "2.5.0";
+
+  src = fetchFromGitHub {
+    owner = "lolilolicon";
+    repo = "FFcast";
+    rev = version;
+    sha256 = "047y32bixhc8ksr98vwpgd0k1xxgsv2vs0n3kc2xdac4krc9454h";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ perl libX11 ];
+
+  configureFlags = [ "--disable-xrectsel" ];
+
+  postBuild = ''
+    make install
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Run commands on rectangular screen regions";
+    homepage = "https://github.com/lolilolicon/FFcast";
+    license = licenses.gpl3;
+    maintainers = [ maintainers.guyonvarch ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/go-sct/default.nix b/nixpkgs/pkgs/tools/X11/go-sct/default.nix
new file mode 100644
index 000000000000..01d82b4a112c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/go-sct/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, xorg, buildGoPackage, fetchFromGitHub }:
+
+buildGoPackage rec {
+  pname = "go-sct";
+  version = "20180605-${stdenv.lib.strings.substring 0 7 rev}";
+  rev = "eb1e851f2d5017038d2b8e3653645c36d3a279f4";
+
+  goPackagePath = "github.com/d4l3k/go-sct";
+
+  src = fetchFromGitHub {
+    inherit rev;
+    owner = "d4l3k";
+    repo = "go-sct";
+    sha256 = "16z2ml9x424cnliazyxlw7pm7q64pppjam3dnmq2xab0wlbbm3nm";
+  };
+
+  goDeps = ./deps.nix;
+
+  buildInputs = [ xorg.libX11 xorg.libXrandr ];
+
+  meta = with stdenv.lib; {
+    description = "Color temperature setting library and CLI that operates in a similar way to f.lux and Redshift";
+    license = licenses.mit;
+    maintainers = with maintainers; [ rvolosatovs cstrahan ];
+    platforms = platforms.linux ++ platforms.windows;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/go-sct/deps.nix b/nixpkgs/pkgs/tools/X11/go-sct/deps.nix
new file mode 100644
index 000000000000..f808858e091a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/go-sct/deps.nix
@@ -0,0 +1,11 @@
+[
+  {
+    goPackagePath = "github.com/cpucycle/astrotime";
+    fetch = {
+      type = "git";
+      url = "https://github.com/cpucycle/astrotime";
+      rev = "9c7d514efdb561775030eaf8f1a9ae6bddb3a2ca";
+      sha256 = "024sc7g55v4s54irssm5wsn74sr2k2ynsm6z16w47q66cxhgvby1";
+    };
+  }
+]
diff --git a/nixpkgs/pkgs/tools/X11/grobi/default.nix b/nixpkgs/pkgs/tools/X11/grobi/default.nix
new file mode 100644
index 000000000000..a2cca87edc08
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/grobi/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchFromGitHub, buildGoPackage }:
+
+buildGoPackage {
+  version = "0.5.1";
+  pname = "grobi";
+
+  goPackagePath = "github.com/fd0/grobi";
+
+  src = fetchFromGitHub {
+    rev = "5ddc167b9e4f84755a515828360abda15c54b7de";
+    owner = "fd0";
+    repo = "grobi";
+    sha256 = "0iyxidq60pf6ki52f8fffplf10nl8w9jx1b7igg98csnc6iqxh89";
+  };
+
+   meta = with stdenv.lib; {
+    homepage = "https://github.com/fd0/grobi";
+    description = "Automatically configure monitors/outputs for Xorg via RANDR";
+    license = with licenses; [ bsd2 ];
+    platforms   = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/hsetroot/default.nix b/nixpkgs/pkgs/tools/X11/hsetroot/default.nix
new file mode 100644
index 000000000000..3bfe98a7a211
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/hsetroot/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, autoconf, automake, imlib2, libtool, libX11, pkgconfig, xorgproto }:
+
+stdenv.mkDerivation rec {
+  pname = "hsetroot";
+  version = "1.0.2";
+
+  # The primary download site seems to no longer exist; use Gentoo's mirror for now.
+  src = fetchurl {
+    url = "http://mirror.datapipe.net/gentoo/distfiles/hsetroot-${version}.tar.gz";
+    sha256 = "d6712d330b31122c077bfc712ec4e213abe1fe71ab24b9150ae2774ca3154fd7";
+  };
+
+  # See https://bugs.gentoo.org/show_bug.cgi?id=504056
+  underlinkingPatch = fetchurl {
+    url = "http://www.gtlib.gatech.edu/pub/gentoo/gentoo-x86-portage/x11-misc/hsetroot/files/hsetroot-1.0.2-underlinking.patch";
+    name = "hsetroot-1.0.2-underlinking.patch";
+    sha256 = "1px1p3wz7ji725z9nlwb0x0h6lnnvnpz15sblzzq7zrijl3wz65x";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ autoconf automake imlib2 libtool libX11 xorgproto ];
+
+  patches = [ underlinkingPatch ];
+
+  patchFlags = [ "-p0" ];
+
+  preConfigure = "./autogen.sh";
+
+  meta = with stdenv.lib; {
+    description = "Allows you to compose wallpapers ('root pixmaps') for X";
+    homepage = "https://thegraveyard.org/hsetroot.html";
+    license = licenses.gpl2Plus;
+    maintainers = [ maintainers.henrytill ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/imwheel/default.nix b/nixpkgs/pkgs/tools/X11/imwheel/default.nix
new file mode 100644
index 000000000000..efed00f96397
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/imwheel/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, libX11, libXext, libXi, libXmu, libXt, libXtst }:
+
+stdenv.mkDerivation rec {
+  name = "imwheel-1.0.0pre12";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/imwheel/${name}.tar.gz";
+    sha256 = "2320ed019c95ca4d922968e1e1cbf0c075a914e865e3965d2bd694ca3d57cfe3";
+  };
+
+  buildInputs = [ libX11 libXext libXi libXmu libXt libXtst ];
+
+  makeFlags = [
+    "sysconfdir=/etc"
+    "ETCDIR=/etc"
+  ];
+
+  installFlags = [
+    "sysconfdir=${placeholder "out"}/etc"
+    "ETCDIR=${placeholder "out"}/etc"
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = "http://imwheel.sourceforge.net/";
+    description = "Mouse wheel configuration tool for XFree86/Xorg";
+    maintainers = with maintainers; [ jhillyerd ];
+    platforms = platforms.linux;
+    license = licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/jumpapp/default.nix b/nixpkgs/pkgs/tools/X11/jumpapp/default.nix
new file mode 100644
index 000000000000..c152a72a23d8
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/jumpapp/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, lib, perl, pandoc, fetchFromGitHub, xdotool, wmctrl, xprop, nettools }:
+
+stdenv.mkDerivation rec {
+  pname = "jumpapp";
+  version = "1.1";
+
+  src = fetchFromGitHub {
+    owner = "mkropat";
+    repo = "jumpapp";
+    rev = "v${version}";
+    sha256 = "1jrk4mm42sz6ca2gkb6w3dad53d4im4shpgsq8s4vr6xpl3b43ry";
+  };
+
+  makeFlags = [ "PREFIX=$(out)" ];
+  nativeBuildInputs = [ pandoc perl ];
+  buildInputs = [ xdotool wmctrl xprop nettools perl ];
+  postFixup = let
+    runtimePath = lib.makeBinPath buildInputs;
+  in
+  ''
+    sed -i "2 i export PATH=${runtimePath}:\$PATH" $out/bin/jumpapp
+    sed -i "2 i export PATH=${perl}/bin:\$PATH" $out/bin/jumpappify-desktop-entry
+  '';
+
+  meta = {
+    homepage = "https://github.com/mkropat/jumpapp";
+    description = "A run-or-raise application switcher for any X11 desktop";
+    license = lib.licenses.mit;
+    maintainers = [ lib.maintainers.matklad ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/keynav/default.nix b/nixpkgs/pkgs/tools/X11/keynav/default.nix
new file mode 100644
index 000000000000..64684cf73df2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/keynav/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchFromGitHub, pkgconfig, libX11, xorgproto, libXtst, libXi, libXext
+, libXinerama, libXrandr, glib, cairo, xdotool }:
+
+let release = "20180821"; in
+stdenv.mkDerivation {
+  name = "keynav-0.${release}.0";
+
+  src = fetchFromGitHub {
+    owner = "jordansissel";
+    repo = "keynav";
+    rev = "78f9e076a5618aba43b030fbb9344c415c30c1e5";
+    sha256 = "0hmc14fj612z5h7gjgk95zyqab3p35c4a99snnblzxfg0p3x2f1d";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libX11 xorgproto libXtst libXi libXext libXinerama libXrandr
+                  glib cairo xdotool ];
+
+  patchPhase = ''
+    echo >>VERSION MAJOR=0
+    echo >>VERSION RELEASE=${release}
+    echo >>VERSION REVISION=0
+  '';
+
+  installPhase =
+    ''
+      mkdir -p $out/bin $out/share/keynav/doc
+      cp keynav $out/bin
+      cp keynavrc $out/share/keynav/doc
+    '';
+
+  meta = with stdenv.lib; {
+    description = "Generate X11 mouse clicks from keyboard";
+    homepage = "https://www.semicomplete.com/projects/keynav/";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ pSub ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/ksuperkey/default.nix b/nixpkgs/pkgs/tools/X11/ksuperkey/default.nix
new file mode 100644
index 000000000000..1472e39c83c2
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/ksuperkey/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchgit, libX11, libXtst, pkgconfig, xorgproto, libXi }:
+
+stdenv.mkDerivation {
+  name = "ksuperkey-git-2015-07-21";
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    libX11 libXtst xorgproto libXi
+  ];
+
+  src = fetchgit {
+    url = "https://github.com/hanschen/ksuperkey";
+    rev = "e75a31a0e3e80b14341e92799a7ce3232ac37639";
+    sha256 = "0y4wkak9dvcm14g54ll1ln9aks2az63hx8fv7b8d3nscxjbkxl6g";
+  };
+
+  preConfigure = ''
+    makeFlags="$makeFlags PREFIX=$out"
+  '';
+
+  meta = {
+    description = "A tool to be able to bind the super key as a key rather than a modifier";
+    license = stdenv.lib.licenses.gpl3;
+    maintainers = [ stdenv.lib.maintainers.vozz ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/libstrangle/default.nix b/nixpkgs/pkgs/tools/X11/libstrangle/default.nix
new file mode 100644
index 000000000000..d24654ce3ad7
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/libstrangle/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  pname = "libstrangle";
+  version = "2017-02-22";
+
+  src = fetchFromGitHub {
+    owner = "milaq";
+    repo = pname;
+    rev = "6020f9e375ba747c75eb7996b7d5f0214ac3221e";
+    sha256 = "04ikacbjcq9phdc8q5y1qjjpa1sxmzfm0idln9ys95prg289zp4h";
+  };
+
+  makeFlags = [ "prefix=" "DESTDIR=$(out)" ];
+
+  patches = [ ./nixos.patch ];
+
+  postPatch = ''
+    substituteAllInPlace src/strangle.sh
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/milaq/libstrangle";
+    description = "Frame rate limiter for Linux/OpenGL";
+    license = licenses.gpl3;
+    platforms = [ "x86_64-linux" ];
+    maintainers = with maintainers; [ aske ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/libstrangle/nixos.patch b/nixpkgs/pkgs/tools/X11/libstrangle/nixos.patch
new file mode 100644
index 000000000000..03c8c19b54cf
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/libstrangle/nixos.patch
@@ -0,0 +1,29 @@
+diff --git a/makefile b/makefile
+index eb13054..a3a1125 100644
+--- a/makefile
++++ b/makefile
+@@ -27,12 +27,10 @@ $(BUILDDIR)libstrangle32.so: $(BUILDDIR)
+ 	$(CC) $(CFLAGS) $(LDFLAGS) -m32 -o $(BUILDDIR)libstrangle32.so $(SOURCES)
+ 
+ install: all
+-	install -m 0644 -D -T $(BUILDDIR)libstrangle.conf $(DESTDIR)/etc/ld.so.conf.d/libstrangle.conf
+ 	install -m 0755 -D -T $(BUILDDIR)libstrangle32.so $(DESTDIR)$(LIB32_PATH)/libstrangle.so
+ 	install -m 0755 -D -T $(BUILDDIR)libstrangle64.so $(DESTDIR)$(LIB64_PATH)/libstrangle.so
+ 	install -m 0755 -D -T $(SOURCEDIR)strangle.sh $(DESTDIR)$(bindir)/strangle
+ 	install -m 0644 -D -T COPYING $(DESTDIR)$(DOC_PATH)/LICENSE
+-	ldconfig
+ 
+ clean:
+ 	rm -f $(BUILDDIR)libstrangle64.so
+diff --git a/src/strangle.sh b/src/strangle.sh
+index e280e86..b2dd42b 100755
+--- a/src/strangle.sh
++++ b/src/strangle.sh
+@@ -31,6 +31,5 @@ if [ "$#" -eq 0 ]; then
+   exit 1
+ fi
+ 
+-# Execute the strangled program under a clean environment
+ # pass through the FPS and overriden LD_PRELOAD environment variables
+-exec env FPS="${FPS}" LD_PRELOAD="${LD_PRELOAD}:libstrangle.so" "$@"
++FPS="${FPS}" LD_LIBRARY_PATH="${LD_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}@out@/lib/libstrangle/lib64:@out@/lib/libstrangle/lib32" LD_PRELOAD="${LD_PRELOAD}:libstrangle.so" exec "$@"
diff --git a/nixpkgs/pkgs/tools/X11/ncview/default.nix b/nixpkgs/pkgs/tools/X11/ncview/default.nix
new file mode 100644
index 000000000000..1f793aa6c4c9
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/ncview/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl
+, netcdf, xlibsWrapper, xorg, udunits, expat
+}:
+
+let
+  pname = "ncview";
+  version = "2.1.8";
+
+in stdenv.mkDerivation {
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url    = "ftp://cirrus.ucsd.edu/pub/ncview/ncview-2.1.8.tar.gz";
+    sha256 = "1gliziyxil2fcz85hj6z0jq33avrxdcjs74d500lhxwvgd8drfp8";
+  };
+
+  buildInputs = [ netcdf xlibsWrapper xorg.libXaw udunits expat ];
+
+  meta = with stdenv.lib; {
+    description = "Visual browser for netCDF format files";
+    homepage    = "http://meteora.ucsd.edu/~pierce/ncview_home_page.html";
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ jmettes ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/nitrogen/default.nix b/nixpkgs/pkgs/tools/X11/nitrogen/default.nix
new file mode 100644
index 000000000000..057288fbaa37
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/nitrogen/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchurl, pkgconfig, glib, gtkmm2 }:
+
+let version = "1.6.1";
+in
+stdenv.mkDerivation rec {
+  pname = "nitrogen";
+  inherit version;
+
+  src = fetchurl {
+    url = "http://projects.l3ib.org/nitrogen/files/${pname}-${version}.tar.gz";
+    sha256 = "0zc3fl1mbhq0iyndy4ysmy8vv5c7xwf54rbgamzfhfvsgdq160pl";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [ glib gtkmm2 ];
+
+  patchPhase = ''
+    patchShebangs data/icon-theme-installer
+  '';
+
+  meta = {
+    description = "A wallpaper browser and setter for X11";
+    longDescription = ''
+      nitrogen is a lightweight utility that can set the root background on X11.
+      It operates independently of any desktop environment, and supports
+      multi-head with Xinerama. Wallpapers are browsable with a convenient GUI,
+      and settings are stored in a human-readable config file.
+    '';
+    homepage = "https://github.com/l3ib/nitrogen";
+    license = stdenv.lib.licenses.gpl2;
+    platforms = stdenv.lib.platforms.linux;
+    maintainers = [ stdenv.lib.maintainers.auntie ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/numlockx/default.nix b/nixpkgs/pkgs/tools/X11/numlockx/default.nix
new file mode 100644
index 000000000000..b59e9dc30ac8
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/numlockx/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchFromGitHub, libX11, libXext, autoconf }:
+
+stdenv.mkDerivation rec {
+  version = "1.2";
+  pname = "numlockx";
+
+  src = fetchFromGitHub {
+    owner = "rg3";
+    repo = pname;
+    rev = "9159fd3c5717c595dadfcb33b380a85c88406185";
+    sha256 = "1w49fayhwzn5rx0z1q2lrvm7z8jrd34lgb89p853a024bixc3cf2";
+  };
+
+  buildInputs = [ libX11 libXext autoconf ];
+
+  meta = with stdenv.lib; {
+    description = "Allows to start X with NumLock turned on";
+    license = licenses.mit;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/nx-libs/default.nix b/nixpkgs/pkgs/tools/X11/nx-libs/default.nix
new file mode 100644
index 000000000000..42444e5fca1b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/nx-libs/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, autoconf, automake, fetchFromGitHub, libgcc, libjpeg_turbo,
+  libpng, libtool, libxml2, pkgconfig, which, xorg }:
+stdenv.mkDerivation rec {
+  pname = "nx-libs";
+  version = "3.5.99.23";
+  src = fetchFromGitHub {
+    owner = "ArcticaProject";
+    repo = "nx-libs";
+    rev = version;
+    sha256 = "0hcsic9bf8w4ja3xy2nka8hcjvidqzjafn1bwr34l5l47h0kbyqz";
+  };
+
+  nativeBuildInputs = [ autoconf automake libtool pkgconfig which
+    xorg.gccmakedep xorg.imake ];
+  buildInputs = [ libgcc libjpeg_turbo libpng libxml2 xorg.fontutil
+    xorg.libXcomposite xorg.libXdamage xorg.libXdmcp xorg.libXext xorg.libXfont2
+    xorg.libXinerama xorg.libXpm xorg.libXrandr xorg.libXtst xorg.pixman
+    xorg.xkbcomp xorg.xkeyboardconfig ];
+
+  enableParallelBuilding = true;
+
+  postPatch = ''
+    patchShebangs .
+    find . -type f -name Makefile -exec sed -i 's|^\(SHELL:=\)/bin/bash$|\1${stdenv.shell}|g' {} \;
+    ln -s libNX_X11.so.6.3.0
+  '';
+
+  PREFIX=""; # Don't install to $out/usr/local
+  installPhase = ''
+    make DESTDIR="$out" install
+    # See:
+    # - https://salsa.debian.org/debian-remote-team/nx-libs/blob/bcc152100617dc59156015a36603a15db530a64f/debian/rules#L66-72
+    # - https://github.com/ArcticaProject/nx-libs/issues/652
+    patchelf --remove-needed "libX11.so.6" $out/bin/nxagent
+  '';
+
+  meta = {
+    description = "NX X server based on Xnest";
+    homepage = "https://github.com/ArcticaProject/nx-libs";
+    license = stdenv.lib.licenses.gpl2;
+    maintainers = with stdenv.lib.maintainers; [ jD91mZM2 ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/obconf/default.nix b/nixpkgs/pkgs/tools/X11/obconf/default.nix
new file mode 100644
index 000000000000..809e3614f0b1
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/obconf/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, pkgconfig, gtk2, libglade, openbox,
+  imlib2, libstartup_notification, makeWrapper, libSM }:
+
+stdenv.mkDerivation rec {
+  pname = "obconf";
+  version = "2.0.4";
+
+  src = fetchurl {
+    url = "http://openbox.org/dist/obconf/obconf-${version}.tar.gz";
+    sha256 = "1fanjdmd8727kk74x5404vi8v7s4kpq48l583d12fsi4xvsfb8vi";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [
+    gtk2 libglade libSM openbox imlib2 libstartup_notification
+    makeWrapper
+  ];
+
+  postInstall = ''
+    wrapProgram $out/bin/obconf --prefix XDG_DATA_DIRS : ${openbox}/share/
+  '';
+
+  meta = {
+    description = "GUI configuration tool for openbox";
+    homepage = "http://openbox.org/wiki/ObConf";
+    license = stdenv.lib.licenses.gpl2;
+    maintainers = [ stdenv.lib.maintainers.lhvwb ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/primus/default.nix b/nixpkgs/pkgs/tools/X11/primus/default.nix
new file mode 100644
index 000000000000..eb8aa042e7b0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/primus/default.nix
@@ -0,0 +1,34 @@
+# For a 64bit + 32bit system the LD_LIBRARY_PATH must contain both the 32bit and 64bit primus
+# libraries. Providing a different primusrun for each architecture will not work as expected. EG:
+# Using steam under wine can involve both 32bit and 64bit process. All of which inherit the
+# same LD_LIBRARY_PATH.
+# Other distributions do the same.
+{ stdenv
+, stdenv_i686
+, lib
+, primusLib
+, writeScriptBin
+, runtimeShell
+, primusLib_i686 ? null
+, useNvidia ? true
+}:
+
+let
+  # We override stdenv in case we need different ABI for libGL
+  primusLib_ = primusLib.override { inherit stdenv; };
+  primusLib_i686_ = primusLib_i686.override { stdenv = stdenv_i686; };
+
+  primus = if useNvidia then primusLib_ else primusLib_.override { nvidia_x11 = null; };
+  primus_i686 = if useNvidia then primusLib_i686_ else primusLib_i686_.override { nvidia_x11 = null; };
+  ldPath = lib.makeLibraryPath (lib.filter (x: x != null) (
+    [ primus primus.glvnd ]
+    ++ lib.optionals (primusLib_i686 != null) [ primus_i686 primus_i686.glvnd ]
+  ));
+
+in writeScriptBin "primusrun" ''
+  #!${runtimeShell}
+  export LD_LIBRARY_PATH=${ldPath}''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH
+  # https://bugs.launchpad.net/ubuntu/+source/bumblebee/+bug/1758243
+  export __GLVND_DISALLOW_PATCHING=1
+  exec "$@"
+''
diff --git a/nixpkgs/pkgs/tools/X11/primus/lib.nix b/nixpkgs/pkgs/tools/X11/primus/lib.nix
new file mode 100644
index 000000000000..f4c2c9efc49e
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/primus/lib.nix
@@ -0,0 +1,52 @@
+{ stdenv, fetchFromGitHub, fetchpatch
+, libX11, libGL, mesa
+, nvidia_x11 ? null
+, libglvnd
+}:
+
+let
+  aPackage =
+    if nvidia_x11 == null then libGL
+    else if nvidia_x11.useGLVND then libglvnd
+    else nvidia_x11;
+
+in stdenv.mkDerivation {
+  name = "primus-lib-2015-04-28";
+
+  src = fetchFromGitHub {
+    owner = "amonakov";
+    repo = "primus";
+    rev = "d1afbf6fce2778c0751eddf19db9882e04f18bfd";
+    sha256 = "118jm57ccawskb8vjq3a9dpa2gh72nxzvx2zk7zknpy0arrdznj1";
+  };
+
+  patches = [
+    # Bump buffer size for long library paths.
+    (fetchpatch {
+      url = "https://github.com/abbradar/primus/commit/2f429e232581c556df4f4bf210aee8a0c99c60b7.patch";
+      sha256 = "1da6ynz7r7x98495i329sf821308j1rpy8prcdraqahz7p4c89nc";
+    })
+  ];
+
+  buildInputs = [ libX11 libGL ];
+
+  makeFlags = [ "LIBDIR=$(out)/lib"
+                "PRIMUS_libGLa=${aPackage}/lib/libGL.so"
+                "PRIMUS_libGLd=${libGL}/lib/libGL.so"
+                "PRIMUS_LOAD_GLOBAL=${mesa}/lib/libglapi.so"
+              ];
+
+  installPhase = ''
+    ln -s $out/lib/libGL.so.1 $out/lib/libGL.so
+  '';
+
+  passthru.glvnd = if nvidia_x11 != null && nvidia_x11.useGLVND then nvidia_x11 else null;
+
+  meta = with stdenv.lib; {
+    description = "Low-overhead client-side GPU offloading";
+    homepage = "https://github.com/amonakov/primus";
+    platforms = [ "i686-linux" "x86_64-linux" ];
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/ratmen/default.nix b/nixpkgs/pkgs/tools/X11/ratmen/default.nix
new file mode 100644
index 000000000000..f60426226747
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/ratmen/default.nix
@@ -0,0 +1,35 @@
+{stdenv, fetchurl, perl, xorgproto, libX11}:
+let
+  s = # Generated upstream information
+  rec {
+    baseName="ratmen";
+    version="2.2.3";
+    name="${baseName}-${version}";
+    hash="0gnfqhnch9x8jhr87gvdjcp1wsqhchfjilpnqcwx5j0nlqyz6wi6";
+    url="http://www.update.uu.se/~zrajm/programs/ratmen/ratmen-2.2.3.tar.gz";
+    sha256="0gnfqhnch9x8jhr87gvdjcp1wsqhchfjilpnqcwx5j0nlqyz6wi6";
+  };
+  buildInputs = [
+    perl xorgproto libX11
+  ];
+in
+stdenv.mkDerivation {
+  inherit (s) name version;
+  inherit buildInputs;
+  src = fetchurl {
+    inherit (s) url sha256;
+  };
+  makeFlags = [
+    "PREFIX=$(out)"
+  ];
+  meta = {
+    inherit (s) version;
+    description = ''A minimalistic X11 menu creator'';
+    license = stdenv.lib.licenses.free ; # 9menu derivative with 9menu license
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.linux;
+    homepage = "http://www.update.uu.se/~zrajm/programs/";
+    downloadPage = "http://www.update.uu.se/~zrajm/programs/ratmen/";
+    updateWalker = true;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/run-scaled/default.nix b/nixpkgs/pkgs/tools/X11/run-scaled/default.nix
new file mode 100644
index 000000000000..aae09d49b3d4
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/run-scaled/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchFromGitHub, makeWrapper, bc, xorgserver, xpra, xrandr }:
+
+stdenv.mkDerivation {
+  version = "git-2018-06-03";
+  pname = "run-scaled";
+
+  src = fetchFromGitHub {
+    owner  = "kaueraal";
+    repo   = "run_scaled";
+    rev    = "fa71b3c17e627a96ff707ad69f1def5361f2245c";
+    sha256 = "1ma4ax7ydq4xvyzrc4zapihmf7v3d9zl9mbi8bgpps7nlgz544ys";
+  };
+
+  buildInputs = [ makeWrapper ];
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp run_scaled $out/bin
+    wrapProgram $out/bin/run_scaled --prefix PATH ":" \
+      ${stdenv.lib.makeBinPath [ bc xorgserver xpra xrandr ]}
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Run an X application scaled via xpra";
+    homepage = "https://github.com/kaueraal/run_scaled";
+    maintainers = [ maintainers.snaar ];
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/runningx/default.nix b/nixpkgs/pkgs/tools/X11/runningx/default.nix
new file mode 100644
index 000000000000..55f99c63365d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/runningx/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, pkgconfig, libX11 }:
+
+stdenv.mkDerivation {
+  pname = "runningx";
+  version = "1.0";
+  
+  src = fetchurl {
+    url = "http://www.fiction.net/blong/programs/mutt/autoview/RunningX.c";
+    sha256 = "1mikkhrx6jsx716041qdy3nwjac08pxxvxyq2yablm8zg9hrip0d";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [ libX11 ];
+
+  phases = [ "buildPhase" "installPhase" ];
+
+  buildPhase = ''
+    cc -O2 -o RunningX $(pkg-config --cflags --libs x11) $src
+  '';
+
+  installPhase = ''
+    mkdir -p "$out"/bin
+    cp -vai RunningX "$out/bin"
+  '';
+
+  meta = {
+    homepage = "http://www.fiction.net/blong/programs/mutt/";
+    description = "A program for testing if X is running";
+    license = stdenv.lib.licenses.free;
+    platforms = stdenv.lib.platforms.unix;
+    maintainers = [ stdenv.lib.maintainers.romildo ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/screen-message/default.nix b/nixpkgs/pkgs/tools/X11/screen-message/default.nix
new file mode 100644
index 000000000000..c57c4f824310
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/screen-message/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl, autoreconfHook, pkgconfig, gtk3 }:
+
+stdenv.mkDerivation rec {
+  pname = "screen-message";
+  version = "0.25";
+
+  src = fetchurl {
+    url = "mirror://debian/pool/main/s/screen-message/screen-message_${version}.orig.tar.gz";
+    sha256 = "1lw955qq5pq010lzmaf32ylj2iprgsri9ih4hx672c3f794ilab0";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ gtk3 ];
+
+  # screen-message installs its binary in $(prefix)/games per default
+  makeFlags = [ "execgamesdir=$(out)/bin" ];
+
+  meta = {
+    homepage = "https://www.joachim-breitner.de/en/projects#screen-message";
+    description = "Displays a short text fullscreen in an X11 window";
+    license = stdenv.lib.licenses.gpl2Plus;
+    maintainers = [ stdenv.lib.maintainers.fpletz ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/sct/DISPLAY-segfault.patch b/nixpkgs/pkgs/tools/X11/sct/DISPLAY-segfault.patch
new file mode 100644
index 000000000000..6b83afa332ba
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/sct/DISPLAY-segfault.patch
@@ -0,0 +1,10 @@
+--- a/sct.c	2017-09-22 00:44:20.270421881 +0000
++++ b/sct.c	2017-09-26 10:50:38.964562740 +0000
+@@ -36,6 +36,7 @@
+ main(int argc, char **argv)
+ {
+ 	Display *dpy = XOpenDisplay(NULL);
++	if (!dpy) exit(1);
+ 	int screen = DefaultScreen(dpy);
+ 	Window root = RootWindow(dpy, screen);
+ 
diff --git a/nixpkgs/pkgs/tools/X11/sct/default.nix b/nixpkgs/pkgs/tools/X11/sct/default.nix
new file mode 100644
index 000000000000..3f6291417e59
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/sct/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, libX11, libXrandr }:
+
+stdenv.mkDerivation rec {
+  name = "sct";
+
+  src = fetchurl {
+    url = "http://www.tedunangst.com/flak/files/sct.c";
+    sha256 = "01f3ndx3s6d2qh2xmbpmhd4962dyh8yp95l87xwrs4plqdz6knhd";
+  };
+
+  unpackPhase = "cat ${src} > sct.c";
+  patches = [ ./DISPLAY-segfault.patch ];
+
+  buildInputs = [ libX11 libXrandr ];
+  buildPhase = "cc sct.c -o sct -lm -lX11 -lXrandr";
+
+  installPhase = "install -Dt $out/bin sct";
+
+  meta = with stdenv.lib; {
+    homepage = "https://www.tedunangst.com/flak/post/sct-set-color-temperature";
+    description = "A minimal utility to set display colour temperature";
+    maintainers = [ maintainers.raskin ];
+    license = licenses.publicDomain;
+    platforms = with platforms; linux ++ freebsd ++ openbsd;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/setroot/default.nix b/nixpkgs/pkgs/tools/X11/setroot/default.nix
new file mode 100644
index 000000000000..56c356b20d5b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/setroot/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, libX11, imlib2
+, enableXinerama ? true, libXinerama ? null
+}:
+
+assert enableXinerama -> libXinerama != null;
+
+stdenv.mkDerivation rec {
+  version = "2.0.2";
+  pname = "setroot";
+
+  src = fetchFromGitHub {
+    owner = "ttzhou";
+    repo = "setroot";
+    rev = "v${version}";
+    sha256 = "0w95828v0splk7bj5kfacp4pq6wxpyamvyjmahyvn5hc3ycq21mq";
+  };
+
+  buildInputs = [ libX11 imlib2 ]
+    ++ stdenv.lib.optional enableXinerama libXinerama;
+
+  buildFlags = [ "CC=cc" (if enableXinerama then "xinerama=1" else "xinerama=0") ] ;
+
+  installFlags = [ "DESTDIR=$(out)" "PREFIX=" ];
+
+  meta = with stdenv.lib; {
+    description = "Simple X background setter inspired by imlibsetroot and feh";
+    homepage = "https://github.com/ttzhou/setroot";
+    license = licenses.gpl3Plus;
+    maintainers = [ maintainers.vyp ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/skippy-xd/default.nix b/nixpkgs/pkgs/tools/X11/skippy-xd/default.nix
new file mode 100644
index 000000000000..4fd9678733dd
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/skippy-xd/default.nix
@@ -0,0 +1,30 @@
+{stdenv, fetchgit, xorgproto, libX11, libXft, libXcomposite, libXdamage
+, libXext, libXinerama, libjpeg, giflib, pkgconfig
+}:
+let
+  buildInputs = [
+    xorgproto libX11 libXft libXcomposite libXdamage libXext
+    libXinerama libjpeg giflib pkgconfig
+  ];
+in
+stdenv.mkDerivation rec {
+  version = "git-2015-03-01";
+  pname = "skippy-xd";
+  inherit buildInputs;
+  src = fetchgit {
+    url = "https://github.com/richardgv/skippy-xd/";
+    rev = "397216ca67";
+    sha256 = "0zcjacilmsv69rv85j6nfr6pxy8z36w1sjz0dbjg6s5m4kga1zl8";
+  };
+  makeFlags = ["PREFIX=$(out)"];
+  preInstall = ''
+    sed -e "s@/etc/xdg@$out&@" -i Makefile
+  '';
+  meta = {
+    inherit version;
+    description = ''Expose-style compositing-based standalone window switcher'';
+    license = stdenv.lib.licenses.gpl2Plus ;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/srandrd/default.nix b/nixpkgs/pkgs/tools/X11/srandrd/default.nix
new file mode 100644
index 000000000000..6d5fa0f3d980
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/srandrd/default.nix
@@ -0,0 +1,31 @@
+{ stdenv
+, fetchFromGitHub
+, libX11
+, libXrandr
+, libXinerama
+}:
+
+stdenv.mkDerivation rec {
+  pname = "srandrd";
+  version = "0.6.0";
+
+  src = fetchFromGitHub {
+    owner = "jceb";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "07r1ck2ijj30n19ylndgw75ly9k3815kj9inpxblfnjpwbbw6ic0";
+  };
+
+  buildInputs = [ libX11 libXrandr libXinerama ];
+
+  makeFlags = [ "PREFIX=$(out)" ];
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/jceb/srandrd";
+    description = "Simple randr daemon";
+    license = licenses.mit;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.utdemir ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/tools/X11/sselp/default.nix b/nixpkgs/pkgs/tools/X11/sselp/default.nix
new file mode 100644
index 000000000000..81893fd2be83
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/sselp/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, libX11 }:
+
+stdenv.mkDerivation rec {
+  version = "0.2";
+  pname = "sselp";
+ 
+  src = fetchurl {
+    url = "https://dl.suckless.org/tools/${pname}-${version}.tar.gz";
+    sha256 = "08mqp00lrh1chdrbs18qr0xv63h866lkmfj87kfscwdm1vn9a3yd";
+  };
+ 
+  buildInputs = [ libX11 ];
+
+  patchPhase = ''
+    sed -i "s@/usr/local@$out@g" config.mk
+    sed -i "s@/usr/X11R6/include@${libX11}/include@g" config.mk
+    sed -i "s@/usr/X11R6/lib@${libX11}/lib@g" config.mk
+  '';
+
+  meta = {
+    homepage = "https://tools.suckless.org/sselp";
+    description = "Prints the X selection to stdout, useful in scripts";
+    license = stdenv.lib.licenses.mit;
+    maintainers = [stdenv.lib.maintainers.magnetophon ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/vdpauinfo/default.nix b/nixpkgs/pkgs/tools/X11/vdpauinfo/default.nix
new file mode 100644
index 000000000000..741043a9e538
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/vdpauinfo/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, pkgconfig, libvdpau }:
+
+stdenv.mkDerivation rec {
+  pname = "vdpauinfo";
+  version = "1.3";
+
+  src = fetchurl {
+    url = "https://gitlab.freedesktop.org/vdpau/vdpauinfo/uploads/6fa9718c507ef0fb6966170ef55344bf/${pname}-${version}.tar.gz";
+    sha256 = "0s6jdadnycyd1agsnfx7hrf17hmipasx1fpmppd4m1z6i9sp1i6g";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libvdpau ];
+
+  meta = with stdenv.lib; {
+    homepage = "https://people.freedesktop.org/~aplattner/vdpau/";
+    description = "Tool to query the Video Decode and Presentation API for Unix (VDPAU) abilities of the system";
+    license = licenses.mit; # expat version
+    platforms = platforms.unix;
+    maintainers = [ maintainers.vcunat ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/virtualgl/default.nix b/nixpkgs/pkgs/tools/X11/virtualgl/default.nix
new file mode 100644
index 000000000000..aa839e6d684d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/virtualgl/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, lib
+, virtualglLib
+, virtualglLib_i686 ? null
+}:
+
+stdenv.mkDerivation {
+  name = "virtualgl-${lib.getVersion virtualglLib}";
+
+  paths = [ virtualglLib ];
+
+  buildCommand = ''
+    mkdir -p $out/bin
+    for i in ${virtualglLib}/bin/* ${virtualglLib}/bin/.vglrun*; do
+      ln -s "$i" $out/bin
+    done
+  '' + lib.optionalString (virtualglLib_i686 != null) ''
+    ln -sf ${virtualglLib_i686}/bin/.vglrun.vars32 $out/bin
+  '';
+
+  meta = {
+    platforms = stdenv.lib.platforms.linux;
+    inherit (virtualglLib.meta) license;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/virtualgl/lib.nix b/nixpkgs/pkgs/tools/X11/virtualgl/lib.nix
new file mode 100644
index 000000000000..a2a7e5e6922b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/virtualgl/lib.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, cmake, libGL, libGLU, libX11, libXv, libXtst, libjpeg_turbo, fltk }:
+
+stdenv.mkDerivation rec {
+  pname = "virtualgl-lib";
+  version = "2.6.2";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/virtualgl/VirtualGL-${version}.tar.gz";
+    sha256 = "0ngqwsm9bml6lis0igq3bn92amh04rccd6jhjibj3418hrbzipvr";
+  };
+
+  cmakeFlags = [ "-DVGL_SYSTEMFLTK=1" "-DTJPEG_LIBRARY=${libjpeg_turbo.out}/lib/libturbojpeg.so" ];
+
+  makeFlags = [ "PREFIX=$(out)" ];
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ libjpeg_turbo libGL libGLU fltk libX11 libXv libXtst ];
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = "http://www.virtualgl.org/";
+    description = "X11 GL rendering in a remote computer with full 3D hw acceleration";
+    license = licenses.wxWindows;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/wayv/default.nix b/nixpkgs/pkgs/tools/X11/wayv/default.nix
new file mode 100644
index 000000000000..55f6eede0fa3
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/wayv/default.nix
@@ -0,0 +1,32 @@
+{stdenv, fetchFromGitHub, libX11}:
+stdenv.mkDerivation rec {
+  pname = "wayv";
+  version = "0.3";
+
+  src = fetchFromGitHub {
+    owner = "mikemb";
+    repo = pname;
+    rev = "b716877603250f690f08b593bf30fd5e8a93a872";
+    sha256 = "046dvaq6na1fyxz5nrjg13aaz6ific9wbygck0dknqqfmmjrsv3b";
+  };
+
+  buildInputs = [ libX11 ];
+
+  postInstall = ''
+    make -C doc install
+    mkdir -p "$out"/share/doc/wayv
+    cp [A-Z][A-Z]* "$out"/share/doc/wayv
+    cp doc/[A-Z][A-Z]* "$out"/share/doc/wayv
+    cp doc/*.txt "$out"/share/doc/wayv
+    cp doc/*.jpg "$out"/share/doc/wayv
+  '';
+
+  meta = {
+    inherit version;
+    description = "A gesture control for X11";
+    license = stdenv.lib.licenses.gpl2Plus ;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.linux;
+    homepage = "https://github.com/mikemb/wayV";
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/wmctrl/64-bit-data.patch b/nixpkgs/pkgs/tools/X11/wmctrl/64-bit-data.patch
new file mode 100644
index 000000000000..3ec1c913ffea
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/wmctrl/64-bit-data.patch
@@ -0,0 +1,32 @@
+Description: Correct 64 Architecture implementation of 32 bit data
+Author: Chris Donoghue <cdonoghu@gmail.com>
+Bug-Debian: http://bugs.debian.org/362068
+
+--- wmctrl-1.07.orig/main.c
++++ wmctrl-1.07/main.c
+@@ -1425,6 +1425,16 @@ static gchar *get_property (Display *dis
+      *
+      * long_length = Specifies the length in 32-bit multiples of the
+      *               data to be retrieved.
++     *
++     * NOTE:  see 
++     * http://mail.gnome.org/archives/wm-spec-list/2003-March/msg00067.html
++     * In particular:
++     *
++     * 	When the X window system was ported to 64-bit architectures, a
++     * rather peculiar design decision was made. 32-bit quantities such
++     * as Window IDs, atoms, etc, were kept as longs in the client side
++     * APIs, even when long was changed to 64 bits.
++     *
+      */
+     if (XGetWindowProperty(disp, win, xa_prop_name, 0, MAX_PROPERTY_VALUE_LEN / 4, False,
+             xa_prop_type, &xa_ret_type, &ret_format,     
+@@ -1441,6 +1451,8 @@ static gchar *get_property (Display *dis
+ 
+     /* null terminate the result to make string handling easier */
+     tmp_size = (ret_format / 8) * ret_nitems;
++    /* Correct 64 Architecture implementation of 32 bit data */
++    if(ret_format==32) tmp_size *= sizeof(long)/4;
+     ret = g_malloc(tmp_size + 1);
+     memcpy(ret, ret_prop, tmp_size);
+     ret[tmp_size] = '\0';
diff --git a/nixpkgs/pkgs/tools/X11/wmctrl/default.nix b/nixpkgs/pkgs/tools/X11/wmctrl/default.nix
new file mode 100644
index 000000000000..64f8627a2eff
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/wmctrl/default.nix
@@ -0,0 +1,33 @@
+{ stdenv
+, fetchurl
+, libX11
+, glib
+, pkgconfig
+, libXmu
+}:
+
+stdenv.mkDerivation rec {
+
+  pname = "wmctrl";
+  version = "1.07";
+
+  src = fetchurl {
+    # NOTE: 2019-04-11: There is also a semi-official mirror: http://tripie.sweb.cz/utils/wmctrl/
+    url = "https://sites.google.com/site/tstyblo/wmctrl/${pname}-${version}.tar.gz";
+    sha256 = "1afclc57b9017a73mfs9w7lbdvdipmf9q0xdk116f61gnvyix2np";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libX11 libXmu glib ];
+
+  patches = [ ./64-bit-data.patch ];
+
+  meta = {
+    homepage = "https://sites.google.com/site/tstyblo/wmctrl";
+    description = "CLI tool to interact with EWMH/NetWM compatible X Window Managers";
+    license = stdenv.lib.licenses.gpl2;
+    platforms = with stdenv.lib.platforms; all;
+    maintainers = [ stdenv.lib.maintainers.Anton-Latukha ];
+  };
+
+}
diff --git a/nixpkgs/pkgs/tools/X11/wmutils-core/default.nix b/nixpkgs/pkgs/tools/X11/wmutils-core/default.nix
new file mode 100644
index 000000000000..fdf805f80992
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/wmutils-core/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, libxcb }:
+
+stdenv.mkDerivation rec {
+  pname = "wmutils-core";
+  version = "1.1";
+
+  src = fetchurl {
+    url = "https://github.com/wmutils/core/archive/v${version}.tar.gz";
+    sha256 = "0aq95khs154j004b79w9rgm80vpggxfqynha5rckm2cx20d1fa5s";
+  };
+
+  buildInputs = [ libxcb ];
+
+  installFlags = [ "PREFIX=$(out)" ];
+
+  meta = with stdenv.lib; {
+    description = "Set of window manipulation tools";
+    homepage = "https://github.com/wmutils/core";
+    license = licenses.isc;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/wmutils-opt/default.nix b/nixpkgs/pkgs/tools/X11/wmutils-opt/default.nix
new file mode 100644
index 000000000000..39f26b95cdbc
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/wmutils-opt/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, libxcb }:
+
+stdenv.mkDerivation rec {
+  pname = "wmutils-opt";
+  version = "1.0";
+
+  src = fetchFromGitHub {
+    owner = "wmutils";
+    repo = "opt";
+    rev = "v${version}";
+    sha256 = "0gd05qsir1lnzfrbnfh08qwsryz7arwj20f886nqh41m87yqaljz";
+  };
+
+  buildInputs = [ libxcb ];
+
+  installFlags = [ "PREFIX=$(out)" ];
+
+  meta = with stdenv.lib; {
+    description = "Optional addons to wmutils";
+    homepage = "https://github.com/wmutils/opt";
+    license = licenses.isc;
+    maintainers = with maintainers; [ vifino ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/wpgtk/default.nix b/nixpkgs/pkgs/tools/X11/wpgtk/default.nix
new file mode 100644
index 000000000000..4125229237ae
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/wpgtk/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, python3Packages, fetchFromGitHub, libxslt,
+  gobject-introspection, gtk3, wrapGAppsHook, gnome3 }:
+
+python3Packages.buildPythonApplication rec {
+  pname = "wpgtk";
+  version = "6.0.13";
+
+  src = fetchFromGitHub {
+    owner = "deviantfero";
+    repo = "wpgtk";
+    rev = version;
+    sha256 = "1fphv6k2hqfi3fzazjqmvip7sz9fhy5ccsgpqv68vfylrf8g1f92";
+  };
+
+  buildInputs = [
+    wrapGAppsHook
+    gtk3
+    gobject-introspection
+    gnome3.adwaita-icon-theme
+    libxslt
+  ];
+
+  propagatedBuildInputs = with python3Packages; [
+    pygobject3
+    pillow
+    pywal
+  ];
+
+  # The $HOME variable must be set to build the package. A "permission denied" error will occur otherwise
+  preBuild = ''
+      export HOME=$(pwd)
+  '';
+
+  # No test exist
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Template based wallpaper/colorscheme generator and manager";
+    longDescription = ''
+     In short, wpgtk is a colorscheme/wallpaper manager with a template system attached which lets you create templates from any textfile and will replace keywords on it on the fly, allowing for great styling and theming possibilities.
+
+     wpgtk uses pywal as its colorscheme generator, but builds upon it with a UI and other features, such as the abilty to mix and edit the colorschemes generated and save them with their respective wallpapers, having light and dark themes, hackable and fast GTK theme made specifically for wpgtk and custom keywords and values to replace in templates.
+
+     INFO: To work properly, this tool needs "programs.dconf.enable = true" on nixos or dconf installed. A reboot may be required after installing dconf.
+     '';
+    homepage = "https://github.com/deviantfero/wpgtk";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.melkor333 ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/x11spice/default.nix b/nixpkgs/pkgs/tools/X11/x11spice/default.nix
new file mode 100644
index 000000000000..23af2ac44ca6
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/x11spice/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitLab, autoreconfHook, pkgconfig
+, xorg, gtk2, spice, spice-protocol
+}:
+
+stdenv.mkDerivation rec {
+  pname = "x11spice";
+  version = "2019-08-20";
+
+  src = fetchFromGitLab {
+    domain = "gitlab.freedesktop.org";
+    owner = "spice";
+    repo = "x11spice";
+    rev = "51d2a8ba3813469264959bb3ba2fc6fe08097be6";
+    sha256 = "0va5ix14vnqch59gq8wvrhw6q0w0n27sy70xx5kvfj2cl0h1xpg8";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+  buildInputs = [
+    xorg.libxcb xorg.xcbutil xorg.utilmacros
+    gtk2 spice spice-protocol
+  ];
+
+  NIX_LDFLAGS = "-lpthread";
+
+  meta = with stdenv.lib; {
+    description = ''
+      x11spice will enable a running X11 desktop to be available
+      via a Spice server
+    '';
+    homepage = "https://gitlab.freedesktop.org/spice/x11spice";
+    platforms = platforms.linux;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ rnhmjoj ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/x11vnc/default.nix b/nixpkgs/pkgs/tools/X11/x11vnc/default.nix
new file mode 100644
index 000000000000..2f7b0d7697e5
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/x11vnc/default.nix
@@ -0,0 +1,49 @@
+{ stdenv, fetchFromGitHub,
+  openssl, zlib, libjpeg, xorg, coreutils, libvncserver,
+  autoreconfHook, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  pname = "x11vnc";
+  version = "0.9.16";
+
+  src = fetchFromGitHub {
+    owner = "LibVNC";
+    repo = "x11vnc";
+    rev = version;
+    sha256 = "1g652mmi79pfq4p5p7spaswa164rpzjhc5rn2phy5pm71lm0vib1";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+  buildInputs =
+    [ xorg.libXfixes xorg.xorgproto openssl xorg.libXdamage
+      zlib xorg.libX11 libjpeg
+      xorg.libXtst xorg.libXinerama xorg.libXrandr
+      xorg.libXext
+      xorg.libXi xorg.libXrender
+      libvncserver
+    ];
+
+  postPatch = ''
+    substituteInPlace src/unixpw.c \
+        --replace '"/bin/su"' '"/run/wrappers/bin/su"' \
+        --replace '"/bin/true"' '"${coreutils}/bin/true"'
+
+    sed -i -e '/#!\/bin\/sh/a"PATH=${xorg.xdpyinfo}\/bin:${xorg.xauth}\/bin:$PATH\\n"' -e 's|/bin/su|/run/wrappers/bin/su|g' src/ssltools.h
+
+    # Xdummy script is currently broken, so we avoid building it. This removes everything Xdummy-related from the affected Makefile
+    sed -i -e '/^\tXdummy.c\ \\$/,$d' -e 's/\tx11vnc_loop\ \\/\tx11vnc_loop/' misc/Makefile.am
+  '';
+
+  preConfigure = ''
+    configureFlags="--mandir=$out/share/man"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A VNC server connected to a real X11 screen";
+    homepage = "https://github.com/LibVNC/x11vnc/";
+    platforms = platforms.linux;
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ OPNA2608 ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/x2vnc/default.nix b/nixpkgs/pkgs/tools/X11/x2vnc/default.nix
new file mode 100644
index 000000000000..65d45e23396e
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/x2vnc/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, xorg }:
+
+stdenv.mkDerivation {
+  name = "x2vnc-1.7.2";
+
+  src = fetchurl {
+    url = "https://fredrik.hubbe.net/x2vnc/x2vnc-1.7.2.tar.gz";
+    sha256 = "00bh9j3m6snyd2fgnzhj5vlkj9ibh69gfny9bfzlxbnivb06s1yw";
+  };
+
+  buildInputs = with xorg; [
+      libX11 xorgproto libXext libXrandr
+    ];
+
+  hardeningDisable = [ "format" ];
+
+  meta = with stdenv.lib; {
+    homepage = "http://fredrik.hubbe.net/x2vnc.html";
+    description = "A program to control a remote VNC server";
+    platforms = platforms.unix;
+    license = licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/x2x/default.nix b/nixpkgs/pkgs/tools/X11/x2x/default.nix
new file mode 100644
index 000000000000..deada6ae2d1c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/x2x/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, imake, libX11, libXtst, libXext, gccmakedep }:
+
+stdenv.mkDerivation {
+  name = "x2x-1.27";
+
+  src = fetchurl {
+    url = "https://github.com/downloads/dottedmag/x2x/x2x-1.27.tar.gz";
+    sha256 = "0dha0kn1lbc4as0wixsvk6bn4innv49z9a0sm5wlx4q1v0vzqzyj";
+  };
+
+  nativeBuildInputs = [ imake gccmakedep ];
+  buildInputs = [ libX11 libXtst libXext ];
+
+  hardeningDisable = [ "format" ];
+
+  buildFlags = [ "x2x" ];
+
+  installPhase = ''
+    install -D x2x $out/bin/x2x
+    install -D x2x.1 $out/man/man1/x2x.1
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Allows the keyboard, mouse on one X display to be used to control another X display";
+    homepage = "https://github.com/dottedmag/x2x";
+    license = licenses.bsd3;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xannotate/default.nix b/nixpkgs/pkgs/tools/X11/xannotate/default.nix
new file mode 100644
index 000000000000..b1e070673c6d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xannotate/default.nix
@@ -0,0 +1,23 @@
+{stdenv, fetchFromBitbucket, libX11}:
+stdenv.mkDerivation rec {
+  pname = "xannotate";
+  version = "20150301";
+  
+  src = fetchFromBitbucket {
+    owner = "blais";
+    repo = pname;
+    rev = "e5591c2ec67ca39988f1fb2966e94f0f623f9aa7";
+    sha256 = "02jy19if0rnbxvs6b0l5mi9ifvdj2qmv0pv278v9kfs0kvir68ik";
+  };
+
+  buildInputs = [ libX11 ];
+
+  meta = {
+    inherit version;
+    description = "A tool to scribble over X windows";
+    license = stdenv.lib.licenses.gpl2Plus ;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.linux;
+    homepage = "https://bitbucket.org/blais/xannotate";
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xautomation/default.nix b/nixpkgs/pkgs/tools/X11/xautomation/default.nix
new file mode 100644
index 000000000000..0a31d5fb8653
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xautomation/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, pkgconfig, libpng, libX11, libXext, libXi, libXtst }:
+
+let version = "1.09"; in
+stdenv.mkDerivation {
+  pname = "xautomation";
+  inherit version;
+  src = fetchurl {
+    url = "https://www.hoopajoo.net/static/projects/xautomation-${version}.tar.gz";
+    sha256 = "03azv5wpg65h40ip2kk1kdh58vix4vy1r9bihgsq59jx2rhjr3zf";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libpng libX11 libXext libXi libXtst ];
+
+  meta = {
+    homepage = "https://www.hoopajoo.net/projects/xautomation.html";
+    description = "Control X from the command line for scripts, and do \"visual scraping\" to find things on the screen";
+    license = stdenv.lib.licenses.gpl2Plus;
+    maintainers = with stdenv.lib.maintainers; [ vaibhavsagar ];
+    platforms = with stdenv.lib.platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xbanish/default.nix b/nixpkgs/pkgs/tools/X11/xbanish/default.nix
new file mode 100644
index 000000000000..af522cca9e10
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xbanish/default.nix
@@ -0,0 +1,42 @@
+{stdenv, fetchFromGitHub, libX11, libXi, libXt, libXfixes, libXext}:
+
+stdenv.mkDerivation rec {
+  version = "1.6";
+  pname = "xbanish";
+
+  buildInputs = [
+    libX11 libXi libXt libXfixes libXext
+  ];
+
+  src = fetchFromGitHub {
+    owner = "jcs";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0vp8ja68hpmqkl61zyjar3czhmny1hbm74m8f393incfz1ymr3i8";
+  };
+
+  makeFlags=[ "PREFIX=$(out)" ];
+
+  preInstall = ''
+    mkdir -p $out/bin $out/man/man1
+  '';
+
+  meta = {
+    description = "Hides mouse pointer while not in use";
+    longDescription = ''
+      xbanish hides the mouse cursor when you start typing, and shows it again when
+      the mouse cursor moves or a mouse button is pressed.  This is similar to
+      xterm's pointerMode setting, but xbanish works globally in the X11 session.
+
+      unclutter's -keystroke mode is supposed to do this, but it's broken[0].  I
+      looked into fixing it, but the unclutter source code is terrible, so I wrote
+      xbanish.
+
+      The name comes from ratpoison's "banish" command that sends the cursor to the
+      corner of the screen.
+    '';
+    license = stdenv.lib.licenses.bsd3;
+    maintainers = [stdenv.lib.maintainers.choochootrain];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xbindkeys-config/default.nix b/nixpkgs/pkgs/tools/X11/xbindkeys-config/default.nix
new file mode 100644
index 000000000000..35961aff178d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xbindkeys-config/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, gtk, pkgconfig, procps, makeWrapper, ... }:
+
+stdenv.mkDerivation rec {
+  pname = "xbindkeys-config";
+  version = "0.1.3";
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ gtk makeWrapper ];
+
+  src = fetchurl {
+    url = "mirror://debian/pool/main/x/xbindkeys-config/xbindkeys-config_${version}.orig.tar.gz";
+    sha256 = "1rs3li2hyig6cdzvgqlbz0vw6x7rmgr59qd6m0cvrai8xhqqykda";
+  };
+
+  hardeningDisable = [ "format" ];
+
+  meta = {
+    homepage = "https://packages.debian.org/source/xbindkeys-config";
+    description = "Graphical interface for configuring xbindkeys";
+    license = stdenv.lib.licenses.gpl2Plus;
+    maintainers = with stdenv.lib.maintainers; [benley];
+    platforms = with stdenv.lib.platforms; linux;
+  };
+
+  patches = [ ./xbindkeys-config-patch1.patch ];
+
+  # killall is dangerous on non-gnu platforms. Use pkill instead.
+  postPatch = ''
+    substituteInPlace middle.c --replace "killall" "pkill -x"
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin $out/share/man/man1
+    gzip -c ${./xbindkeys-config.1} > $out/share/man/man1/xbindkeys-config.1.gz
+    cp xbindkeys_config $out/bin/xbindkeys-config
+    wrapProgram $out/bin/xbindkeys-config --prefix PATH ":" "${procps}/bin"
+  '';
+}
diff --git a/nixpkgs/pkgs/tools/X11/xbindkeys-config/xbindkeys-config-patch1.patch b/nixpkgs/pkgs/tools/X11/xbindkeys-config/xbindkeys-config-patch1.patch
new file mode 100644
index 000000000000..d4620b5d9071
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xbindkeys-config/xbindkeys-config-patch1.patch
@@ -0,0 +1,108 @@
+---
+ Makefile           |  6 +++---
+ menu.c             | 11 ++++++++---
+ middle.c           |  9 +++++++--
+ xbindkeys_config.c |  3 ++-
+ 4 files changed, 20 insertions(+), 9 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 602875c..28e46cd 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,9 +1,9 @@
+ # makefile cre par Laurent VUIBERT
+ 
+-CC=	gcc -O3 -Wall
++CC=	gcc $(CFLAGS)
+ STD=	_GNU_SOURCE
+-GTK=	`gtk-config  --cflags --libs`
+-GTK2=	`gtk-config  --cflags`
++GTK=	`pkg-config  --cflags --libs gtk+-2.0`
++GTK2=	`pkg-config  --cflags gtk+-2.0`
+ OBJS=	xbindkeys_config.o menu.o middle.o speedc.o
+ NOM=    xbindkeys_config
+ 
+diff --git a/menu.c b/menu.c
+index ed3e7ec..f11526d 100644
+--- a/menu.c
++++ b/menu.c
+@@ -283,6 +283,8 @@ void menu_manual (GtkMenuItem *menuitem, gpointer user_data)
+   GtkWidget *window;
+   GtkWidget *text;
+   GtkWidget *vbox;
++  GtkTextBuffer *textbuffer;
++  GtkTextIter iter;
+   
+   window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+   gtk_window_set_title(GTK_WINDOW(window),
+@@ -293,10 +295,13 @@ void menu_manual (GtkMenuItem *menuitem, gpointer user_data)
+   text = gtk_label_new("\nManual\n");
+   gtk_box_pack_start(GTK_BOX(vbox), text, FALSE, FALSE, 0);
+   
+-  text = gtk_text_new(NULL,NULL);
++/* BDD - FIXME */
++/*  text = gtk_text_new(NULL,NULL); */
++  text = gtk_text_view_new();
++  textbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
++  gtk_text_buffer_get_iter_at_offset (textbuffer, &iter, 0);
+   
+-  
+-  gtk_text_insert (GTK_TEXT(text), NULL, NULL, NULL,
++  gtk_text_buffer_insert (textbuffer, &iter, 
+ 		   MANUAL_TEXT, sizeof(MANUAL_TEXT)-1);
+   gtk_box_pack_start(GTK_BOX(vbox), text, TRUE, TRUE, 0);
+   gtk_widget_set_usize(text,300,250);
+diff --git a/middle.c b/middle.c
+index daa61aa..605ab10 100644
+--- a/middle.c
++++ b/middle.c
+@@ -551,6 +551,8 @@ void view_generated_file()
+   GtkWidget *window;
+   GtkWidget *text;
+   GtkWidget *src;
++  GtkTextBuffer *textbuffer;
++  GtkTextIter iter;
+   char line  [1024];
+ 
+   unlink(TEMP_FILE); 
+@@ -561,11 +563,13 @@ void view_generated_file()
+     gtk_window_set_title(GTK_WINDOW(window), "Generated File");
+     src = gtk_scrolled_window_new ( NULL, NULL );
+     gtk_widget_set_usize(src,500,400);
+-    text = gtk_text_new (NULL, NULL);
++    text = gtk_text_view_new ();
++    textbuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
++    gtk_text_buffer_get_iter_at_offset (textbuffer, &iter, 0);
+     gtk_container_add (GTK_CONTAINER(src),  text);
+ 
+     while (fgets (line, sizeof(line), f))
+-      gtk_text_insert (GTK_TEXT(text), NULL, NULL, NULL,
++      gtk_text_buffer_insert (textbuffer, &iter,
+ 		       line, strlen(line));
+ 
+     gtk_container_add(GTK_CONTAINER(window),src);
+@@ -610,6 +614,7 @@ void  save_file(char file_out[])
+   fprintf(f, "# m:xxx + c:xxx \n");
+   fprintf(f, "# Shift+... \n\n\n\n\n");
+ 
++
+   if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(Flag_NumLock)))
+     fprintf(f,"keystate_numlock = enable\n");
+   else 
+diff --git a/xbindkeys_config.c b/xbindkeys_config.c
+index 75bad30..3c02a2b 100644
+--- a/xbindkeys_config.c
++++ b/xbindkeys_config.c
+@@ -95,7 +95,8 @@ int main (int argc, char *argv[])
+      accel_group = gtk_accel_group_new();
+      menu=xbindkeys_config_menu(accel_group);
+      gtk_box_pack_start(GTK_BOX(vbox),menu,FALSE,FALSE,0);
+-     gtk_accel_group_attach(accel_group, GTK_OBJECT(window));
++/* BDD - FIXME - Don't need this? */
++/*     gtk_accel_group_attach(accel_group, GTK_OBJECT(window)); */
+      
+      middle= xbindkeys_config_middle();
+      gtk_box_pack_start(GTK_BOX(vbox),middle,TRUE,TRUE,0);
+-- 
+2.1.3
+
diff --git a/nixpkgs/pkgs/tools/X11/xbindkeys-config/xbindkeys-config.1 b/nixpkgs/pkgs/tools/X11/xbindkeys-config/xbindkeys-config.1
new file mode 100644
index 000000000000..e3f8de1a8046
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xbindkeys-config/xbindkeys-config.1
@@ -0,0 +1,21 @@
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.27.
+.TH XBINDKEYS_CONFIG "1" "April 2002" "xbindkeys-config" "User Commands"
+.SH NAME
+xbindkeys-config \- GTK+ configuration tool for xbindkeys
+.SH "SYNOPSIS"
+xbindkeys-config 
+[\-\-file|\-f file]
+[\-\-help|\-h]
+[\-\-show|\-s]
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+This Help
+.TP
+\fB\-f\fR, \fB\-\-file\fR
+Use an alternative rc file
+.TP
+\fB\-s\fR, \fB\-\-show\fR
+show only the rc file
+.SH AUTHOR
+This manual page was written by Joerg Jaspert <joerg@debian.org>,
+for the Debian GNU/Linux system (but may be used by others).
diff --git a/nixpkgs/pkgs/tools/X11/xbindkeys/default.nix b/nixpkgs/pkgs/tools/X11/xbindkeys/default.nix
new file mode 100644
index 000000000000..e844f4443093
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xbindkeys/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, pkgconfig, libX11, guile }:
+
+let version = "1.8.6"; in
+stdenv.mkDerivation {
+  pname = "xbindkeys";
+  inherit version;
+  src = fetchurl {
+    url = "https://www.nongnu.org/xbindkeys/xbindkeys-${version}.tar.gz";
+    sha256 = "060df6d8y727jp1inp7blp44cs8a7jig7vcm8ndsn6gw36z1h3bc";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ libX11 guile ];
+
+  meta = {
+    homepage = "https://www.nongnu.org/xbindkeys/xbindkeys.html";
+    description = "Launch shell commands with your keyboard or your mouse under X Window";
+    license = stdenv.lib.licenses.gpl2Plus;
+    maintainers = with stdenv.lib.maintainers; [viric];
+    platforms = with stdenv.lib.platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xbrightness/default.nix b/nixpkgs/pkgs/tools/X11/xbrightness/default.nix
new file mode 100644
index 000000000000..cbf4d2c94003
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xbrightness/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, imake, gccmakedep
+, libX11, libXaw, libXext, libXmu, libXpm, libXxf86vm  }:
+
+stdenv.mkDerivation {
+
+  name = "xbrightness-0.3-mika-akk";
+  src = fetchurl {
+    url = "https://shallowsky.com/software/xbrightness/xbrightness-0.3-mika-akk.tar.gz";
+    sha256 = "2564dbd393544657cdabe4cbf535d9cfb9abe8edddb1b8cdb1ed4d12f358626e";
+  };
+
+  nativeBuildInputs = [ imake gccmakedep ];
+  buildInputs = [ libX11 libXaw libXext libXmu libXpm libXxf86vm ];
+
+  makeFlags = [ "BINDIR=$(out)/bin" "MANPATH=$(out)/share/man" ];
+  installTargets = [ "install" "install.man" ];
+
+  meta = {
+    description = "X11 brigthness and gamma software control";
+    homepage = "http://shallowsky.com/software";
+    license = stdenv.lib.licenses.mit;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xcalib/default.nix b/nixpkgs/pkgs/tools/X11/xcalib/default.nix
new file mode 100644
index 000000000000..4e400ee8a247
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xcalib/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, libX11, libXxf86vm, libXext, libXrandr }:
+
+stdenv.mkDerivation rec {
+  name = "xcalib-0.10";
+
+  src = fetchFromGitHub {
+    owner = "OpenICC";
+    repo = "xcalib";
+    rev = "f95abc1a551d7c695a8b142c4d9d5035368d482d";
+    sha256 = "05fzdjmhiafgi2jf0k41i3nm0837a78sb6yv59cwc23nla8g0bhr";
+  };
+
+  buildInputs = [ libX11 libXxf86vm libXext libXrandr ];
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp xcalib $out/bin/
+  '';
+
+  meta = with stdenv.lib; {
+    inherit (src.meta) homepage;
+    description = "A tiny monitor calibration loader for X and MS-Windows";
+    license = licenses.gpl2;
+    maintainers = [];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xcape/default.nix b/nixpkgs/pkgs/tools/X11/xcape/default.nix
new file mode 100644
index 000000000000..eefaad82b1a7
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xcape/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchFromGitHub, pkgconfig, libX11, libXtst, xorgproto,
+libXi }:
+
+stdenv.mkDerivation rec {
+  pname = "xcape";
+  version = "unstable-2018-03-01";
+
+  src = fetchFromGitHub {
+    owner = "alols";
+    repo = pname;
+    rev = "a34d6bae27bbd55506852f5ed3c27045a3c0bd9e";
+    sha256 = "04grs4w9kpfzz25mqw82zdiy51g0w355gpn5b170p7ha5972ykc8";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+
+  buildInputs = [ libX11 libXtst xorgproto libXi ];
+
+  makeFlags = [
+    "PREFIX=$(out)"
+    "MANDIR=/share/man/man1"
+  ];
+
+  postInstall = "install -Dm444 --target-directory $out/share/doc README.md";
+
+  meta = with stdenv.lib; {
+    description = "Utility to configure modifier keys to act as other keys";
+    longDescription = ''
+      xcape allows you to use a modifier key as another key when
+      pressed and released on its own.  Note that it is slightly
+      slower than pressing the original key, because the pressed event
+      does not occur until the key is released.  The default behaviour
+      is to generate the Escape key when Left Control is pressed and
+      released on its own.
+    '';
+    homepage = "https://github.com/alols/xcape";
+    license = licenses.gpl3 ;
+    maintainers = with maintainers; [ raskin ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xchainkeys/default.nix b/nixpkgs/pkgs/tools/X11/xchainkeys/default.nix
new file mode 100644
index 000000000000..238b8c7b2b2d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xchainkeys/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl, libX11 }:
+
+stdenv.mkDerivation rec {
+  name = "xchainkeys-0.11";
+
+  src = fetchurl {
+    url = "http://henning-bekel.de/download/xchainkeys/${name}.tar.gz";
+    sha256 = "1rpqs7h5krral08vqxwb0imy33z17v5llvrg5hy8hkl2ap7ya0mn";
+  };
+
+  buildInputs = [ libX11 ];
+
+  meta = {
+    homepage = "http://henning-bekel.de/xchainkeys/";
+    description = "A standalone X11 program to create chained key bindings";
+    license = stdenv.lib.licenses.gpl3;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xcwd/default.nix b/nixpkgs/pkgs/tools/X11/xcwd/default.nix
new file mode 100644
index 000000000000..c0e8cf5d35b3
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xcwd/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, libX11 }:
+
+stdenv.mkDerivation {
+  version = "2019-05-09";
+  pname = "xcwd";
+
+  src = fetchFromGitHub {
+    owner   = "schischi";
+    repo    = "xcwd";
+    rev     = "99738e1176acf3f39c2e709236c3fd87b806f2ed";
+    sha256  = "1wvhj5x8ysi1q73f9cw1f6znvp2zivd8pp6z1p3znw732h4zlv6v";
+  };
+
+  buildInputs = [ libX11 ];
+
+  makeFlags = [ "prefix=$(out)" ];
+
+  installPhase = ''
+    install -D xcwd "$out/bin/xcwd"
+  '';
+
+  meta = with stdenv.lib; {
+    description = ''
+      A simple tool which print the current working directory of the currently focused window
+    '';
+    homepage = "https://github.com/schischi/xcwd";
+    maintainers = [ maintainers.grburst ];
+    license = licenses.bsd3;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xdg-user-dirs/default.nix b/nixpkgs/pkgs/tools/X11/xdg-user-dirs/default.nix
new file mode 100644
index 000000000000..9ad3db80805f
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xdg-user-dirs/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchurl, libxslt, docbook_xsl, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  name = "xdg-user-dirs-0.17";
+
+  src = fetchurl {
+    url = "https://user-dirs.freedesktop.org/releases/${name}.tar.gz";
+    sha256 = "13216b8rfkzak5k6bvpx6jvqv3cnbgpijnjwj8a8d3kq4cl0a1ra";
+  };
+
+  buildInputs = [ libxslt docbook_xsl makeWrapper ];
+
+  preFixup = ''
+    # fallback values need to be last
+    wrapProgram "$out/bin/xdg-user-dirs-update" \
+      --suffix XDG_CONFIG_DIRS : "$out/etc/xdg"
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "http://freedesktop.org/wiki/Software/xdg-user-dirs";
+    description = "A tool to help manage well known user directories like the desktop folder and the music folder";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ lethalman ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xdg-utils/default.nix b/nixpkgs/pkgs/tools/X11/xdg-utils/default.nix
new file mode 100644
index 000000000000..64b205bada58
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xdg-utils/default.nix
@@ -0,0 +1,70 @@
+{ stdenv, fetchurl, fetchFromGitHub
+, file, libxslt, docbook_xml_dtd_412, docbook_xsl, xmlto
+, w3m, gnugrep, gnused, coreutils, xset, perlPackages
+, mimiSupport ? false, gawk ? null }:
+
+assert mimiSupport -> gawk != null;
+
+let
+  # A much better xdg-open
+  mimisrc = fetchFromGitHub {
+    owner = "march-linux";
+    repo = "mimi";
+    rev = "8e0070f17bcd3612ee83cb84e663e7c7fabcca3d";
+    sha256 = "15gw2nyrqmdsdin8gzxihpn77grhk9l97jp7s7pr7sl4n9ya2rpj";
+  };
+
+  perlPath = with perlPackages; makePerlPath [
+    NetDBus XMLTwig XMLParser X11Protocol
+  ];
+
+in
+
+stdenv.mkDerivation rec {
+  pname = "xdg-utils";
+  version = "1.1.3";
+
+  src = fetchurl {
+    url = "https://portland.freedesktop.org/download/${pname}-${version}.tar.gz";
+    sha256 = "1nai806smz3zcb2l5iny4x7li0fak0rzmjg6vlyhdqm8z25b166p";
+  };
+
+  # just needed when built from git
+  buildInputs = [ libxslt docbook_xml_dtd_412 docbook_xsl xmlto w3m ];
+
+  postInstall = stdenv.lib.optionalString mimiSupport ''
+    cp ${mimisrc}/xdg-open $out/bin/xdg-open
+  '' + ''
+    sed  '2s#.#\
+    cut()   { ${coreutils}/bin/cut  "$@"; }\
+    sed()   { ${gnused}/bin/sed     "$@"; }\
+    grep()  { ${gnugrep}/bin/grep   "$@"; }\
+    egrep() { ${gnugrep}/bin/egrep  "$@"; }\
+    file()  { ${file}/bin/file      "$@"; }\
+    awk()   { ${gawk}/bin/awk       "$@"; }\
+    sort()  { ${coreutils}/bin/sort "$@"; }\
+    xset()  { ${xset}/bin/xset      "$@"; }\
+    perl()  { PERL5LIB=${perlPath} ${perlPackages.perl}/bin/perl "$@"; }\
+    mimetype() { ${perlPackages.FileMimeInfo}/bin/mimetype "$@"; }\
+    &#' -i "$out"/bin/*
+
+    substituteInPlace $out/bin/xdg-open \
+      --replace "/usr/bin/printf" "${coreutils}/bin/printf"
+
+    substituteInPlace $out/bin/xdg-mime \
+      --replace "/usr/bin/file" "${file}/bin/file"
+
+    substituteInPlace $out/bin/xdg-email \
+      --replace "/bin/echo" "${coreutils}/bin/echo"
+
+    sed 's# which # type -P #g' -i "$out"/bin/*
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "https://www.freedesktop.org/wiki/Software/xdg-utils/";
+    description = "A set of command line tools that assist applications with a variety of desktop integration tasks";
+    license = if mimiSupport then licenses.gpl2 else licenses.free;
+    maintainers = [ maintainers.eelco ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xdotool/default.nix b/nixpkgs/pkgs/tools/X11/xdotool/default.nix
new file mode 100644
index 000000000000..6785d10258f3
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xdotool/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, pkgconfig, libX11, perl, libXtst, xorgproto, libXi, libXinerama, libxkbcommon }:
+
+stdenv.mkDerivation rec {
+  pname = "xdotool";
+  version = "3.20160805.1";
+
+  src = fetchurl {
+    url = "https://github.com/jordansissel/xdotool/releases/download/v${version}/xdotool-${version}.tar.gz";
+    sha256 = "1a6c1zr86zb53352yxv104l76l8x21gfl2bgw6h21iphxpv5zgim";
+  };
+
+  nativeBuildInputs = [ pkgconfig perl ];
+  buildInputs = [ libX11 libXtst xorgproto libXi libXinerama libxkbcommon ];
+
+  preBuild = ''
+    mkdir -p $out/lib
+  '';
+
+  makeFlags = [ "PREFIX=$(out)" ];
+
+  meta = {
+    homepage = "https://www.semicomplete.com/projects/xdotool/";
+    description = "Fake keyboard/mouse input, window management, and more";
+    license = stdenv.lib.licenses.bsd3;
+    maintainers = with stdenv.lib.maintainers; [viric];
+    platforms = with stdenv.lib.platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xgeometry-select/default.nix b/nixpkgs/pkgs/tools/X11/xgeometry-select/default.nix
new file mode 100644
index 000000000000..ed3b460dcb61
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xgeometry-select/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchurl, libX11 }:
+
+stdenv.mkDerivation rec {
+  name     = "${baseName}-${version}";
+  baseName = "xgeometry-select";
+  version  = "0.1";
+
+  src = fetchurl {
+    url    = "https://gist.githubusercontent.com/obadz/7e008b1f803c4cdcfaf7321c78bcbe92/raw/7e7361e71ff0f74655ee92bd6d2c042f8586f2ae/xgeometry-select.c";
+    sha256 = "0s7kirgh5iz91m3qy8xiq0j4gljy8zrcnylf4szl5h0lrsaqj7ya";
+  };
+
+  phases = [ "buildPhase" "installPhase" ];
+
+  buildInputs = [ libX11 ];
+
+  buildPhase = ''
+    gcc -Wall -lX11 ${src} -o ${baseName}
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    mv -v ${baseName} $out/bin
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Select a region with mouse and prints geometry information (x/y/w/h)";
+    homepage    = "https://bbs.archlinux.org/viewtopic.php?pid=660837";
+    maintainers = with maintainers; [ obadz ];
+    platforms   = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xidlehook/default.nix b/nixpkgs/pkgs/tools/X11/xidlehook/default.nix
new file mode 100644
index 000000000000..e15bee331a8b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xidlehook/default.nix
@@ -0,0 +1,37 @@
+{ lib, stdenv, rustPlatform, fetchFromGitLab, python3
+, xlibsWrapper, xorg, libpulseaudio, pkgconfig, patchelf, Security }:
+
+rustPlatform.buildRustPackage rec {
+  pname = "xidlehook";
+  version = "0.8.2";
+
+  doCheck = false;
+
+  src = fetchFromGitLab {
+    owner = "jD91mZM2";
+    repo = "xidlehook";
+    rev = version;
+
+    sha256 = "1zvr3vk76x0gsq6z5rrnliv2bvshsm8bhkspc41bbj4kniz4h5bw";
+  };
+
+  cargoBuildFlags = lib.optionals (!stdenv.isLinux) ["--no-default-features" "--features" "pulse"];
+  cargoSha256 = "0dxz5mbdc93xb02vnmd29i2kdh05c7vx9h28x5qgs3jvddyb3xmn";
+
+  buildInputs = [ xlibsWrapper xorg.libXScrnSaver libpulseaudio ] ++ lib.optional stdenv.isDarwin Security;
+  nativeBuildInputs = [ pkgconfig patchelf python3 ];
+
+  postFixup = lib.optionalString stdenv.isLinux ''
+    RPATH="$(patchelf --print-rpath $out/bin/xidlehook)"
+    patchelf --set-rpath "$RPATH:${libpulseaudio}/lib" $out/bin/xidlehook
+  '';
+
+  meta = with lib; {
+    description = "xautolock rewrite in Rust, with a few extra features";
+    homepage = "https://github.com/jD91mZM2/xidlehook";
+    license = licenses.mit;
+    maintainers = with maintainers; [ jD91mZM2 ];
+    platforms = platforms.unix;
+    badPlatforms = platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xinput_calibrator/default.nix b/nixpkgs/pkgs/tools/X11/xinput_calibrator/default.nix
new file mode 100644
index 000000000000..9e11c948f40b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xinput_calibrator/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, libXi, xorgproto, autoconf, automake, libtool, m4, xlibsWrapper, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  pname = "xinput_calibrator";
+  version = "0.7.5";
+  src = fetchurl {
+    url = "https://github.com/tias/${pname}/archive/v${version}.tar.gz";
+    sha256 = "d8edbf84523d60f52311d086a1e3ad0f3536f448360063dd8029bf6290aa65e9";
+  };
+
+  preConfigure = "./autogen.sh --with-gui=X11";
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ xorgproto libXi autoconf automake libtool m4 xlibsWrapper ];
+
+  meta = {
+    homepage = "https://github.com/tias/xinput_calibrator";
+    description = "A generic touchscreen calibration program for X.Org";
+    license = stdenv.lib.licenses.mit;
+    maintainers = [ stdenv.lib.maintainers.flosse ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xkb-switch/default.nix b/nixpkgs/pkgs/tools/X11/xkb-switch/default.nix
new file mode 100644
index 000000000000..3b69ec880549
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xkb-switch/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitHub, cmake, libX11, libxkbfile }:
+
+stdenv.mkDerivation rec {
+  pname = "xkb-switch";
+  version = "1.6.0";
+
+  src = fetchFromGitHub {
+    owner = "ierton";
+    repo = "xkb-switch";
+    rev = version;
+    sha256 = "11yn0y1kx04rqxh0d81b5q7kbyz58pi48bl7hyhlv7p8yndkfg4b";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ libX11 libxkbfile ];
+
+  meta = with stdenv.lib; {
+    description = "Switch your X keyboard layouts from the command line";
+    homepage = "https://github.com/ierton/xkb-switch";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ smironov ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xkbset/default.nix b/nixpkgs/pkgs/tools/X11/xkbset/default.nix
new file mode 100644
index 000000000000..e6f6622f85ac
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xkbset/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, perl, libX11 }:
+
+stdenv.mkDerivation rec {
+  name = "xkbset-0.5";
+
+  src = fetchurl {
+    url = "http://faculty.missouri.edu/~stephen/software/xkbset/${name}.tar.gz";
+    sha256 = "01c2579495b39e00d870f50225c441888dc88021e9ee3b693a842dd72554d172";
+  };
+
+  buildInputs = [ perl libX11 ];
+
+  postPatch = ''
+    sed "s:^X11PREFIX=.*:X11PREFIX=$out:" -i Makefile
+  '';
+
+  preInstall = ''
+    mkdir -p $out/bin
+    mkdir -p $out/man/man1
+  '';
+
+  postInstall = ''
+    rm -f $out/bin/xkbset-gui
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "http://faculty.missouri.edu/~stephen/software/#xkbset";
+    description = "Program to help manage many of XKB features of X window";
+    maintainers = with maintainers; [ drets ];
+    platforms = platforms.linux;
+    license = licenses.bsd3;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xkbvalidate/default.nix b/nixpkgs/pkgs/tools/X11/xkbvalidate/default.nix
new file mode 100644
index 000000000000..92a47aa65638
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xkbvalidate/default.nix
@@ -0,0 +1,15 @@
+{ lib, runCommandCC, libxkbcommon }:
+
+runCommandCC "xkbvalidate" {
+  buildInputs = [ libxkbcommon ];
+  meta = {
+    description = "NixOS tool to validate X keyboard configuration";
+    license = lib.licenses.mit;
+    platforms = lib.platforms.unix;
+    maintainers = [ lib.maintainers.aszlig ];
+  };
+} ''
+  mkdir -p "$out/bin"
+  $CC -std=c11 -Wall -pedantic -lxkbcommon ${./xkbvalidate.c} \
+    -o "$out/bin/xkbvalidate"
+''
diff --git a/nixpkgs/pkgs/tools/X11/xkbvalidate/xkbvalidate.c b/nixpkgs/pkgs/tools/X11/xkbvalidate/xkbvalidate.c
new file mode 100644
index 000000000000..d25eef154b3c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xkbvalidate/xkbvalidate.c
@@ -0,0 +1,150 @@
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <xkbcommon/xkbcommon.h>
+
+static char **log_buffer = NULL;
+static int log_buffer_size = 0;
+static bool log_alloc_success = true;
+
+static void add_log(struct xkb_context *ctx, enum xkb_log_level level,
+                    const char *fmt, va_list args)
+{
+    size_t buflen;
+    va_list tmpargs;
+
+    log_buffer_size++;
+
+    if (log_buffer == NULL)
+        log_buffer = malloc(sizeof(char *));
+    else
+        log_buffer = realloc(log_buffer, sizeof(char *) * log_buffer_size);
+
+    if (log_buffer == NULL) {
+        perror("buffer alloc");
+        log_alloc_success = false;
+        log_buffer_size--;
+        return;
+    }
+
+    /* Unfortunately, vasprintf() is a GNU extension and thus not very
+     * portable, so let's first get the required buffer size using a dummy
+     * vsnprintf and afterwards allocate the returned amount of bytes.
+     *
+     * We also need to make a copy of the args, because the value of the args
+     * will be indeterminate after the return.
+     */
+    va_copy(tmpargs, args);
+    buflen = vsnprintf(NULL, 0, fmt, tmpargs);
+    va_end(tmpargs);
+
+    log_buffer[log_buffer_size - 1] = malloc(++buflen);
+
+    if (vsnprintf(log_buffer[log_buffer_size - 1], buflen, fmt, args) == -1) {
+        perror("log line alloc");
+        log_alloc_success = false;
+    }
+    va_end(args);
+}
+
+static void print_logs(void)
+{
+    for (int i = 0; i < log_buffer_size; ++i)
+        fprintf(stderr, "    %s", log_buffer[i]);
+}
+
+static void free_logs(void)
+{
+    if (log_buffer == NULL)
+        return;
+    for (int i = 0; i < log_buffer_size; ++i)
+        free(log_buffer[i]);
+    free(log_buffer);
+    log_buffer = NULL;
+    log_buffer_size = 0;
+}
+
+static bool try_keymap(struct xkb_context *ctx, struct xkb_rule_names *rdef)
+{
+    struct xkb_keymap *keymap;
+    bool result = true;
+
+    if ((keymap = xkb_keymap_new_from_names(ctx, rdef, 0)) == NULL)
+        result = false;
+    else
+        xkb_keymap_unref(keymap);
+
+    return result;
+}
+
+static void print_error(const char *name, const char *value,
+                        const char *nixos_option)
+{
+    fprintf(stderr, "\nThe value `%s' for keyboard %s is invalid.\n\n"
+                    "Please check the definition in `services.xserver.%s'.\n",
+            value, name, nixos_option);
+    fputs("\nDetailed XKB compiler errors:\n\n", stderr);
+    print_logs();
+    putc('\n', stderr);
+}
+
+#define TRY_KEYMAP(name, value, nixos_option) \
+    *rdef = (struct xkb_rule_names) {0}; \
+    free_logs(); \
+    rdef->name = value; \
+    result = try_keymap(ctx, rdef); \
+    if (!log_alloc_success) \
+        goto out; \
+    if (!result) { \
+        print_error(#name, value, nixos_option); \
+        exit_code = EXIT_FAILURE; \
+        goto out; \
+    }
+
+int main(int argc, char **argv)
+{
+    int exit_code = EXIT_SUCCESS;
+    bool result;
+    struct xkb_context *ctx;
+    struct xkb_rule_names *rdef;
+
+    if (argc != 5) {
+        fprintf(stderr, "Usage: %s model layout variant options\n", argv[0]);
+        return EXIT_FAILURE;
+    }
+
+    ctx = xkb_context_new(XKB_CONTEXT_NO_ENVIRONMENT_NAMES);
+    xkb_context_set_log_fn(ctx, add_log);
+
+    rdef = malloc(sizeof(struct xkb_rule_names));
+
+    TRY_KEYMAP(model,   argv[1], "xkbModel");
+    TRY_KEYMAP(layout,  argv[2], "layout");
+    TRY_KEYMAP(variant, argv[3], "xkbVariant");
+    TRY_KEYMAP(options, argv[4], "xkbOptions");
+
+    free_logs();
+    rdef->model = argv[1];
+    rdef->layout = argv[2];
+    rdef->variant = argv[3];
+    rdef->options = argv[4];
+
+    result = try_keymap(ctx, rdef);
+    if (!log_alloc_success)
+        goto out;
+
+    if (!result) {
+        fputs("The XKB keyboard definition failed to compile:\n", stderr);
+        print_logs();
+        exit_code = EXIT_FAILURE;
+    }
+
+out:
+    free_logs();
+    free(rdef);
+    xkb_context_unref(ctx);
+    return exit_code;
+}
diff --git a/nixpkgs/pkgs/tools/X11/xlayoutdisplay/default.nix b/nixpkgs/pkgs/tools/X11/xlayoutdisplay/default.nix
new file mode 100644
index 000000000000..47a2c8f3f3ec
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xlayoutdisplay/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitHub, xorg, boost, cmake, gtest }:
+
+stdenv.mkDerivation rec {
+  pname = "xlayoutdisplay";
+  version = "1.1.1";
+
+  src = fetchFromGitHub {
+    owner = "alex-courtis";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0ldqbwsryy7mqhxywdn2c2yi1mzlnl39sw8p3vx10w6q9drya9iv";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = with xorg; [ libX11 libXrandr libXcursor boost ];
+  checkInputs = [ gtest ];
+
+  doCheck = true;
+
+  # format security fixup
+  postPatch = ''
+    substituteInPlace test/test-Monitors.cpp \
+      --replace 'fprintf(lidStateFile, contents);' \
+                'fputs(contents, lidStateFile);'
+
+    substituteInPlace CMakeLists.txt --replace "set(Boost_USE_STATIC_LIBS ON)" ""
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Detects and arranges linux display outputs, using XRandR for detection and xrandr for arrangement";
+    homepage = "https://github.com/alex-courtis/xlayoutdisplay";
+    maintainers = with maintainers; [ dtzWill ];
+    license = licenses.asl20;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xloadimage/default.nix b/nixpkgs/pkgs/tools/X11/xloadimage/default.nix
new file mode 100644
index 000000000000..3bd9f5256835
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xloadimage/default.nix
@@ -0,0 +1,88 @@
+{ stdenv
+, fetchurl
+, libX11
+, libXt
+
+, libjpeg ? null
+, libpng ? null
+, libtiff ? null
+
+, withJpegSupport ? true
+, withPngSupport ? true
+, withTiffSupport ? true
+}:
+
+assert withJpegSupport -> libjpeg != null;
+assert withPngSupport -> libpng != null;
+assert withTiffSupport -> libtiff != null;
+
+let
+  deb_patch = "25";
+in
+stdenv.mkDerivation rec {
+  version = "4.1";
+  pname = "xloadimage";
+
+  src = fetchurl {
+    url = "mirror://debian/pool/main/x/xloadimage/xloadimage_${version}.orig.tar.gz";
+    sha256 = "1i7miyvk5ydhi6yi8593vapavhwxcwciir8wg9d2dcyg9pccf2s0";
+  };
+
+  patches = fetchurl {
+    url = "mirror://debian/pool/main/x/xloadimage/xloadimage_${version}-${deb_patch}.debian.tar.xz";
+    sha256 = "17k518vrdrya5c9dqhpmm4g0h2vlkq1iy87sg2ngzygypbli1xvn";
+  };
+
+  buildInputs = [
+    libX11 libXt
+  ] ++ stdenv.lib.optionals withJpegSupport [
+    libjpeg
+  ] ++ stdenv.lib.optionals withPngSupport [
+    libpng
+  ] ++ stdenv.lib.optionals withTiffSupport [
+    libtiff
+  ];
+
+  # NOTE: we patch the build-info script so that it never detects the utilities
+  # it's trying to find; one of the Debian patches adds support for
+  # $SOURCE_DATE_EPOCH, but we want to make sure we don't even call these.
+  preConfigure = ''
+    substituteInPlace build-info \
+      --replace '[ -x /bin/date ]' 'false' \
+      --replace '[ -x /bin/id ]' 'false' \
+      --replace '[ -x /bin/uname ]' 'false' \
+      --replace '[ -x /usr/bin/id ]' 'false'
+
+    chmod +x build-info configure
+  '';
+
+  enableParallelBuilding = true;
+
+  # NOTE: we're not installing the `uufilter` binary; if needed, the standard
+  # `uudecode` tool should work just fine.
+  installPhase = ''
+    install -Dm755 xloadimage $out/bin/xloadimage
+    ln -sv $out/bin/{xloadimage,xsetbg}
+
+    install -D -m644 xloadimagerc $out/etc/xloadimagerc.example
+    install -D -m644 xloadimage.man $out/share/man/man1/xloadimage.1x
+    ln -sv $out/share/man/man1/{xloadimage,xsetbg}.1x
+  '';
+
+  meta = {
+    description = "Graphics file viewer under X11";
+
+    longDescription = ''
+      Can view png, jpeg, gif, tiff, niff, sunraster, fbm, cmuraster, pbm,
+      faces, rle, xwd, vff, mcidas, vicar, pcx, gem, macpaint, xpm and xbm
+      files. Can view images, put them on the root window, or dump them. Does a
+      variety of processing, including: clipping, dithering, depth reduction,
+      zoom, brightening/darkening and merging.
+    '';
+
+    license = stdenv.lib.licenses.gpl2Plus;
+
+    maintainers = with stdenv.lib.maintainers; [ andrew-d ];
+    platforms = stdenv.lib.platforms.linux;  # arbitrary choice
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xmacro/default.nix b/nixpkgs/pkgs/tools/X11/xmacro/default.nix
new file mode 100644
index 000000000000..13a18efccba6
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xmacro/default.nix
@@ -0,0 +1,20 @@
+{ stdenv, fetchurl, libX11, libXtst, xorgproto, libXi }:
+
+stdenv.mkDerivation rec {
+  pname = "xmacro";
+  version = "0.4.6";
+
+  src = fetchurl {
+    url = "http://download.sarine.nl/xmacro/${pname}-${version}.tar.gz";
+    sha256 = "1p9jljxyn4j6piljiyi2xv6f8jhjbzhabprp8p0qmqxaxgdipi61";
+  };
+
+  preInstall = "echo -e 'install:\n	mkdir \${out}/bin;\n	cp xmacrorec2 xmacroplay \${out}/bin;' >>Makefile; ";
+
+  buildInputs = [ libX11 libXtst xorgproto libXi ];
+
+  meta = {
+    platforms = stdenv.lib.platforms.linux;
+    license = stdenv.lib.licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xmagnify/default.nix b/nixpkgs/pkgs/tools/X11/xmagnify/default.nix
new file mode 100644
index 000000000000..710c9b83dbd0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xmagnify/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchFromGitLab, libX11, xorgproto }:
+
+stdenv.mkDerivation {
+  name = "xmagnify-0.1.0";
+
+  src = fetchFromGitLab {
+    owner = "amiloradovsky";
+    repo = "magnify";
+    rev = "0.1.0";  # 56da280173e9d0bd7b3769e07ba485cb4db35869
+    sha256 = "1ngnp5f5zl3v35vhbdyjpymy6mwrs0476fm5nd7dzkba7n841jdh";
+  };
+
+  prePatch = ''substituteInPlace ./Makefile --replace /usr $out'';
+
+  buildInputs = [ libX11 xorgproto ];
+
+  meta = with stdenv.lib; {
+    description = "Tiny screen magnifier for X11";
+    homepage = "https://gitlab.com/amiloradovsky/magnify";
+    license = licenses.mit;  # or GPL2+, optionally
+    maintainers = with maintainers; [ amiloradovsky ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xmousepasteblock/default.nix b/nixpkgs/pkgs/tools/X11/xmousepasteblock/default.nix
new file mode 100644
index 000000000000..094b26d1f55c
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xmousepasteblock/default.nix
@@ -0,0 +1,21 @@
+{ xorg, stdenv, libev, fetchFromGitHub, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  pname = "xmousepasteblock";
+  version = "1.0";
+  src = fetchFromGitHub {
+    owner = "milaq";
+    repo = "XMousePasteBlock";
+    sha256 = "0vidckfp277cg2gsww8a8q5b18m10iy4ppyp2qipr89771nrcmns";
+    rev = version;
+  };
+  makeFlags = "PREFIX=$(out)";
+  buildInputs = with xorg; [ libX11 libXext libXi libev ];
+  nativeBuildInputs = [ pkgconfig ];
+  meta = with stdenv.lib; {
+    description = "Middle mouse button primary X selection/clipboard paste disabler";
+    homepage = "https://github.com/milaq/XMousePasteBlock";
+    license = stdenv.lib.licenses.gpl2;
+    maintainers = [ maintainers.petercommand ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xnee/default.nix b/nixpkgs/pkgs/tools/X11/xnee/default.nix
new file mode 100644
index 000000000000..ae057c769845
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xnee/default.nix
@@ -0,0 +1,55 @@
+{ fetchurl, stdenv, libX11, xorgproto, libXext, libXtst
+, gtk2, libXi, pkgconfig, texinfo }:
+
+stdenv.mkDerivation rec {
+  version = "3.19";
+  pname = "xnee";
+
+  src = fetchurl {
+    url = "mirror://gnu/xnee/${pname}-${version}.tar.gz";
+    sha256 = "04n2lac0vgpv8zsn7nmb50hf3qb56pmj90dmwnivg09gyrf1x92j";
+  };
+
+  patchPhase =
+    '' for i in `find cnee/test -name \*.sh`
+       do
+         sed -i "$i" -e's|/bin/bash|${stdenv.shell}|g ; s|/usr/bin/env bash|${stdenv.shell}|g'
+       done
+    '';
+
+  buildInputs =
+    [ libX11 xorgproto libXext libXtst gtk2
+      libXi pkgconfig
+      texinfo
+    ];
+
+  configureFlags =
+    # Do a static build because `libxnee' doesn't get installed anyway.
+    [ "--disable-gnome-applet" "--enable-static" ];
+
+  # `cnee' is linked without `-lXi' and as a consequence has a RUNPATH that
+  # lacks libXi.
+  makeFlags = [ "LDFLAGS=-lXi" ];
+
+  # XXX: Actually tests require an X server.
+  doCheck = true;
+
+  meta = {
+    description = "X11 event recording and replay tool";
+
+    longDescription =
+      '' Xnee is a suite of programs that can record, replay and distribute
+         user actions under the X11 environment.  Think of it as a robot that
+         can imitate the job you just did.  Xnee can be used to automate
+         tests, demonstrate programs, distribute actions, record & replay
+         "macros", retype a file.
+      '';
+
+    license = stdenv.lib.licenses.gpl3Plus;
+
+    homepage = "https://www.gnu.org/software/xnee/";
+
+    maintainers = with stdenv.lib.maintainers; [ ];
+    platforms = stdenv.lib.platforms.gnu ++ stdenv.lib.platforms.linux;  # arbitrary choice
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xob/default.nix b/nixpkgs/pkgs/tools/X11/xob/default.nix
new file mode 100644
index 000000000000..cf74fa3d867b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xob/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchFromGitHub, pkg-config, xorg, libconfig }:
+
+stdenv.mkDerivation rec {
+  pname = "xob";
+  version = "0.2";
+
+  src = fetchFromGitHub {
+    owner = "florentc";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "0jbj61adwrpscfaadjman4hbyxhxv3ac8b4d88d623samx6kbvkk";
+  };
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ xorg.libX11 libconfig ];
+
+  makeFlags = [ "prefix=$(out)" ];
+
+  meta = with stdenv.lib; {
+    description = "A lightweight overlay bar for the X Window System";
+    longDescription = ''
+      A lightweight configurable overlay volume/backlight/progress/anything bar
+      for the X Window System. Each time a new value is read on the standard
+      input, it is displayed as a tv-like bar over other windows. It then
+      vanishes after a configurable amount of time. A value followed by a bang
+      '!' is displayed using an alternate color to account for special states
+      (e.g. muted audio). There is also support for overflows (when the value
+      exceeds the maximum).
+    '';
+    inherit (src.meta) homepage;
+    license = licenses.gpl3Plus;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ primeos ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xosview2/default.nix b/nixpkgs/pkgs/tools/X11/xosview2/default.nix
new file mode 100644
index 000000000000..5dfe74fd3734
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xosview2/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchurl, libX11 }:
+
+stdenv.mkDerivation rec {
+  pname = "xosview2";
+  version = "2.3.1";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/xosview/${pname}-${version}.tar.gz";
+    sha256 = "1drp0n6qjbxyc0104a3aw2g94rh5p218wmrqwxh3kwwm7pmr9xip";
+  };
+
+  # The software failed to buid with this enabled; it seemed tests were not implemented
+  doCheck = false;
+
+  buildInputs = [ libX11 ];
+
+  meta = with stdenv.lib; {
+    description = "Lightweight program that gathers information from your operating system and displays it in graphical form";
+    longDescription = ''
+      xosview is a lightweight program that gathers information from your
+      operating system and displays it in graphical form. It attempts to show
+      you in a quick glance an overview of how your system resources are being
+      utilized.
+
+      It can be configured to be nothing more than a small strip showing a
+      couple of parameters on a desktop task bar. Or it can display dozens of
+      meters and rolling graphical charts over your entire screen.
+
+      Since xosview renders all graphics with core X11 drawing methods, you can
+      run it on one machine and display it on another. This works even if your
+      other host is an operating system not running an X server inside a
+      virtual machine running on a physically different host. If you can
+      connect to it on a network, then you can popup an xosview instance and
+      monitor what is going on.
+    '';
+    homepage = "http://xosview.sourceforge.net/index.html";
+    license = with licenses; [ gpl2 bsdOriginal ];
+    maintainers = [ maintainers.SeanZicari ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xpointerbarrier/default.nix b/nixpkgs/pkgs/tools/X11/xpointerbarrier/default.nix
new file mode 100644
index 000000000000..6f6d38932df3
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xpointerbarrier/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, xorg, fetchgit }:
+stdenv.mkDerivation rec {
+  pname = "xpointerbarrier";
+  version = "18.06";
+  src = fetchgit {
+    url = "https://www.uninformativ.de/git/xpointerbarrier.git";
+    rev = "v${version}";
+    sha256 = "1k7i641x18qhjm0llsaqn2h2g9k31kgv6p8sildllmbvgxyrgvq7";
+  };
+
+  buildInputs = [ xorg.libX11 xorg.libXfixes xorg.libXrandr ];
+
+  makeFlags = [ "prefix=$(out)" ];
+
+  meta = {
+    homepage = "https://uninformativ.de/git/xpointerbarrier";
+    description = "Create X11 pointer barriers around your working area";
+    license = stdenv.lib.licenses.mit;
+    maintainers = [ stdenv.lib.maintainers.xzfc ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xpra/0002-Constant-DPI.patch b/nixpkgs/pkgs/tools/X11/xpra/0002-Constant-DPI.patch
new file mode 100644
index 000000000000..f91e53d1e493
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xpra/0002-Constant-DPI.patch
@@ -0,0 +1,96 @@
+--- a/src/dummy.h	2016-12-17 23:02:53.396287041 +0100
++++ b/src/dummy.h	2016-12-17 23:03:30.319616550 +0100
+@@ -51,6 +51,7 @@
+     /* options */
+     OptionInfoPtr Options;
+     Bool swCursor;
++    Bool constantDPI;
+     /* proc pointer */
+     CloseScreenProcPtr CloseScreen;
+     xf86CursorInfoPtr CursorInfo;
+--- a/src/dummy_driver.c	2016-12-14 21:54:20.000000000 +0100
++++ b/src/dummy_driver.c	2016-12-17 23:04:59.916416126 +0100
+@@ -17,6 +17,12 @@
+ /* All drivers using the mi colormap manipulation need this */
+ #include "micmap.h"
+ 
++#ifdef RANDR
++#include "randrstr.h"
++#endif
++
++#include "windowstr.h"
++
+ /* identifying atom needed by magnifiers */
+ #include <X11/Xatom.h>
+ #include "property.h"
+@@ -115,11 +121,15 @@
+ };
+ 
+ typedef enum {
+-    OPTION_SW_CURSOR
++    OPTION_SW_CURSOR,
++    OPTION_CONSTANT_DPI
+ } DUMMYOpts;
+ 
+ static const OptionInfoRec DUMMYOptions[] = {
+     { OPTION_SW_CURSOR,	"SWcursor",	OPTV_BOOLEAN,	{0}, FALSE },
++#ifdef RANDR
++    { OPTION_CONSTANT_DPI,	"ConstantDPI",	OPTV_BOOLEAN,	{0}, FALSE },
++#endif
+     { -1,                  NULL,           OPTV_NONE,	{0}, FALSE }
+ };
+ 
+@@ -359,6 +369,7 @@
+     xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, dPtr->Options);
+ 
+     xf86GetOptValBool(dPtr->Options, OPTION_SW_CURSOR,&dPtr->swCursor);
++    xf86GetOptValBool(dPtr->Options, OPTION_CONSTANT_DPI, &dPtr->constantDPI);
+ 
+     if (device->videoRam != 0) {
+ 	pScrn->videoRam = device->videoRam;
+@@ -639,10 +650,45 @@
+     return TRUE;
+ }
+ 
++const char *XDPY_PROPERTY = "dummy-constant-xdpi";
++const char *YDPY_PROPERTY = "dummy-constant-ydpi";
++static int get_dpi_value(WindowPtr root, const char *property_name, int default_dpi)
++{
++    PropertyPtr prop;
++    Atom type_atom = MakeAtom("CARDINAL", 8, TRUE);
++    Atom prop_atom = MakeAtom(property_name, strlen(property_name), FALSE);
++
++    for (prop = wUserProps(root); prop; prop = prop->next) {
++       if (prop->propertyName == prop_atom && prop->type == type_atom && prop->data) {
++           int v = (int) (*((CARD32 *) prop->data));
++           if ((v>0) && (v<4096)) {
++               xf86DrvMsg(0, X_INFO, "get_constant_dpi_value() found property \"%s\" with value=%i\n", property_name, (int) v);
++               return (int) v;
++           }
++           break;
++       }
++    }
++    return default_dpi;
++}
++
+ /* Mandatory */
+ Bool
+ DUMMYSwitchMode(SWITCH_MODE_ARGS_DECL)
+ {
++    SCRN_INFO_PTR(arg);
++#ifdef RANDR
++    DUMMYPtr dPtr = DUMMYPTR(pScrn);
++    if (dPtr->constantDPI) {
++        int xDpi = get_dpi_value(pScrn->pScreen->root, XDPY_PROPERTY, pScrn->xDpi);
++        int yDpi = get_dpi_value(pScrn->pScreen->root, YDPY_PROPERTY, pScrn->yDpi);
++        //25.4 mm per inch: (254/10)
++        pScrn->pScreen->mmWidth = mode->HDisplay * 254 / xDpi / 10;
++        pScrn->pScreen->mmHeight = mode->VDisplay * 254 / yDpi / 10;
++        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "mm(dpi %ix%i)=%ix%i\n", xDpi, yDpi, pScrn->pScreen->mmWidth, pScrn->pScreen->mmHeight);
++        RRScreenSizeNotify(pScrn->pScreen);
++        RRTellChanged(pScrn->pScreen);
++    }
++#endif
+     return TRUE;
+ }
+ 
diff --git a/nixpkgs/pkgs/tools/X11/xpra/0003-fix-pointer-limits.patch b/nixpkgs/pkgs/tools/X11/xpra/0003-fix-pointer-limits.patch
new file mode 100644
index 000000000000..3dbb6fd179ff
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xpra/0003-fix-pointer-limits.patch
@@ -0,0 +1,39 @@
+--- xf86-video-dummy-0.3.6/src/dummy_driver.c	2014-11-05 19:24:02.668656601 +0700
++++ xf86-video-dummy-0.3.6.new/src/dummy_driver.c	2014-11-05 19:37:53.076061853 +0700
+@@ -55,6 +55,9 @@
+ #include <X11/extensions/xf86dgaproto.h>
+ #endif
+ 
++/* Needed for fixing pointer limits on resize */
++#include "inputstr.h"
++
+ /* Mandatory functions */
+ static const OptionInfoRec *	DUMMYAvailableOptions(int chipid, int busid);
+ static void     DUMMYIdentify(int flags);
+@@ -713,6 +716,26 @@
+         RRTellChanged(pScrn->pScreen);
+     }
+ #endif
++    //ensure the screen dimensions are also updated:
++    pScrn->pScreen->width = mode->HDisplay;
++    pScrn->pScreen->height = mode->VDisplay;
++    pScrn->virtualX = mode->HDisplay;
++    pScrn->virtualY = mode->VDisplay;
++    pScrn->frameX1 = mode->HDisplay;
++    pScrn->frameY1 = mode->VDisplay;
++
++    //ensure the pointer uses the new limits too:
++    DeviceIntPtr pDev;
++    SpritePtr pSprite;
++    for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
++        if (pDev->spriteInfo!=NULL && pDev->spriteInfo->sprite!=NULL) {
++            pSprite = pDev->spriteInfo->sprite;
++            pSprite->hotLimits.x2 = mode->HDisplay;
++            pSprite->hotLimits.y2 = mode->VDisplay;
++            pSprite->physLimits.x2 = mode->HDisplay;
++            pSprite->physLimits.y2 = mode->VDisplay;
++        }
++    }
+     return TRUE;
+ }
+ 
diff --git a/nixpkgs/pkgs/tools/X11/xpra/0005-support-for-30-bit-depth-in-dummy-driver.patch b/nixpkgs/pkgs/tools/X11/xpra/0005-support-for-30-bit-depth-in-dummy-driver.patch
new file mode 100644
index 000000000000..567db3fc3865
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xpra/0005-support-for-30-bit-depth-in-dummy-driver.patch
@@ -0,0 +1,41 @@
+--- a/src/dummy.h	2016-12-17 23:33:33.279533389 +0100
++++ b/src/dummy.h	2016-12-17 23:33:56.695739166 +0100
+@@ -69,7 +69,7 @@
+     int overlay_offset;
+     int videoKey;
+     int interlace;
+-    dummy_colors colors[256];
++    dummy_colors colors[1024];
+     pointer* FBBase;
+     Bool        (*CreateWindow)() ;     /* wrapped CreateWindow */
+     Bool prop;
+--- a/src/dummy_driver.c	2016-12-17 23:33:47.446657886 +0100
++++ b/src/dummy_driver.c	2016-12-17 23:33:56.696739175 +0100
+@@ -317,6 +317,7 @@
+ 	case 15:
+ 	case 16:
+ 	case 24:
++        case 30:
+ 	    break;
+ 	default:
+ 	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+@@ -331,8 +332,8 @@
+ 	pScrn->rgbBits = 8;
+ 
+     /* Get the depth24 pixmap format */
+-    if (pScrn->depth == 24 && pix24bpp == 0)
+-	pix24bpp = xf86GetBppFromDepth(pScrn, 24);
++    if (pScrn->depth >= 24 && pix24bpp == 0)
++	pix24bpp = xf86GetBppFromDepth(pScrn, pScrn->depth);
+ 
+     /*
+      * This must happen after pScrn->display has been set because
+@@ -623,7 +624,7 @@
+     if(!miCreateDefColormap(pScreen))
+ 	return FALSE;
+ 
+-    if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits,
++    if (!xf86HandleColormaps(pScreen, 1024, pScrn->rgbBits,
+                          DUMMYLoadPalette, NULL, 
+                          CMAP_PALETTED_TRUECOLOR 
+ 			     | CMAP_RELOAD_ON_MODE_SWITCH))
diff --git a/nixpkgs/pkgs/tools/X11/xpra/default.nix b/nixpkgs/pkgs/tools/X11/xpra/default.nix
new file mode 100644
index 000000000000..1f9efc31061a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xpra/default.nix
@@ -0,0 +1,120 @@
+{ stdenv, lib, fetchurl, callPackage, substituteAll, python3, pkgconfig, writeText
+, xorg, gtk3, glib, pango, cairo, gdk-pixbuf, atk
+, wrapGAppsHook, xorgserver, getopt, xauth, utillinux, which
+, ffmpeg_4, x264, libvpx, libwebp, x265
+, libfakeXinerama
+, gst_all_1, pulseaudio, gobject-introspection
+, pam }:
+
+with lib;
+
+let
+  inherit (python3.pkgs) cython buildPythonApplication;
+
+  xf86videodummy = xorg.xf86videodummy.overrideDerivation (p: {
+    patches = [
+      ./0002-Constant-DPI.patch
+      ./0003-fix-pointer-limits.patch
+      ./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
+  '';
+
+in buildPythonApplication rec {
+  pname = "xpra";
+  version = "3.0.8";
+
+  src = fetchurl {
+    url = "https://xpra.org/src/${pname}-${version}.tar.xz";
+    sha256 = "0d78bn7s03nwnyc4ryznxaivbg55kvsb26q75p8747j3562s9p2b";
+  };
+
+  patches = [
+    (substituteAll {
+      src = ./fix-paths.patch;
+      inherit (xorg) xkeyboardconfig;
+    })
+  ];
+
+  postPatch = ''
+    substituteInPlace setup.py --replace '/usr/include/security' '${pam}/include/security'
+  '';
+
+  nativeBuildInputs = [ pkgconfig wrapGAppsHook ];
+  buildInputs = with xorg; [
+    libX11 xorgproto libXrender libXi
+    libXtst libXfixes libXcomposite libXdamage
+    libXrandr libxkbfile
+    ] ++ [
+    cython
+
+    pango cairo gdk-pixbuf atk.out gtk3 glib
+
+    ffmpeg_4 libvpx x264 libwebp x265
+
+    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
+
+    pam
+    gobject-introspection
+  ];
+  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
+  ];
+
+    # error: 'import_cairo' defined but not used
+  NIX_CFLAGS_COMPILE = "-Wno-error=unused-function";
+
+  setupPyBuildFlags = [
+    "--with-Xdummy"
+    "--without-strict"
+    "--with-gtk3"
+    "--without-gtk2"
+    # Override these, setup.py checks for headers in /usr/* paths
+    "--with-pam"
+    "--with-vsock"
+  ];
+
+  preFixup = ''
+    gappsWrapperArgs+=(
+      --set XPRA_INSTALL_PREFIX "$out"
+      --prefix LD_LIBRARY_PATH : ${libfakeXinerama}/lib
+      --prefix PATH : ${stdenv.lib.makeBinPath [ getopt xorgserver xauth which utillinux pulseaudio ]}
+    )
+  '';
+
+  # append module paths to xorg.conf
+  postInstall = ''
+    cat ${xorgModulePaths} >> $out/etc/xpra/xorg.conf
+  '';
+
+  doCheck = false;
+
+  enableParallelBuilding = true;
+
+  passthru = { inherit xf86videodummy; };
+
+  meta = {
+    homepage = "http://xpra.org/";
+    downloadPage = "https://xpra.org/src/";
+    downloadURLRegexp = "xpra-.*[.]tar[.]xz$";
+    description = "Persistent remote applications for X";
+    platforms = platforms.linux;
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ tstrobel offline numinit ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xpra/fix-paths.patch b/nixpkgs/pkgs/tools/X11/xpra/fix-paths.patch
new file mode 100644
index 000000000000..a934e5e4cc33
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xpra/fix-paths.patch
@@ -0,0 +1,31 @@
+gdiff --git a/setup.py b/setup.py
+index 8d3df15..6156206 100755
+--- a/setup.py
++++ b/setup.py
+ -2322,11 +2322,7 @@ if v4l2_ENABLED:                                                                                                                                                       
+     videodev2_h = "/usr/include/linux/videodev2.h"                                                                                                                                           
+     constants_pxi = "xpra/codecs/v4l2/constants.pxi"                                                                                                                                         
+     if not os.path.exists(videodev2_h) or should_rebuild(videodev2_h, constants_pxi):                                                                                                        
+-        ENABLE_DEVICE_CAPS = 0                                                                                                                                                               
+-        if os.path.exists(videodev2_h):                                                                                                                                                      
+-            with open(videodev2_h) as f:
+-                hdata = f.read()
+-            ENABLE_DEVICE_CAPS = int(hdata.find("device_caps")>=0)
++        ENABLE_DEVICE_CAPS = 1
+         with open(constants_pxi, "wb") as f:
+             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/nixpkgs/pkgs/tools/X11/xpra/libfakeXinerama.nix b/nixpkgs/pkgs/tools/X11/xpra/libfakeXinerama.nix
new file mode 100644
index 000000000000..712f47fb2c81
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xpra/libfakeXinerama.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, libX11, libXinerama }:
+
+stdenv.mkDerivation  rec {
+  pname = "libfakeXinerama";
+  version = "0.1.0";
+
+  src = fetchurl {
+    url = "https://www.xpra.org/src/${pname}-${version}.tar.bz2";
+    sha256 = "0gxb8jska2anbb3c1m8asbglgnwylgdr44x9lr8yh91hjxsqadkx";
+  };
+
+  buildInputs = [ libX11 libXinerama ];
+
+  phases = [ "unpackPhase" "buildPhase" "installPhase" ];
+
+  buildPhase = ''
+    gcc -O2 -Wall fakeXinerama.c -fPIC -o libfakeXinerama.so.1.0 -shared
+  '';
+
+  installPhase = ''
+    mkdir -p $out/lib
+    cp libfakeXinerama.so.1.0 $out/lib
+    ln -s libXinerama.so.1.0 $out/lib/libXinerama.so.1
+    ln -s libXinerama.so.1 $out/lib/libXinerama.so
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "http://xpra.org/";
+    description = "fakeXinerama for Xpra";
+    platforms = platforms.linux;
+    maintainers = [ maintainers.tstrobel ];
+    license = licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xprintidle-ng/default.nix b/nixpkgs/pkgs/tools/X11/xprintidle-ng/default.nix
new file mode 100644
index 000000000000..c7bb2bc348b1
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xprintidle-ng/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, fetchFromGitHub, libX11, libXScrnSaver, libXext, gnulib
+  , autoconf, automake, libtool, gettext, pkgconfig
+  , git, perl, texinfo, help2man
+}:
+
+stdenv.mkDerivation rec {
+  pname = "xprintidle-ng";
+  version = "git-2015-09-01";
+
+  src = fetchFromGitHub {
+    owner = "taktoa";
+    repo = pname;
+    rev = "9083ba284d9222541ce7da8dc87d5a27ef5cc592";
+    sha256 = "0a5024vimpfrpj6w60j1ad8qvjkrmxiy8w1yijxfwk917ag9rkpq";
+  };
+
+  postPatch = ''
+    substituteInPlace configure.ac \
+      --replace "AC_PREREQ([2.62])" "AC_PREREQ([2.63])"
+  '';
+
+  nativeBuildInputs = [
+    autoconf automake gettext git gnulib
+    help2man libtool perl pkgconfig texinfo
+  ];
+
+  configurePhase = ''
+    ./bootstrap --gnulib-srcdir=${gnulib}
+    ./configure --prefix="$out"
+  '';
+
+  buildInputs = [
+    libX11 libXScrnSaver libXext
+  ];
+
+  meta = {
+    inherit  version;
+    description = ''A command-line tool to print idle time from libXss'';
+    homepage = "http://taktoa.me/xprintidle-ng/";
+    license = stdenv.lib.licenses.gpl2;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xrectsel/default.nix b/nixpkgs/pkgs/tools/X11/xrectsel/default.nix
new file mode 100644
index 000000000000..e2f9fdf4a435
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xrectsel/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, libX11 }:
+
+stdenv.mkDerivation rec {
+  pname = "xrectsel";
+  version = "0.3.2";
+
+  src = fetchFromGitHub {
+    owner = "lolilolicon";
+    repo = "xrectsel";
+    rev = version;
+    sha256 = "0prl4ky3xzch6xcb673mcixk998d40ngim5dqc5374b1ls2r6n7l";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+  buildInputs = [ libX11 ];
+
+  postBuild = ''
+    make install
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Print the geometry of a rectangular screen region";
+    homepage = "https://github.com/lolilolicon/xrectsel";
+    license = licenses.gpl3;
+    maintainers = [ maintainers.guyonvarch ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xrestop/default.nix b/nixpkgs/pkgs/tools/X11/xrestop/default.nix
new file mode 100644
index 000000000000..a28fc50c1e74
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xrestop/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl, xorg, pkgconfig, ncurses }:
+stdenv.mkDerivation {
+
+  pname = "xrestop";
+  version = "0.4";
+
+  src = fetchurl {
+    url = "mirror://gentoo/distfiles/xrestop-0.4.tar.gz";
+    sha256 = "0mz27jpij8am1s32i63mdm58znfijcpfhdqq1npbmvgclyagrhk7";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ xorg.libX11 xorg.libXres xorg.libXext ncurses ];
+
+  meta = {
+    platforms = stdenv.lib.platforms.unix;
+    license = stdenv.lib.licenses.gpl2;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xsecurelock/default.nix b/nixpkgs/pkgs/tools/X11/xsecurelock/default.nix
new file mode 100644
index 000000000000..effdd76ce9db
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xsecurelock/default.nix
@@ -0,0 +1,42 @@
+{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkgconfig
+, libX11, libXcomposite, libXft, libXmu, libXrandr, libXext, libXScrnSaver
+, pam, apacheHttpd, imagemagick, pamtester, xscreensaver, xset }:
+
+stdenv.mkDerivation rec {
+  pname = "xsecurelock";
+  version = "1.7.0";
+
+  src = fetchFromGitHub {
+    owner = "google";
+    repo = "xsecurelock";
+    rev = "v${version}";
+    sha256 = "020y2mi4sshc5dghcz37aj5wwizbg6712rzq2a72f8z8m7mnxr5y";
+  };
+
+  nativeBuildInputs = [
+    autoreconfHook pkgconfig
+  ];
+  buildInputs = [
+    libX11 libXcomposite libXft libXmu libXrandr libXext libXScrnSaver
+    pam apacheHttpd imagemagick pamtester
+  ];
+
+  configureFlags = [
+    "--with-pam-service-name=login"
+    "--with-xscreensaver=${xscreensaver}/libexec/xscreensaver"
+  ];
+
+  preConfigure = ''
+    cat > version.c <<'EOF'
+      const char *const git_version = "${version}";
+    EOF
+  '';
+
+  meta = with lib; {
+    description = "X11 screen lock utility with security in mind";
+    homepage = "https://github.com/google/xsecurelock";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ fpletz ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xsettingsd/SConstruct.patch b/nixpkgs/pkgs/tools/X11/xsettingsd/SConstruct.patch
new file mode 100644
index 000000000000..bae8d1efc14d
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xsettingsd/SConstruct.patch
@@ -0,0 +1,13 @@
+diff --git a/SConstruct b/SConstruct
+index bebc82e..3e0127b 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -59,6 +59,8 @@ srcs = Split('''\
+ ''')
+ libxsettingsd = env.Library('xsettingsd', srcs)
+ env['LIBS'] = libxsettingsd
++env['ENV']['PATH'] = os.environ.get('PATH', '')
++env['ENV']['PKG_CONFIG_PATH'] = os.environ.get('PKG_CONFIG_PATH', '')
+ env.ParseConfig('pkg-config --cflags --libs x11')
+ 
+ xsettingsd     = env.Program('xsettingsd', 'xsettingsd.cc')
diff --git a/nixpkgs/pkgs/tools/X11/xsettingsd/default.nix b/nixpkgs/pkgs/tools/X11/xsettingsd/default.nix
new file mode 100644
index 000000000000..10abd957e397
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xsettingsd/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, scons, pkgconfig, libX11 }:
+
+stdenv.mkDerivation rec {
+  pname = "xsettingsd";
+  version = "1.0.0";
+
+  src = fetchFromGitHub {
+    owner = "derat";
+    repo = "xsettingsd";
+    rev = "v${version}";
+    sha256 = "05m4jlw0mgwp24cvyklncpziq1prr2lg0cq9c055sh4n9d93d07v";
+  };
+
+  patches = [
+    ./SConstruct.patch
+  ];
+
+  nativeBuildInputs = [ scons pkgconfig ];
+
+  buildInputs = [ libX11 ];
+
+  buildPhase = ''
+    scons -j$NIX_BUILD_CORES -l$NIX_BUILD_CORES
+  '';
+  
+  installPhase = ''
+    install -D -t "$out"/bin xsettingsd dump_xsettings
+    install -D -t "$out"/usr/share/man/man1 xsettingsd.1 dump_xsettings.1
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Provides settings to X11 applications via the XSETTINGS specification";
+    homepage = "https://github.com/derat/xsettingsd";
+    license = licenses.bsd3;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.romildo ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xtrace/default.nix b/nixpkgs/pkgs/tools/X11/xtrace/default.nix
new file mode 100644
index 000000000000..aae31d649f44
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xtrace/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, autoreconfHook, fetchFromGitLab, libX11, xauth, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  pname = "xtrace";
+  version = "1.4.0";
+
+  src = fetchFromGitLab {
+    domain = "salsa.debian.org";
+    owner = "debian";
+    repo = pname;
+    rev = "xtrace-${version}";
+    sha256 = "1yff6x847nksciail9jly41mv70sl8sadh0m5d847ypbjmxcwjpq";
+  };
+
+  nativeBuildInputs = [ autoreconfHook makeWrapper ];
+  buildInputs = [ libX11 ];
+
+  postInstall = ''
+    wrapProgram "$out/bin/xtrace" \
+        --prefix PATH ':' "${xauth}/bin"
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "https://salsa.debian.org/debian/xtrace";
+    description = "Tool to trace X11 protocol connections";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ viric ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xtruss/default.nix b/nixpkgs/pkgs/tools/X11/xtruss/default.nix
new file mode 100644
index 000000000000..7d490571f482
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xtruss/default.nix
@@ -0,0 +1,18 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "xtruss";
+  version = "20181001.82973f5";
+
+  src = fetchurl {
+    url = "https://www.chiark.greenend.org.uk/~sgtatham/xtruss/${pname}-${version}.tar.gz";
+    sha256 = "1mm8k92zc318jk71wlf2r4rb723nd9lalhjl0pf48raiajb5ifgd";
+  };
+
+  meta = with stdenv.lib; {
+    description = "easy-to-use X protocol tracing program";
+    homepage = "https://www.chiark.greenend.org.uk/~sgtatham/xtruss";
+    license = licenses.mit;
+    maintainers = with maintainers; [ dtzWill ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xvkbd/default.nix b/nixpkgs/pkgs/tools/X11/xvkbd/default.nix
new file mode 100644
index 000000000000..6c61133077e4
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xvkbd/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, imake, libXt, libXaw, libXtst
+, libXi, libXpm, xorgproto, gccmakedep, Xaw3d }:
+
+stdenv.mkDerivation {
+  pname = "xvkbd";
+  version = "3.9";
+  src = fetchurl {
+    url = "http://t-sato.in.coocan.jp/xvkbd/xvkbd-3.9.tar.gz";
+    sha256 = "17csj6x5zm3g67izfwhagkal1rbqzpw09lqmmlyrjy3vzgfkf75q";
+  };
+
+  nativeBuildInputs = [ imake gccmakedep ];
+  buildInputs = [ libXt libXaw libXtst xorgproto libXi Xaw3d libXpm ];
+  installTargets = [ "install" "install.man" ];
+  makeFlags = [
+    "BINDIR=$(out)/bin"
+    "XAPPLOADDIR=$(out)/etc/X11/app-defaults"
+    "MANPATH=$(out)/man"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Virtual keyboard for X window system";
+    longDescription = ''
+      xvkbd is a virtual (graphical) keyboard program for X Window System which provides
+      facility to enter characters onto other clients (softwares) by clicking on a
+      keyboard displayed on the screen.
+    '';
+    homepage = "http://t-sato.in.coocan.jp/xvkbd";
+    license = licenses.gpl2Plus;
+    maintainers = [ maintainers.bennofs ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xwinmosaic/default.nix b/nixpkgs/pkgs/tools/X11/xwinmosaic/default.nix
new file mode 100644
index 000000000000..7b30e5c58155
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xwinmosaic/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchgit, gtk2, cmake, pkgconfig, libXdamage }:
+
+stdenv.mkDerivation rec {
+  version = "0.4.2";
+  pname = "xwinmosaic";
+
+  src = fetchgit {
+    url = "https://github.com/soulthreads/xwinmosaic/";
+    rev = "refs/tags/v0.4.2";
+    sha256 = "16qhrpgn84fz0q3nfvaz5sisc82zk6y7c0sbvbr69zfx5fwbs1rr";
+  };
+
+  nativeBuildInputs = [ pkgconfig cmake ];
+  buildInputs = [ gtk2 libXdamage ];
+
+  meta = {
+    inherit version;
+    description = ''X window switcher drawing a colourful grid'';
+    license = stdenv.lib.licenses.bsd2 ;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xwinwrap/default.nix b/nixpkgs/pkgs/tools/X11/xwinwrap/default.nix
new file mode 100644
index 000000000000..89b2fdd3dcf1
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xwinwrap/default.nix
@@ -0,0 +1,55 @@
+{ stdenv, fetchbzr, xlibsWrapper }:
+
+let
+  version = "4";
+in
+stdenv.mkDerivation {
+  pname = "xwinwrap";
+  inherit version;
+
+  src = fetchbzr {
+    url = "https://code.launchpad.net/~shantanu-goel/xwinwrap/devel";
+    rev = version;
+    sha256 = "1annhqc71jcgx5zvcy31c1c488ygx4q1ygrwyy2y0ww743smbchw";
+  };
+
+  buildInputs = [
+    xlibsWrapper
+  ];
+
+  buildPhase = if stdenv.hostPlatform.system == "x86_64-linux" then ''
+    make all64
+  '' else if stdenv.hostPlatform.system == "i686-linux" then ''
+    make all32
+  '' else throw "xwinwrap is not supported on ${stdenv.hostPlatform.system}";
+
+  installPhase = ''
+    mkdir -p $out/bin
+    mv */xwinwrap $out/bin
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A utility that allows you to use an animated X window as the wallpaper";
+    longDescription = ''
+      XWinWrap is a small utility written a loooong time ago that allowed you to
+      stick most of the apps to your desktop background. What this meant was you
+      could use an animated screensaver (like glmatrix, electric sheep, etc) or
+      even a movie, and use it as your wallpaper. But only one version of this
+      app was ever released, and it had a few problems, like:
+
+      - Well, sticking didn’t work. So if you did a “minimize all” or “go to
+      desktop” kind of thing, your “wallpaper” got minimized as well.
+
+      - The geometry option didn’t work, so you could not create, e.g., a small
+      matrix window surrounded by your original wallpaper.
+
+      Seeing no-one picking it up, I decided to give it a bit of polish last
+      weekend by fixing the above problems and also add a few features. And here
+      it is, in its new avatar “Shantz XWinWrap”.
+    '';
+    license = licenses.hpnd;
+    homepage = "https://shantanugoel.com/2008/09/03/shantz-xwinwrap/";
+    maintainers = with maintainers; [ infinisil ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/tools/X11/xzoom/default.nix b/nixpkgs/pkgs/tools/X11/xzoom/default.nix
new file mode 100644
index 000000000000..ed7828f37e2a
--- /dev/null
+++ b/nixpkgs/pkgs/tools/X11/xzoom/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, libX11, libXext, libXt, imake, gccmakedep}:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "xzoom";
+  version = "0.3";
+  patch = "24";
+
+  # or fetchFromGitHub(owner,repo,rev) or fetchgit(rev)
+  src = fetchurl {
+    url = "http://www.ibiblio.org/pub/linux/libs/X/${pname}-${version}.tgz";
+    sha256 = "0jzl5py4ny4n4i58lxx2hdwq9zphqf7h3m14spl3079y5mlzssxj";
+  };
+  patches = [
+    (fetchurl {
+       url = "http://http.debian.net/debian/pool/main/x/xzoom/xzoom_${version}-${patch}.diff.gz";
+       sha256 = "0zhc06whbvaz987bzzzi2bz6h9jp6rv812qs7b71drivvd820qbh";
+    })
+  ];
+
+  nativeBuildInputs = [ imake gccmakedep ];
+  buildInputs = [ libX11 libXext libXt ];
+
+  makeFlags = [
+    "PREFIX=$(out)"
+    "BINDIR=$(out)/bin"
+    "MANPATH=$(out)/share/man"
+  ];
+  installTargets = [ "install" "install.man" ];
+
+  meta = {
+    inherit version;
+    description = "An X11 screen zoom tool";
+    license = stdenv.lib.licenses.free ;
+    maintainers = [stdenv.lib.maintainers.raskin];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}