summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Schütz <robert.schuetz@stud.uni-heidelberg.de>2018-08-30 21:56:13 +0200
committerRobert Schütz <robert.schuetz@stud.uni-heidelberg.de>2018-08-30 21:56:13 +0200
commita9780a095bd05c5104c643f927a680194d040a92 (patch)
tree0fbfee23559abd7e429dfc9066bd8a2747404612
parent91b01208a0bdbf88213d1a4b40a35d249c035ac7 (diff)
parentefb16b582944c426353e407861d7172f24d965dd (diff)
downloadnixpkgs-a9780a095bd05c5104c643f927a680194d040a92.tar
nixpkgs-a9780a095bd05c5104c643f927a680194d040a92.tar.gz
nixpkgs-a9780a095bd05c5104c643f927a680194d040a92.tar.bz2
nixpkgs-a9780a095bd05c5104c643f927a680194d040a92.tar.lz
nixpkgs-a9780a095bd05c5104c643f927a680194d040a92.tar.xz
nixpkgs-a9780a095bd05c5104c643f927a680194d040a92.tar.zst
nixpkgs-a9780a095bd05c5104c643f927a680194d040a92.zip
Merge branch 'master' into staging-next
-rw-r--r--default.nix6
-rw-r--r--lib/attrsets.nix2
-rw-r--r--lib/minver.nix2
-rw-r--r--lib/modules.nix66
-rw-r--r--nixos/doc/manual/release-notes/rl-1809.xml44
-rw-r--r--nixos/modules/config/shells-environment.nix6
-rw-r--r--nixos/modules/config/system-path.nix28
-rw-r--r--nixos/modules/config/xdg/autostart.nix22
-rw-r--r--nixos/modules/config/xdg/icons.nix27
-rw-r--r--nixos/modules/config/xdg/menus.nix25
-rw-r--r--nixos/modules/config/xdg/mime.nix36
-rw-r--r--nixos/modules/installer/cd-dvd/iso-image.nix309
-rw-r--r--nixos/modules/misc/documentation.nix8
-rw-r--r--nixos/modules/module-list.nix4
-rw-r--r--nixos/modules/programs/environment.nix1
-rw-r--r--nixos/modules/services/monitoring/zabbix-server.nix4
-rw-r--r--nixos/modules/services/networking/xrdp.nix10
-rw-r--r--nixos/modules/services/x11/desktop-managers/enlightenment.nix9
-rw-r--r--nixos/modules/services/x11/desktop-managers/lumina.nix3
-rw-r--r--nixos/modules/services/x11/desktop-managers/plasma5.nix5
-rw-r--r--nixos/modules/services/x11/desktop-managers/xfce.nix5
-rw-r--r--nixos/modules/services/x11/xserver.nix8
-rw-r--r--pkgs/applications/audio/deadbeef/plugins/infobar.nix33
-rw-r--r--pkgs/applications/backup/deja-dup/default.nix2
-rw-r--r--pkgs/applications/editors/neovim/wrapper.nix51
-rw-r--r--pkgs/applications/editors/rstudio/default.nix4
-rw-r--r--pkgs/applications/misc/alacritty/default.nix6
-rw-r--r--pkgs/applications/misc/extract_url/default.nix42
-rw-r--r--pkgs/applications/misc/font-manager/default.nix23
-rw-r--r--pkgs/applications/misc/qpdfview/default.nix15
-rw-r--r--pkgs/applications/misc/urh/default.nix4
-rw-r--r--pkgs/applications/networking/sniffers/wireshark/default.nix4
-rw-r--r--pkgs/applications/version-management/gogs/default.nix8
-rw-r--r--pkgs/applications/window-managers/weston/default.nix4
-rw-r--r--pkgs/data/misc/nixos-artwork/grub2-theme.nix5
-rw-r--r--pkgs/desktops/enlightenment/enlightenment.nix14
-rw-r--r--pkgs/desktops/gnome-3/apps/file-roller/default.nix2
-rw-r--r--pkgs/desktops/gnome-3/apps/gnome-characters/default.nix2
-rw-r--r--pkgs/desktops/gnome-3/core/evolution-data-server/default.nix4
-rw-r--r--pkgs/desktops/gnome-3/core/gnome-settings-daemon/default.nix2
-rw-r--r--pkgs/desktops/gnome-3/core/libgee/default.nix7
-rw-r--r--pkgs/desktops/gnome-3/core/libgee/fix_introspection_paths.patch13
-rw-r--r--pkgs/desktops/gnome-3/core/totem/default.nix2
-rw-r--r--pkgs/development/libraries/glib-networking/default.nix2
-rw-r--r--pkgs/development/libraries/gvfs/default.nix6
-rw-r--r--pkgs/development/libraries/libfm/default.nix11
-rw-r--r--pkgs/development/libraries/libwnck/3.x.nix4
-rw-r--r--pkgs/development/libraries/pipewire/default.nix2
-rw-r--r--pkgs/development/libraries/science/math/sympow/default.nix6
-rw-r--r--pkgs/development/libraries/spice-gtk/default.nix2
-rw-r--r--pkgs/development/libraries/umockdev/default.nix4
-rw-r--r--pkgs/development/python-modules/backports_lzma/default.nix5
-rw-r--r--pkgs/development/python-modules/docker-registry-core/default.nix26
-rw-r--r--pkgs/development/python-modules/plotly/default.nix2
-rw-r--r--pkgs/development/python-modules/pytorch/default.nix6
-rw-r--r--pkgs/development/python-modules/pywatchman/default.nix26
-rw-r--r--pkgs/development/tools/corgi/default.nix28
-rw-r--r--pkgs/development/tools/corgi/deps.nix47
-rw-r--r--pkgs/development/tools/kythe/default.nix47
-rw-r--r--pkgs/development/tools/rust/bindgen/default.nix49
-rwxr-xr-xpkgs/development/tools/rust/bindgen/wrapper.sh36
-rw-r--r--pkgs/misc/emulators/wine/sources.nix6
-rw-r--r--pkgs/misc/vim-plugins/default.nix2
-rw-r--r--pkgs/misc/vim-plugins/vim-utils.nix8
-rw-r--r--pkgs/misc/vim-plugins/vim2nix/additional-nix-code/ensime-vim2
-rw-r--r--pkgs/os-specific/linux/dbus-broker/default.nix4
-rw-r--r--pkgs/os-specific/linux/dmidecode/default.nix1
-rw-r--r--pkgs/os-specific/linux/drbd/default.nix5
-rw-r--r--pkgs/os-specific/linux/ebtables/default.nix5
-rw-r--r--pkgs/os-specific/linux/fbterm/default.nix8
-rw-r--r--pkgs/os-specific/linux/gogoclient/default.nix9
-rw-r--r--pkgs/os-specific/linux/guvcview/default.nix7
-rw-r--r--pkgs/os-specific/linux/iomelt/default.nix1
-rw-r--r--pkgs/os-specific/linux/ipsec-tools/default.nix5
-rw-r--r--pkgs/os-specific/linux/iptables/default.nix1
-rw-r--r--pkgs/os-specific/linux/kernel/common-config.nix1
-rw-r--r--pkgs/os-specific/linux/kernel/linux-libre.nix38
-rw-r--r--pkgs/os-specific/linux/kexectools/default.nix1
-rw-r--r--pkgs/os-specific/linux/selinux-sandbox/default.nix2
-rw-r--r--pkgs/servers/atlassian/jira.nix4
-rw-r--r--pkgs/servers/openafs/1.6/module.nix2
-rw-r--r--pkgs/servers/openafs/1.8/module.nix2
-rw-r--r--pkgs/shells/zsh/zsh-completions/default.nix4
-rw-r--r--pkgs/tools/X11/xpra/default.nix1
-rw-r--r--pkgs/tools/filesystems/buttersink/default.nix (renamed from pkgs/development/python-modules/buttersink/default.nix)16
-rw-r--r--pkgs/tools/graphics/gmic/default.nix6
-rw-r--r--pkgs/tools/misc/colord/default.nix10
-rw-r--r--pkgs/tools/package-management/nix-review/default.nix4
-rw-r--r--pkgs/tools/security/sshuttle/default.nix17
-rw-r--r--pkgs/tools/typesetting/asciidoctor/Gemfile.lock10
-rw-r--r--pkgs/tools/typesetting/asciidoctor/default.nix2
-rw-r--r--pkgs/tools/typesetting/asciidoctor/gemset.nix104
-rw-r--r--pkgs/top-level/all-packages.nix26
-rw-r--r--pkgs/top-level/perl-packages.nix13
-rw-r--r--pkgs/top-level/python-packages.nix53
95 files changed, 1171 insertions, 395 deletions
diff --git a/default.nix b/default.nix
index 180815d4d6d..f4b2640ac5a 100644
--- a/default.nix
+++ b/default.nix
@@ -15,6 +15,12 @@ if ! builtins ? nixVersion || builtins.compareVersions requiredVersion builtins.
       it is safe to upgrade by running it again:
 
           curl https://nixos.org/nix/install | sh
+
+    For more information, please see the NixOS release notes at
+    https://nixos.org/nixos/manual or locally at
+    ${toString ./doc/manual/release-notes}.
+
+    If you need further help, see https://nixos.org/nixos/support.html
   ''
 
 else
diff --git a/lib/attrsets.nix b/lib/attrsets.nix
index cda13ee43ee..1e4142562fa 100644
--- a/lib/attrsets.nix
+++ b/lib/attrsets.nix
@@ -145,7 +145,7 @@ rec {
   foldAttrs = op: nul: list_of_attrs:
     fold (n: a:
         fold (name: o:
-          o // (listToAttrs [{inherit name; value = op n.${name} (a.${name} or nul); }])
+          o // { ${name} = op n.${name} (a.${name} or nul); }
         ) a (attrNames n)
     ) {} list_of_attrs;
 
diff --git a/lib/minver.nix b/lib/minver.nix
index 2147820c0e4..fee6b65a244 100644
--- a/lib/minver.nix
+++ b/lib/minver.nix
@@ -1,2 +1,2 @@
 # Expose the minimum required version for evaluating Nixpkgs
-"1.11"
+"2.0"
diff --git a/lib/modules.nix b/lib/modules.nix
index a443d5ec5d1..5fb83a4a538 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -192,29 +192,53 @@ rec {
       (concatMap (m: map (config: { inherit (m) file; inherit config; }) (pushDownProperties m.config)) modules);
 
   mergeModules' = prefix: options: configs:
-    listToAttrs (map (name: {
+    let
+     /* byName is like foldAttrs, but will look for attributes to merge in the
+        specified attribute name.
+
+        byName "foo" (module: value: ["module.hidden=${module.hidden},value=${value}"])
+        [
+          {
+            hidden="baz";
+            foo={qux="bar"; gla="flop";};
+          }
+          {
+            hidden="fli";
+            foo={qux="gne"; gli="flip";};
+          }
+        ]
+        ===>
+        {
+          gla = [ "module.hidden=baz,value=flop" ];
+          gli = [ "module.hidden=fli,value=flip" ];
+          qux = [ "module.hidden=baz,value=bar" "module.hidden=fli,value=gne" ];
+        }
+      */
+      byName = attr: f: modules: foldl' (acc: module:
+        foldl' (inner: name:
+          inner // { ${name} = (acc.${name} or []) ++ (f module module.${attr}.${name}); }
+          ) acc (attrNames module.${attr})
+        ) {} modules;
+      # an attrset 'name' => list of submodules that declare ‘name’.
+      declsByName = byName "options"
+        (module: option: [{ inherit (module) file; options = option; }])
+        options;
+      # an attrset 'name' => list of submodules that define ‘name’.
+      defnsByName = byName "config" (module: value:
+        map (config: { inherit (module) file; inherit config; }) (pushDownProperties value)
+        ) configs;
+      # extract the definitions for each loc
+      defnsByName' = byName "config"
+        (module: value: [{ inherit (module) file; inherit value; }])
+        configs;
+    in
+    (flip mapAttrs declsByName (name: decls:
       # We're descending into attribute ‘name’.
-      inherit name;
-      value =
         let
           loc = prefix ++ [name];
-          # Get all submodules that declare ‘name’.
-          decls = concatMap (m:
-            if m.options ? ${name}
-              then [ { inherit (m) file; options = m.options.${name}; } ]
-              else []
-            ) options;
-          # Get all submodules that define ‘name’.
-          defns = concatMap (m:
-            if m.config ? ${name}
-              then map (config: { inherit (m) file; inherit config; })
-                (pushDownProperties m.config.${name})
-              else []
-            ) configs;
+          defns = defnsByName.${name} or [];
+          defns' = defnsByName'.${name} or [];
           nrOptions = count (m: isOption m.options) decls;
-          # Extract the definitions for this loc
-          defns' = map (m: { inherit (m) file; value = m.config.${name}; })
-            (filter (m: m.config ? ${name}) configs);
         in
           if nrOptions == length decls then
             let opt = fixupOptionType loc (mergeOptionDecls loc decls);
@@ -226,8 +250,8 @@ rec {
             in
               throw "The option `${showOption loc}' in `${firstOption.file}' is a prefix of options in `${firstNonOption.file}'."
           else
-            mergeModules' loc decls defns;
-    }) (concatMap (m: attrNames m.options) options))
+            mergeModules' loc decls defns
+      ))
     // { _definedNames = map (m: { inherit (m) file; names = attrNames m.config; }) configs; };
 
   /* Merge multiple option declarations into a single declaration.  In
diff --git a/nixos/doc/manual/release-notes/rl-1809.xml b/nixos/doc/manual/release-notes/rl-1809.xml
index db9e13da065..6da67fe6d1e 100644
--- a/nixos/doc/manual/release-notes/rl-1809.xml
+++ b/nixos/doc/manual/release-notes/rl-1809.xml
@@ -141,6 +141,50 @@ $ nix-instantiate -E '(import &lt;nixpkgsunstable&gt; {}).gitFull'
    </listitem>
    <listitem>
     <para>
+     The minimum version of Nix required to evaluate Nixpkgs is now 2.0.
+    </para>
+    <itemizedlist>
+     <listitem>
+      <para>
+       For users of NixOS 18.03, NixOS 18.03 defaulted to Nix 2.0, but
+       supported using Nix 1.11 by setting <literal>nix.package =
+       pkgs.nix1;</literal>. If this option is set to a Nix 1.11 package, you
+       will need to either unset the option or upgrade it to Nix 2.0.
+      </para>
+     </listitem>
+     <listitem>
+      <para>
+       For users of NixOS 17.09, you will first need to upgrade Nix by setting
+       <literal>nix.package = pkgs.nixStable2;</literal> and run
+       <command>nixos-rebuild switch</command> as the <literal>root</literal>
+       user.
+      </para>
+     </listitem>
+     <listitem>
+      <para>
+       For users of a daemon-less Nix installation on Linux or macOS, you can
+       upgrade Nix by running <command>curl https://nixos.org/nix/install |
+       sh</command>, or prior to doing a channel update, running
+       <command>nix-env -iA nix</command>.
+      </para>
+      <para>
+       If you have already run a channel update and Nix is no longer able to
+       evaluate Nixpkgs, the error message printed should provide adequate
+       directions for upgrading Nix.
+      </para>
+     </listitem>
+     <listitem>
+      <para>
+       For users of the Nix daemon on macOS, you can upgrade Nix by running
+       <command>sudo -i sh -c 'nix-channel --update &amp;&amp; nix-env -iA
+       nixpkgs.nix'; sudo launchctl stop org.nixos.nix-daemon; sudo launchctl
+       start org.nixos.nix-daemon</command>.
+      </para>
+     </listitem>
+    </itemizedlist>
+   </listitem>
+   <listitem>
+    <para>
      <literal>lib.strict</literal> is removed. Use
      <literal>builtins.seq</literal> instead.
     </para>
diff --git a/nixos/modules/config/shells-environment.nix b/nixos/modules/config/shells-environment.nix
index 9dc4749b08d..b2bfc785f2a 100644
--- a/nixos/modules/config/shells-environment.nix
+++ b/nixos/modules/config/shells-environment.nix
@@ -80,7 +80,7 @@ in
       default = "";
       description = ''
         Shell script code called during shell initialisation.
-        This code is asumed to be shell-independent, which means you should
+        This code is assumed to be shell-independent, which means you should
         stick to pure sh without sh word split.
       '';
       type = types.lines;
@@ -90,7 +90,7 @@ in
       default = "";
       description = ''
         Shell script code called during login shell initialisation.
-        This code is asumed to be shell-independent, which means you should
+        This code is assumed to be shell-independent, which means you should
         stick to pure sh without sh word split.
       '';
       type = types.lines;
@@ -100,7 +100,7 @@ in
       default = "";
       description = ''
         Shell script code called during interactive shell initialisation.
-        This code is asumed to be shell-independent, which means you should
+        This code is assumed to be shell-independent, which means you should
         stick to pure sh without sh word split.
       '';
       type = types.lines;
diff --git a/nixos/modules/config/system-path.nix b/nixos/modules/config/system-path.nix
index 36115166501..ffb437491f6 100644
--- a/nixos/modules/config/system-path.nix
+++ b/nixos/modules/config/system-path.nix
@@ -81,6 +81,12 @@ in
         description = "List of additional package outputs to be symlinked into <filename>/run/current-system/sw</filename>.";
       };
 
+      extraSetup = mkOption {
+        type = types.lines;
+        default = "";
+        description = "Shell fragments to be run after the system environment has been created. This should only be used for things that need to modify the internals of the environment, e.g. generating MIME caches. The environment being built can be accessed at $out.";
+      };
+
     };
 
     system = {
@@ -107,12 +113,7 @@ in
         "/etc/gtk-3.0"
         "/lib" # FIXME: remove and update debug-info.nix
         "/sbin"
-        "/share/applications"
-        "/share/desktop-directories"
         "/share/emacs"
-        "/share/icons"
-        "/share/menus"
-        "/share/mime"
         "/share/nano"
         "/share/org"
         "/share/themes"
@@ -132,10 +133,6 @@ in
       # outputs TODO: note that the tools will often not be linked by default
       postBuild =
         ''
-          if [ -x $out/bin/update-mime-database -a -w $out/share/mime ]; then
-              XDG_DATA_DIRS=$out/share $out/bin/update-mime-database -V $out/share/mime > /dev/null
-          fi
-
           if [ -x $out/bin/gtk-update-icon-cache -a -f $out/share/icons/hicolor/index.theme ]; then
               $out/bin/gtk-update-icon-cache $out/share/icons/hicolor
           fi
@@ -143,17 +140,8 @@ in
           if [ -x $out/bin/glib-compile-schemas -a -w $out/share/glib-2.0/schemas ]; then
               $out/bin/glib-compile-schemas $out/share/glib-2.0/schemas
           fi
-
-          if [ -x $out/bin/update-desktop-database -a -w $out/share/applications ]; then
-              $out/bin/update-desktop-database $out/share/applications
-          fi
-
-          if [ -x $out/bin/install-info -a -w $out/share/info ]; then
-            shopt -s nullglob
-            for i in $out/share/info/*.info $out/share/info/*.info.gz; do
-                $out/bin/install-info $i $out/share/info/dir
-            done
-          fi
+          
+          ${config.environment.extraSetup}
         '';
     };
 
diff --git a/nixos/modules/config/xdg/autostart.nix b/nixos/modules/config/xdg/autostart.nix
new file mode 100644
index 00000000000..0ee94fed818
--- /dev/null
+++ b/nixos/modules/config/xdg/autostart.nix
@@ -0,0 +1,22 @@
+{ config, lib, ... }:
+
+with lib;
+{
+  options = {
+    xdg.autostart.enable = mkOption {
+      type = types.bool;
+      default = true;
+      description = ''
+        Whether to install files to support the 
+        <link xlink:href="https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html">XDG Autostart specification</link>.
+      '';
+    };
+  };
+
+  config = mkIf config.xdg.autostart.enable {
+    environment.pathsToLink = [ 
+      "/etc/xdg/autostart"
+    ];
+  };
+
+}
diff --git a/nixos/modules/config/xdg/icons.nix b/nixos/modules/config/xdg/icons.nix
new file mode 100644
index 00000000000..8268a3771a0
--- /dev/null
+++ b/nixos/modules/config/xdg/icons.nix
@@ -0,0 +1,27 @@
+{ config, lib, ... }:
+
+with lib;
+{
+  options = {
+    xdg.icons.enable = mkOption {
+      type = types.bool;
+      default = true;
+      description = ''
+        Whether to install files to support the 
+        <link xlink:href="https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html">XDG Icon Theme specification</link>.
+      '';
+    };
+  };
+
+  config = mkIf config.xdg.icons.enable {
+    environment.pathsToLink = [ 
+      "/share/icons" 
+      "/share/pixmaps" 
+    ];
+    
+    environment.profileRelativeEnvVars = {
+      XCURSOR_PATH = [ "/share/icons" ];
+    };
+  };
+
+}
diff --git a/nixos/modules/config/xdg/menus.nix b/nixos/modules/config/xdg/menus.nix
new file mode 100644
index 00000000000..c172692df5d
--- /dev/null
+++ b/nixos/modules/config/xdg/menus.nix
@@ -0,0 +1,25 @@
+{ config, lib, ... }:
+
+with lib;
+{
+  options = {
+    xdg.menus.enable = mkOption {
+      type = types.bool;
+      default = true;
+      description = ''
+        Whether to install files to support the 
+        <link xlink:href="https://specifications.freedesktop.org/menu-spec/menu-spec-latest.html">XDG Desktop Menu specification</link>.
+      '';
+    };
+  };
+
+  config = mkIf config.xdg.menus.enable {
+    environment.pathsToLink = [ 
+      "/share/applications"
+      "/share/desktop-directories"
+      "/etc/xdg/menus"
+      "/etc/xdg/menus/applications-merged"
+    ];
+  };
+
+}
diff --git a/nixos/modules/config/xdg/mime.nix b/nixos/modules/config/xdg/mime.nix
new file mode 100644
index 00000000000..f1b672234a3
--- /dev/null
+++ b/nixos/modules/config/xdg/mime.nix
@@ -0,0 +1,36 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+{
+  options = {
+    xdg.mime.enable = mkOption {
+      type = types.bool;
+      default = true;
+      description = ''
+        Whether to install files to support the 
+        <link xlink:href="https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html">XDG Shared MIME-info specification</link> and the
+        <link xlink:href="https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-latest.html">XDG MIME Applications specification</link>.
+      '';
+    };
+  };
+
+  config = mkIf config.xdg.mime.enable {
+    environment.pathsToLink = [ "/share/mime" ];
+
+    environment.systemPackages = [ 
+      # this package also installs some useful data, as well as its utilities 
+      pkgs.shared-mime-info 
+    ];
+
+    environment.extraSetup = ''
+      if [ -w $out/share/mime ]; then
+        XDG_DATA_DIRS=$out/share ${pkgs.shared-mime-info}/bin/update-mime-database -V $out/share/mime > /dev/null
+      fi
+
+      if [ -w $out/share/applications ]; then
+        ${pkgs.desktop-file-utils}/bin/update-desktop-database $out/share/applications
+      fi
+    '';
+  };
+
+}
diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix
index 1ac9e5c5c74..74fce0d1721 100644
--- a/nixos/modules/installer/cd-dvd/iso-image.nix
+++ b/nixos/modules/installer/cd-dvd/iso-image.nix
@@ -7,6 +7,63 @@
 with lib;
 
 let
+  /**
+   * Given a list of `options`, concats the result of mapping each options
+   * to a menuentry for use in grub.
+   *
+   *  * defaults: {name, image, params, initrd}
+   *  * options: [ option... ]
+   *  * option: {name, params, class}
+   */
+  menuBuilderGrub2 =
+  defaults: options: lib.concatStrings
+    (
+      map
+      (option: ''
+        menuentry '${defaults.name} ${
+        # Name appended to menuentry defaults to params if no specific name given.
+        option.name or (if option ? params then "(${option.params})" else "")
+        }' ${if option ? class then " --class ${option.class}" else ""} {
+          linux ${defaults.image} ${defaults.params} ${
+            option.params or ""
+          }
+          initrd ${defaults.initrd}
+        }
+      '')
+      options
+    )
+  ;
+
+  /**
+   * Given a `config`, builds the default options.
+   */
+  buildMenuGrub2 = config:
+    buildMenuAdditionalParamsGrub2 config ""
+  ;
+
+  /**
+   * Given a `config` and params to add to `params`, build a set of default options.
+   * Use this one when creating a variant (e.g. hidpi)
+   */
+  buildMenuAdditionalParamsGrub2 = config: additional:
+  let
+    finalCfg = {
+      name = "NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel}";
+      params = "init=${config.system.build.toplevel}/init ${additional} ${toString config.boot.kernelParams}";
+      image = "/boot/bzImage";
+      initrd = "/boot/initrd";
+    };
+  in
+    menuBuilderGrub2
+    finalCfg
+    [
+      { class = "installer"; }
+      { class = "nomodeset"; params = "nomodeset"; }
+      { class = "copytoram"; params = "copytoram"; }
+      { class = "debug";     params = "debug"; }
+    ]
+  ;
+
   # Timeout in syslinux is in units of 1/10 of a second.
   # 0 is used to disable timeouts.
   syslinuxTimeout = if config.boot.loader.timeout == null then
@@ -36,6 +93,28 @@ let
     UI vesamenu.c32
     MENU TITLE NixOS
     MENU BACKGROUND /isolinux/background.png
+    MENU RESOLUTION 800 600
+    MENU CLEAR
+    MENU ROWS 6
+    MENU CMDLINEROW -4
+    MENU TIMEOUTROW -3
+    MENU TABMSGROW  -2
+    MENU HELPMSGROW -1
+    MENU HELPMSGENDROW -1
+    MENU MARGIN 0
+
+    #                                FG:AARRGGBB  BG:AARRGGBB   shadow
+    MENU COLOR BORDER       30;44      #00000000    #00000000   none
+    MENU COLOR SCREEN       37;40      #FF000000    #00E2E8FF   none
+    MENU COLOR TABMSG       31;40      #80000000    #00000000   none
+    MENU COLOR TIMEOUT      1;37;40    #FF000000    #00000000   none
+    MENU COLOR TIMEOUT_MSG  37;40      #FF000000    #00000000   none
+    MENU COLOR CMDMARK      1;36;40    #FF000000    #00000000   none
+    MENU COLOR CMDLINE      37;40      #FF000000    #00000000   none
+    MENU COLOR TITLE        1;36;44    #00000000    #00000000   none
+    MENU COLOR UNSEL        37;44      #FF000000    #00000000   none
+    MENU COLOR SEL          7;37;40    #FFFFFFFF    #FF5277C3   std
+
     DEFAULT boot
 
     LABEL boot
@@ -76,49 +155,167 @@ let
   isolinuxCfg = concatStringsSep "\n"
     ([ baseIsolinuxCfg ] ++ optional config.boot.loader.grub.memtest86.enable isolinuxMemtest86Entry);
 
+  # Setup instructions for rEFInd.
+  refind =
+    if targetArch == "x64" then
+      ''
+      # Adds rEFInd to the ISO.
+      cp -v ${pkgs.refind}/share/refind/refind_x64.efi $out/EFI/boot/
+      ''
+    else
+      "# No refind for ia32"
+  ;
+
+  grubMenuCfg = ''
+    #
+    # Menu configuration
+    #
+
+    insmod gfxterm
+    insmod png
+    set gfxpayload=keep
+
+    # Fonts can be loaded?
+    # (This font is assumed to always be provided as a fallback by NixOS)
+    if loadfont (hd0)/EFI/boot/unicode.pf2; then
+      # Use graphical term, it can be either with background image or a theme.
+      # input is "console", while output is "gfxterm".
+      # This enables "serial" input and output only when possible.
+      # Otherwise the failure mode is to not even enable gfxterm.
+      if test "\$with_serial" == "yes"; then
+        terminal_output gfxterm serial
+        terminal_input  console serial
+      else
+        terminal_output gfxterm
+        terminal_input  console
+      fi
+    else
+      # Sets colors for the non-graphical term.
+      set menu_color_normal=cyan/blue
+      set menu_color_highlight=white/blue
+    fi
+
+    ${ # When there is a theme configured, use it, otherwise use the background image.
+    if (!isNull config.isoImage.grubTheme) then ''
+      # Sets theme.
+      set theme=(hd0)/EFI/boot/grub-theme/theme.txt
+      # Load theme fonts
+      $(find ${config.isoImage.grubTheme} -iname '*.pf2' -printf "loadfont (hd0)/EFI/boot/grub-theme/%P\n")
+    '' else ''
+      if background_image (hd0)/EFI/boot/efi-background.png; then
+        # Black background means transparent background when there
+        # is a background image set... This seems undocumented :(
+        set color_normal=black/black
+        set color_highlight=white/blue
+      else
+        # Falls back again to proper colors.
+        set menu_color_normal=cyan/blue
+        set menu_color_highlight=white/blue
+      fi
+    ''}
+  '';
+
   # The EFI boot image.
+  # Notes about grub:
+  #  * Yes, the grubMenuCfg has to be repeated in all submenus. Otherwise you
+  #    will get white-on-black console-like text on sub-menus. *sigh*
   efiDir = pkgs.runCommand "efi-directory" {} ''
-    mkdir -p $out/EFI/boot
-    cp -v ${pkgs.systemd}/lib/systemd/boot/efi/systemd-boot${targetArch}.efi $out/EFI/boot/boot${targetArch}.efi
-    mkdir -p $out/loader/entries
-
-    cat << EOF > $out/loader/entries/nixos-iso.conf
-    title NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel}
-    linux /boot/${config.system.boot.loader.kernelFile}
-    initrd /boot/${config.system.boot.loader.initrdFile}
-    options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}
-    EOF
-
-    # A variant to boot with 'nomodeset'
-    cat << EOF > $out/loader/entries/nixos-iso-nomodeset.conf
-    title NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel}
-    version nomodeset
-    linux /boot/${config.system.boot.loader.kernelFile}
-    initrd /boot/${config.system.boot.loader.initrdFile}
-    options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} nomodeset
-    EOF
-
-    # A variant to boot with 'copytoram'
-    cat << EOF > $out/loader/entries/nixos-iso-copytoram.conf
-    title NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel}
-    version copytoram
-    linux /boot/${config.system.boot.loader.kernelFile}
-    initrd /boot/${config.system.boot.loader.initrdFile}
-    options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} copytoram
+    mkdir -p $out/EFI/boot/
+
+    MODULES="fat iso9660 part_gpt part_msdos \
+             normal boot linux configfile loopback chain halt \
+             efifwsetup efi_gop efi_uga \
+             ls search search_label search_fs_uuid search_fs_file \
+             gfxmenu gfxterm gfxterm_background gfxterm_menu test all_video loadenv \
+             exfat ext2 ntfs btrfs hfsplus udf \
+             videoinfo png \
+             echo serial \
+            "
+    # Make our own efi program, we can't rely on "grub-install" since it seems to
+    # probe for devices, even with --skip-fs-probe.
+    ${pkgs.grub2_efi}/bin/grub-mkimage -o $out/EFI/boot/bootx64.efi -p /EFI/boot -O x86_64-efi \
+      $MODULES
+    cp ${pkgs.grub2_efi}/share/grub/unicode.pf2 $out/EFI/boot/
+
+    cat <<EOF > $out/EFI/boot/grub.cfg
+
+    # If you want to use serial for "terminal_*" commands, you need to set one up:
+    #   Example manual configuration:
+    #    → serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
+    # This uses the defaults, and makes the serial terminal available.
+    set with_serial=no
+    if serial; then set with_serial=yes ;fi
+    export with_serial
+    clear
+    set timeout=10
+    ${grubMenuCfg}
+
+    #
+    # Menu entries
+    #
+
+    ${buildMenuGrub2 config}
+    submenu "HiDPI, Quirks and Accessibility" --class hidpi --class submenu {
+      ${grubMenuCfg}
+      submenu "Suggests resolution @720p" --class hidpi-720p {
+        ${grubMenuCfg}
+        ${buildMenuAdditionalParamsGrub2 config "video=1280x720@60"}
+      }
+      submenu "Suggests resolution @1080p" --class hidpi-1080p {
+        ${grubMenuCfg}
+        ${buildMenuAdditionalParamsGrub2 config "video=1920x1080@60"}
+      }
+
+      # Some laptop and convertibles have the panel installed in an
+      # inconvenient way, rotated away from the keyboard.
+      # Those entries makes it easier to use the installer.
+      submenu "" {return}
+      submenu "Rotate framebuffer Clockwise" --class rotate-90cw {
+        ${grubMenuCfg}
+        ${buildMenuAdditionalParamsGrub2 config "fbcon=rotate:1"}
+      }
+      submenu "Rotate framebuffer Upside-Down" --class rotate-180 {
+        ${grubMenuCfg}
+        ${buildMenuAdditionalParamsGrub2 config "fbcon=rotate:2"}
+      }
+      submenu "Rotate framebuffer Counter-Clockwise" --class rotate-90ccw {
+        ${grubMenuCfg}
+        ${buildMenuAdditionalParamsGrub2 config "fbcon=rotate:3"}
+      }
+
+      # As a proof of concept, mainly. (Not sure it has accessibility merits.)
+      submenu "" {return}
+      submenu "Use black on white" --class accessibility-blakconwhite {
+        ${grubMenuCfg}
+        ${buildMenuAdditionalParamsGrub2 config "vt.default_red=0xFF,0xBC,0x4F,0xB4,0x56,0xBC,0x4F,0x00,0xA1,0xCF,0x84,0xCA,0x8D,0xB4,0x84,0x68 vt.default_grn=0xFF,0x55,0xBA,0xBA,0x4D,0x4D,0xB3,0x00,0xA0,0x8F,0xB3,0xCA,0x88,0x93,0xA4,0x68 vt.default_blu=0xFF,0x58,0x5F,0x58,0xC5,0xBD,0xC5,0x00,0xA8,0xBB,0xAB,0x97,0xBD,0xC7,0xC5,0x68"}
+      }
+
+      # Serial access is a must!
+      submenu "" {return}
+      submenu "Serial console=ttyS0,115200n8" --class serial {
+        ${grubMenuCfg}
+        ${buildMenuAdditionalParamsGrub2 config "console=ttyS0,115200n8"}
+      }
+    }
+
+    menuentry 'rEFInd' --class refind {
+      # UUID is hard-coded in the derivation.
+      search --set=root --no-floppy --fs-uuid 1234-5678
+      chainloader (\$root)/EFI/boot/refind_x64.efi
+    }
+    menuentry 'Firmware Setup' --class settings {
+      fwsetup
+      clear
+      echo ""
+      echo "If you see this message, your EFI system doesn't support this feature."
+      echo ""
+    }
+    menuentry 'Shutdown' --class shutdown {
+      halt
+    }
     EOF
 
-    # A variant to boot with verbose logging to the console
-    cat << EOF > $out/loader/entries/nixos-iso-debug.conf
-    title NixOS ${config.system.nixos.label}${config.isoImage.appendToMenuLabel} (debug)
-    linux /boot/${config.system.boot.loader.kernelFile}
-    initrd /boot/${config.system.boot.loader.initrdFile}
-    options init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} loglevel=7
-    EOF
-
-    cat << EOF > $out/loader/loader.conf
-    default nixos-iso
-    timeout ${builtins.toString config.boot.loader.timeout}
-    EOF
+    ${refind}
   '';
 
   efiImg = pkgs.runCommand "efi-image_eltorito" { buildInputs = [ pkgs.mtools pkgs.libfaketime ]; }
@@ -234,13 +431,31 @@ in
       '';
     };
 
+    isoImage.efiSplashImage = mkOption {
+      default = pkgs.fetchurl {
+          url = https://raw.githubusercontent.com/NixOS/nixos-artwork/a9e05d7deb38a8e005a2b52575a3f59a63a4dba0/bootloader/efi-background.png;
+          sha256 = "18lfwmp8yq923322nlb9gxrh5qikj1wsk6g5qvdh31c4h5b1538x";
+        };
+      description = ''
+        The splash image to use in the EFI bootloader.
+      '';
+    };
+
     isoImage.splashImage = mkOption {
       default = pkgs.fetchurl {
-          url = https://raw.githubusercontent.com/NixOS/nixos-artwork/5729ab16c6a5793c10a2913b5a1b3f59b91c36ee/ideas/grub-splash/grub-nixos-1.png;
-          sha256 = "43fd8ad5decf6c23c87e9026170a13588c2eba249d9013cb9f888da5e2002217";
+          url = https://raw.githubusercontent.com/NixOS/nixos-artwork/a9e05d7deb38a8e005a2b52575a3f59a63a4dba0/bootloader/isolinux/bios-boot.png;
+          sha256 = "1wp822zrhbg4fgfbwkr7cbkr4labx477209agzc0hr6k62fr6rxd";
         };
       description = ''
-        The splash image to use in the bootloader.
+        The splash image to use in the legacy-boot bootloader.
+      '';
+    };
+
+    isoImage.grubTheme = mkOption {
+      default = pkgs.nixos-grub2-theme;
+      type = types.nullOr (types.either types.path types.package);
+      description = ''
+        The grub2 theme used for UEFI boot.
       '';
     };
 
@@ -358,6 +573,9 @@ in
         { source = "${pkgs.syslinux}/share/syslinux";
           target = "/isolinux";
         }
+        { source = config.isoImage.efiSplashImage;
+          target = "/EFI/boot/efi-background.png";
+        }
         { source = config.isoImage.splashImage;
           target = "/isolinux/background.png";
         }
@@ -371,13 +589,14 @@ in
         { source = "${efiDir}/EFI";
           target = "/EFI";
         }
-        { source = "${efiDir}/loader";
-          target = "/loader";
-        }
       ] ++ optionals config.boot.loader.grub.memtest86.enable [
         { source = "${pkgs.memtest86plus}/memtest.bin";
           target = "/boot/memtest.bin";
         }
+      ] ++ optionals (!isNull config.isoImage.grubTheme) [
+        { source = config.isoImage.grubTheme;
+          target = "/EFI/boot/grub-theme";
+        }
       ];
 
     boot.loader.timeout = 10;
diff --git a/nixos/modules/misc/documentation.nix b/nixos/modules/misc/documentation.nix
index b482a5a6752..e6ccda5d7f4 100644
--- a/nixos/modules/misc/documentation.nix
+++ b/nixos/modules/misc/documentation.nix
@@ -82,6 +82,14 @@ let cfg = config.documentation; in
       environment.systemPackages = [ pkgs.texinfoInteractive ];
       environment.pathsToLink = [ "/share/info" ];
       environment.extraOutputsToInstall = [ "info" ] ++ optional cfg.dev.enable "devinfo";
+      environment.extraSetup = ''
+        if [ -w $out/share/info ]; then
+          shopt -s nullglob
+          for i in $out/share/info/*.info $out/share/info/*.info.gz; do
+              ${pkgs.texinfo}/bin/install-info $i $out/share/info/dir
+          done
+        fi
+      '';
     })
 
     (mkIf cfg.doc.enable {
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 12944857af4..6bad54d6d43 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -7,6 +7,10 @@
   ./config/fonts/fontdir.nix
   ./config/fonts/fonts.nix
   ./config/fonts/ghostscript.nix
+  ./config/xdg/autostart.nix
+  ./config/xdg/icons.nix
+  ./config/xdg/menus.nix
+  ./config/xdg/mime.nix
   ./config/gnu.nix
   ./config/i18n.nix
   ./config/iproute2.nix
diff --git a/nixos/modules/programs/environment.nix b/nixos/modules/programs/environment.nix
index 3bac8d98990..3c6d356ef99 100644
--- a/nixos/modules/programs/environment.nix
+++ b/nixos/modules/programs/environment.nix
@@ -40,7 +40,6 @@ in
         GTK_PATH = [ "/lib/gtk-2.0" "/lib/gtk-3.0" ];
         XDG_CONFIG_DIRS = [ "/etc/xdg" ];
         XDG_DATA_DIRS = [ "/share" ];
-        XCURSOR_PATH = [ "/share/icons" ];
         MOZ_PLUGIN_PATH = [ "/lib/mozilla/plugins" ];
         LIBEXEC_PATH = [ "/lib/libexec" ];
       };
diff --git a/nixos/modules/services/monitoring/zabbix-server.nix b/nixos/modules/services/monitoring/zabbix-server.nix
index f62d55457ed..5f9fc12832f 100644
--- a/nixos/modules/services/monitoring/zabbix-server.nix
+++ b/nixos/modules/services/monitoring/zabbix-server.nix
@@ -103,8 +103,8 @@ in
             chown zabbix ${stateDir} ${logDir} ${libDir}
 
             if ! test -e "${libDir}/db-created"; then
-                ${pkgs.postgresql}/bin/createuser --no-superuser --no-createdb --no-createrole zabbix || true
-                ${pkgs.postgresql}/bin/createdb --owner zabbix zabbix || true
+                ${pkgs.su}/bin/su -s "$SHELL" ${config.services.postgresql.superUser} -c '${pkgs.postgresql}/bin/createuser --no-superuser --no-createdb --no-createrole zabbix' || true
+                ${pkgs.su}/bin/su -s "$SHELL" ${config.services.postgresql.superUser} -c '${pkgs.postgresql}/bin/createdb --owner zabbix zabbix' || true
                 cat ${pkgs.zabbix.server}/share/zabbix/db/schema/postgresql.sql | ${pkgs.su}/bin/su -s "$SHELL" zabbix -c '${pkgs.postgresql}/bin/psql zabbix'
                 cat ${pkgs.zabbix.server}/share/zabbix/db/data/images_pgsql.sql | ${pkgs.su}/bin/su -s "$SHELL" zabbix -c '${pkgs.postgresql}/bin/psql zabbix'
                 cat ${pkgs.zabbix.server}/share/zabbix/db/data/data.sql | ${pkgs.su}/bin/su -s "$SHELL" zabbix -c '${pkgs.postgresql}/bin/psql zabbix'
diff --git a/nixos/modules/services/networking/xrdp.nix b/nixos/modules/services/networking/xrdp.nix
index 0e882873b4b..61f22a366a0 100644
--- a/nixos/modules/services/networking/xrdp.nix
+++ b/nixos/modules/services/networking/xrdp.nix
@@ -93,10 +93,14 @@ in
 
   config = mkIf cfg.enable {
 
-    # copied from <nixos/modules/services/x11/xserver.nix>
     # xrdp can run X11 program even if "services.xserver.enable = false"
-    environment.pathsToLink =
-      [ "/etc/xdg" "/share/xdg" "/share/applications" "/share/icons" "/share/pixmaps" ];
+    xdg = {
+      autostart.enable = true;
+      menus.enable = true;
+      mime.enable = true;
+      icons.enable = true;
+    };
+
     fonts.enableDefaultFonts = mkDefault true;
 
     systemd = {
diff --git a/nixos/modules/services/x11/desktop-managers/enlightenment.nix b/nixos/modules/services/x11/desktop-managers/enlightenment.nix
index da3287aaea6..6fa3ec3b925 100644
--- a/nixos/modules/services/x11/desktop-managers/enlightenment.nix
+++ b/nixos/modules/services/x11/desktop-managers/enlightenment.nix
@@ -33,12 +33,17 @@ in
       pkgs.xorg.xauth # used by kdesu
       pkgs.gtk2 # To get GTK+'s themes.
       pkgs.tango-icon-theme
-      pkgs.shared-mime-info
+
       pkgs.gnome2.gnomeicontheme
       pkgs.xorg.xcursorthemes
     ];
 
-    environment.pathsToLink = [ "/etc/enlightenment" "/etc/xdg" "/share/enlightenment" "/share/elementary" "/share/applications" "/share/locale" "/share/icons" "/share/themes" "/share/mime" "/share/desktop-directories" ];
+    environment.pathsToLink = [ 
+      "/etc/enlightenment" 
+      "/share/enlightenment" 
+      "/share/elementary" 
+      "/share/locale"
+    ];
 
     services.xserver.desktopManager.session = [
     { name = "Enlightenment";
diff --git a/nixos/modules/services/x11/desktop-managers/lumina.nix b/nixos/modules/services/x11/desktop-managers/lumina.nix
index 5fe84cfb82e..43fed2572b5 100644
--- a/nixos/modules/services/x11/desktop-managers/lumina.nix
+++ b/nixos/modules/services/x11/desktop-managers/lumina.nix
@@ -41,9 +41,8 @@ in
 
     # Link some extra directories in /run/current-system/software/share
     environment.pathsToLink = [
-      "/share/desktop-directories"
-      "/share/icons"
       "/share/lumina"
+      # FIXME: modules should link subdirs of `/share` rather than relying on this
       "/share"
     ];
 
diff --git a/nixos/modules/services/x11/desktop-managers/plasma5.nix b/nixos/modules/services/x11/desktop-managers/plasma5.nix
index 83d1957a646..d1cb962f6ff 100644
--- a/nixos/modules/services/x11/desktop-managers/plasma5.nix
+++ b/nixos/modules/services/x11/desktop-managers/plasma5.nix
@@ -174,7 +174,10 @@ in
         ++ lib.optional config.services.colord.enable colord-kde
         ++ lib.optionals config.services.samba.enable [ kdenetwork-filesharing pkgs.samba ];
 
-      environment.pathsToLink = [ "/share" ];
+      environment.pathsToLink = [ 
+        # FIXME: modules should link subdirs of `/share` rather than relying on this
+        "/share" 
+      ];
 
       environment.etc = singleton {
         source = xcfg.xkbDir;
diff --git a/nixos/modules/services/x11/desktop-managers/xfce.nix b/nixos/modules/services/x11/desktop-managers/xfce.nix
index ae155470419..75b9a76e192 100644
--- a/nixos/modules/services/x11/desktop-managers/xfce.nix
+++ b/nixos/modules/services/x11/desktop-managers/xfce.nix
@@ -59,9 +59,6 @@ in
       tango-icon-theme
       xfce4-icon-theme
 
-      desktop-file-utils
-      shared-mime-info
-
       # Needed by Xfce's xinitrc script
       # TODO: replace with command -v
       which
@@ -100,8 +97,6 @@ in
     environment.pathsToLink = [
       "/share/xfce4"
       "/share/themes"
-      "/share/mime"
-      "/share/desktop-directories"
       "/share/gtksourceview-2.0"
     ];
 
diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix
index b45e510f6b8..0237dd6f560 100644
--- a/nixos/modules/services/x11/xserver.nix
+++ b/nixos/modules/services/x11/xserver.nix
@@ -616,8 +616,12 @@ in
       ]
       ++ optional (elem "virtualbox" cfg.videoDrivers) xorg.xrefresh;
 
-    environment.pathsToLink =
-      [ "/etc/xdg" "/share/xdg" "/share/applications" "/share/icons" "/share/pixmaps" ];
+    xdg = { 
+      autostart.enable = true;
+      menus.enable = true;
+      mime.enable = true;
+      icons.enable = true;
+    };
 
     # The default max inotify watches is 8192.
     # Nowadays most apps require a good number of inotify watches,
diff --git a/pkgs/applications/audio/deadbeef/plugins/infobar.nix b/pkgs/applications/audio/deadbeef/plugins/infobar.nix
new file mode 100644
index 00000000000..92f566e3657
--- /dev/null
+++ b/pkgs/applications/audio/deadbeef/plugins/infobar.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, pkgconfig, deadbeef, gtk3, libxml2 }:
+
+stdenv.mkDerivation rec {
+  name = "deadbeef-infobar-plugin-${version}";
+  version = "1.4";
+
+  src = fetchurl {
+    url = "https://bitbucket.org/dsimbiriatin/deadbeef-infobar/downloads/deadbeef-infobar-${version}.tar.gz";
+    sha256 = "0c9wh3wh1hdww7v96i8cy797la06mylhfi0880k8vwh88079aapf";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ deadbeef gtk3 libxml2 ];
+
+  buildFlags = [ "gtk3" ];
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p $out/lib/deadbeef
+    cp gtk3/ddb_infobar_gtk3.so $out/lib/deadbeef
+
+    runHook postInstall
+  '';
+
+  meta = with stdenv.lib; {
+    description = "DeadBeeF Infobar Plugin";
+    homepage = https://bitbucket.org/dsimbiriatin/deadbeef-infobar;
+    license = licenses.gpl2Plus;
+    maintainers = [ maintainers.jtojnar ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/applications/backup/deja-dup/default.nix b/pkgs/applications/backup/deja-dup/default.nix
index 797a00f4fc4..c8fb4af3c4b 100644
--- a/pkgs/applications/backup/deja-dup/default.nix
+++ b/pkgs/applications/backup/deja-dup/default.nix
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
 
   propagatedUserEnvPkgs = [ duplicity ];
 
-  PKG_CONFIG_LIBNAUTILUS_EXTENSION_EXTENSIONDIR = "lib/nautilus/extensions-3.0";
+  PKG_CONFIG_LIBNAUTILUS_EXTENSION_EXTENSIONDIR = "${placeholder "out"}/lib/nautilus/extensions-3.0";
 
   postInstall = ''
     glib-compile-schemas $out/share/glib-2.0/schemas
diff --git a/pkgs/applications/editors/neovim/wrapper.nix b/pkgs/applications/editors/neovim/wrapper.nix
index fa060325559..17cf49521f1 100644
--- a/pkgs/applications/editors/neovim/wrapper.nix
+++ b/pkgs/applications/editors/neovim/wrapper.nix
@@ -10,13 +10,13 @@ neovim:
 
 let
   wrapper = {
-      withPython ? true,  extraPythonPackages ? []
-    , withPython3 ? true,  extraPython3Packages ? []
+      withPython ? true,  extraPythonPackages ? (_: []) /* the function you would have passed to python.withPackages */
+    , withPython3 ? true,  extraPython3Packages ? (_: []) /* the function you would have passed to python.withPackages */
     , withRuby ? true
     , withPyGUI ? false
     , vimAlias ? false
     , viAlias ? false
-    , configure ? null
+    , configure ? {}
   }:
   let
 
@@ -28,25 +28,27 @@ let
     '';
   };
 
-  pluginPythonPackages = if configure == null then [] else builtins.concatLists
-    (map ({ pythonDependencies ? [], ...}: pythonDependencies)
-         (vimUtils.requiredPlugins configure));
-  pythonEnv = pythonPackages.python.buildEnv.override {
-    extraLibs = (
-        if withPyGUI
-          then [ pythonPackages.neovim_gui ]
-          else [ pythonPackages.neovim ]
-      ) ++ extraPythonPackages ++ pluginPythonPackages;
-    ignoreCollisions = true;
-  };
+  /* for compatibility with passing extraPythonPackages as a list; added 2018-07-11 */
+  compatFun = funOrList: (if builtins.isList funOrList then
+    (_: builtins.trace "passing a list as extraPythonPackages to the neovim wrapper is deprecated, pass a function as to python.withPackages instead" funOrList)
+    else funOrList);
+  extraPythonPackagesFun = compatFun extraPythonPackages;
+  extraPython3PackagesFun = compatFun extraPython3Packages;
 
-  pluginPython3Packages = if configure == null then [] else builtins.concatLists
-    (map ({ python3Dependencies ? [], ...}: python3Dependencies)
-         (vimUtils.requiredPlugins configure));
-  python3Env = python3Packages.python.buildEnv.override {
-    extraLibs = [ python3Packages.neovim ] ++ extraPython3Packages ++ pluginPython3Packages;
-    ignoreCollisions = true;
-  };
+  requiredPlugins = vimUtils.requiredPlugins configure;
+  getDeps = attrname: map (plugin: plugin.${attrname} or (_:[]));
+
+  pluginPythonPackages = getDeps "pythonDependencies" requiredPlugins;
+  pythonEnv = pythonPackages.python.withPackages(ps:
+        (if withPyGUI then [ ps.neovim_gui ] else [ ps.neovim ])
+        ++ (extraPythonPackagesFun ps)
+        ++ (concatMap (f: f ps) pluginPythonPackages));
+
+  pluginPython3Packages = getDeps "python3Dependencies" requiredPlugins;
+  python3Env = python3Packages.python.withPackages (ps:
+        [ ps.neovim ]
+        ++ (extraPython3PackagesFun ps)
+        ++ (concatMap (f: f ps) pluginPython3Packages));
 
   in
   stdenv.mkDerivation {
@@ -63,7 +65,6 @@ let
         --cmd \"${if withPython then "let g:python_host_prog='$out/bin/nvim-python'" else "let g:loaded_python_provider = 1"}\" \
         --cmd \"${if withPython3 then "let g:python3_host_prog='$out/bin/nvim-python3'" else "let g:loaded_python3_provider = 1"}\" \
         --cmd \"${if withRuby then "let g:ruby_host_prog='$out/bin/nvim-ruby'" else "let g:loaded_ruby_provider=1"}\" " \
-        --unset PYTHONPATH \
          ${optionalString withRuby '' --suffix PATH : ${rubyEnv}/bin --set GEM_HOME ${rubyEnv}/${rubyEnv.ruby.gemPath}'' }
 
       ''
@@ -75,9 +76,9 @@ let
           --replace 'Name=Neovim' 'Name=WrappedNeovim'
       ''
       + optionalString withPython ''
-      ln -s ${pythonEnv}/bin/python $out/bin/nvim-python
+        makeWrapper ${pythonEnv}/bin/python $out/bin/nvim-python --unset PYTHONPATH
     '' + optionalString withPython3 ''
-      ln -s ${python3Env}/bin/python3 $out/bin/nvim-python3
+        makeWrapper ${python3Env}/bin/python3 $out/bin/nvim-python3 --unset PYTHONPATH
     '' + optionalString withRuby ''
       ln -s ${rubyEnv}/bin/neovim-ruby-host $out/bin/nvim-ruby
     ''
@@ -88,7 +89,7 @@ let
       ln -s $out/bin/nvim $out/bin/vim
     '' + optionalString viAlias ''
       ln -s $out/bin/nvim $out/bin/vi
-    '' + optionalString (configure != null) ''
+    '' + optionalString (configure != {}) ''
     wrapProgram $out/bin/nvim --add-flags "-u ${vimUtils.vimrcFile configure}"
     ''
     ;
diff --git a/pkgs/applications/editors/rstudio/default.nix b/pkgs/applications/editors/rstudio/default.nix
index 0943513a4d1..1a5c9d65583 100644
--- a/pkgs/applications/editors/rstudio/default.nix
+++ b/pkgs/applications/editors/rstudio/default.nix
@@ -6,7 +6,7 @@
 let
   verMajor = "1";
   verMinor = "1";
-  verPatch = "442";
+  verPatch = "456";
   version = "${verMajor}.${verMinor}.${verPatch}";
   ginVer = "1.5";
   gwtVer = "2.7.0";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     owner = "rstudio";
     repo = "rstudio";
     rev = "v${version}";
-    sha256 = "0drqh2brfs9w8dfh4r7j3fsqdsg63s6pvj2bbg5xwwc0yf220ahs";
+    sha256 = "0hv07qrbjwapbjrkddasglsgk0x5j7qal468i5rv77krsp09s4fz";
   };
 
   # Hack RStudio to only use the input R.
diff --git a/pkgs/applications/misc/alacritty/default.nix b/pkgs/applications/misc/alacritty/default.nix
index 089db8e73cb..4544ed1fba3 100644
--- a/pkgs/applications/misc/alacritty/default.nix
+++ b/pkgs/applications/misc/alacritty/default.nix
@@ -51,18 +51,18 @@ let
   ];
 in buildRustPackage rec {
   name = "alacritty-unstable-${version}";
-  version = "2018-07-20";
+  version = "2018-08-30";
 
   # At the moment we cannot handle git dependencies in buildRustPackage.
   # This fork only replaces rust-fontconfig/libfontconfig with a git submodules.
   src = fetchgit {
     url = https://github.com/Mic92/alacritty.git;
     rev = "rev-${version}";
-    sha256 = "1vhjmysfra6dsbv35qbvsf76rhkj990lgns0k0gpbcrf47gsvx1n";
+    sha256 = "0izvg7dwwb763jc6gnmn47i5zrkxvmh3vssn6vzrrmqhd4j3msmf";
     fetchSubmodules = true;
   };
 
-  cargoSha256 = "0rs2p4sik25ynx6ri2wlg8v6vrdmf10xxnw9f2aqyps9m038i9di";
+  cargoSha256 = "1ijgkwv9ij4haig1h6n2b9xbhp5vahy9vp1sx72wxaaj9476msjx";
 
   nativeBuildInputs = [
     cmake
diff --git a/pkgs/applications/misc/extract_url/default.nix b/pkgs/applications/misc/extract_url/default.nix
new file mode 100644
index 00000000000..389ac7dfb1f
--- /dev/null
+++ b/pkgs/applications/misc/extract_url/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, lib, fetchFromGitHub, makeWrapper, perl
+, MIMEtools, HTMLParser
+, cursesSupport ? true, CursesUI
+, uriFindSupport ? true, URIFind
+}:
+
+let
+  perlDeps =
+    [ MIMEtools HTMLParser ]
+    ++ lib.optional cursesSupport CursesUI
+    ++ lib.optional uriFindSupport URIFind;
+
+in stdenv.mkDerivation rec {
+  name = "extract_url-${version}";
+  version = "1.6.2";
+
+  src = fetchFromGitHub {
+    owner = "m3m0ryh0l3";
+    repo = "extracturl";
+    rev = "v${version}";
+    sha256 = "05589lp15jmcpbj4y9a3hmf6n2gsqrm4ybcyh3hd4j6pc7hmnhny";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ perl ] ++ perlDeps;
+
+  makeFlags = [ "prefix=$(out)" ];
+  installFlags = [ "INSTALL=install" ];
+
+  postFixup = ''
+    wrapProgram "$out/bin/extract_url" \
+      --set PERL5LIB "${lib.makeFullPerlPath perlDeps}"
+  '';
+
+  meta = with lib; {
+    homepage = https://www.memoryhole.net/~kyle/extract_url/;
+    description = "Extracts URLs from MIME messages or plain text";
+    license = licenses.bsd2;
+    maintainers = [ maintainers.qyliss ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/applications/misc/font-manager/default.nix b/pkgs/applications/misc/font-manager/default.nix
index 1fad5333a14..54392b03bfb 100644
--- a/pkgs/applications/misc/font-manager/default.nix
+++ b/pkgs/applications/misc/font-manager/default.nix
@@ -1,17 +1,17 @@
 { stdenv, fetchFromGitHub, automake, autoconf, libtool,
   pkgconfig, file, intltool, libxml2, json-glib , sqlite, itstool,
-  librsvg, vala_0_34, gnome3, wrapGAppsHook, gobjectIntrospection
+  librsvg, vala, gnome3, wrapGAppsHook, gobjectIntrospection
 }:
 
 stdenv.mkDerivation rec {
   name = "font-manager-${version}";
-  version = "0.7.3";
+  version = "0.7.3.1";
 
   src = fetchFromGitHub {
-    owner  = "FontManager";
-    repo   = "master";
-    rev    = version;
-    sha256 = "0qwi1mn2sc2q5cs28rga8i3cn34ylybs949vjnh97dl2rvlc0x06";
+    owner = "FontManager";
+    repo = "master";
+    rev = version;
+    sha256 = "0i65br0bk3r6x8wcl8jhc0v0agl0k6fy5g60ss1bnw4md7ldpgyi";
     };
 
   nativeBuildInputs = [
@@ -19,7 +19,8 @@ stdenv.mkDerivation rec {
     automake autoconf libtool
     file
     intltool
-    vala_0_34
+    itstool
+    vala
     gnome3.yelp-tools
     wrapGAppsHook
     # For setup hook
@@ -30,12 +31,9 @@ stdenv.mkDerivation rec {
     libxml2
     json-glib
     sqlite
-    itstool
     librsvg
     gnome3.gtk
-    gnome3.gucharmap
     gnome3.libgee
-    gnome3.file-roller
     gnome3.defaultIconTheme
   ];
 
@@ -46,7 +44,10 @@ stdenv.mkDerivation rec {
     substituteInPlace configure --replace "/usr/bin/file" "${file}/bin/file"
   '';
 
-  configureFlags = [ "--disable-pycompile" ];
+  configureFlags = [
+    "--with-file-roller"
+    "--disable-pycompile"
+  ];
 
   meta = {
     homepage = https://fontmanager.github.io/;
diff --git a/pkgs/applications/misc/qpdfview/default.nix b/pkgs/applications/misc/qpdfview/default.nix
index dfaa90d43ad..263bc37660c 100644
--- a/pkgs/applications/misc/qpdfview/default.nix
+++ b/pkgs/applications/misc/qpdfview/default.nix
@@ -21,11 +21,16 @@ stdenv.mkDerivation {
   src = fetchurl {
     inherit (s) url sha256;
   };
-
-  # TODO: revert this once placeholder is supported
-  preConfigure = ''
-    qmakeFlags="$qmakeFlags *.pro TARGET_INSTALL_PATH=$out/bin PLUGIN_INSTALL_PATH=$out/lib/qpdfview DATA_INSTALL_PATH=$out/share/qpdfview MANUAL_INSTALL_PATH=$out/share/man/man1 ICON_INSTALL_PATH=$out/share/icons/hicolor/scalable/apps LAUNCHER_INSTALL_PATH=$out/share/applications APPDATA_INSTALL_PATH=$out/share/appdata"
-  '';
+  qmakeFlags = [
+    "*.pro"
+    "TARGET_INSTALL_PATH=${placeholder "out"}/bin"
+    "PLUGIN_INSTALL_PATH=${placeholder "out"}/lib/qpdfview"
+    "DATA_INSTALL_PATH=${placeholder "out"}/share/qpdfview"
+    "MANUAL_INSTALL_PATH=${placeholder "out"}/share/man/man1"
+    "ICON_INSTALL_PATH=${placeholder "out"}/share/icons/hicolor/scalable/apps"
+    "LAUNCHER_INSTALL_PATH=${placeholder "out"}/share/applications"
+    "APPDATA_INSTALL_PATH=${placeholder "out"}/share/appdata"
+  ];
 
   meta = {
     inherit (s) version;
diff --git a/pkgs/applications/misc/urh/default.nix b/pkgs/applications/misc/urh/default.nix
index 56da0cf22ef..c5e8d1e2456 100644
--- a/pkgs/applications/misc/urh/default.nix
+++ b/pkgs/applications/misc/urh/default.nix
@@ -2,13 +2,13 @@
 
 python3Packages.buildPythonApplication rec {
   name = "urh-${version}";
-  version = "2.2.3";
+  version = "2.2.4";
 
   src = fetchFromGitHub {
     owner = "jopohl";
     repo = "urh";
     rev = "v${version}";
-    sha256 = "1iq84590cjpf2rlxb60fy4hxi7vir27bbb10axbwrqwnp5cc4bql";
+    sha256 = "1afmja4cffyw0ipx7zm93wvjmz0v5ccl7vcw2r18kdzrs1mr99zl";
   };
 
   buildInputs = [ hackrf rtl-sdr ];
diff --git a/pkgs/applications/networking/sniffers/wireshark/default.nix b/pkgs/applications/networking/sniffers/wireshark/default.nix
index 867768d9f9f..f145d55daf3 100644
--- a/pkgs/applications/networking/sniffers/wireshark/default.nix
+++ b/pkgs/applications/networking/sniffers/wireshark/default.nix
@@ -12,7 +12,7 @@ assert withQt  -> !withGtk && qt5  != null;
 with stdenv.lib;
 
 let
-  version = "2.6.2";
+  version = "2.6.3";
   variant = if withGtk then "gtk" else if withQt then "qt" else "cli";
 
 in stdenv.mkDerivation {
@@ -20,7 +20,7 @@ in stdenv.mkDerivation {
 
   src = fetchurl {
     url = "https://www.wireshark.org/download/src/all-versions/wireshark-${version}.tar.xz";
-    sha256 = "153h6prxamv5a62f3pfadkry0y57696xrgxfy2gfy5xswdg8kcj9";
+    sha256 = "1v538h02y8avwy3cr11xz6wkyf9xd8qva4ng4sl9f2fw4skahn6i";
   };
 
   cmakeFlags = [
diff --git a/pkgs/applications/version-management/gogs/default.nix b/pkgs/applications/version-management/gogs/default.nix
index d3c248b4475..25f7be37e1e 100644
--- a/pkgs/applications/version-management/gogs/default.nix
+++ b/pkgs/applications/version-management/gogs/default.nix
@@ -7,13 +7,13 @@ with stdenv.lib;
 
 buildGoPackage rec {
   name = "gogs-${version}";
-  version = "0.11.34";
+  version = "0.11.53";
 
   src = fetchFromGitHub {
-    owner = "gogits";
+    owner = "gogs";
     repo = "gogs";
     rev = "v${version}";
-    sha256 = "15xwcw3k7wbahdgp796gly79qkka21p7kvm84zfjgcsjjri0kdnz";
+    sha256 = "1icm4bawyic4ivzyspqc6qjv882gil8j923zrbylw3i4ifhlcdhd";
   };
 
   patches = [ ./static-root-path.patch ];
@@ -37,7 +37,7 @@ buildGoPackage rec {
       --prefix PATH : ${makeBinPath [ bash git gzip openssh ]}
   '';
 
-  goPackagePath = "github.com/gogits/gogs";
+  goPackagePath = "github.com/gogs/gogs";
 
   meta = {
     description = "A painless self-hosted Git service";
diff --git a/pkgs/applications/window-managers/weston/default.nix b/pkgs/applications/window-managers/weston/default.nix
index d967f55b81c..541c7b539bb 100644
--- a/pkgs/applications/window-managers/weston/default.nix
+++ b/pkgs/applications/window-managers/weston/default.nix
@@ -7,11 +7,11 @@
 
 stdenv.mkDerivation rec {
   name = "weston-${version}";
-  version = "4.0.0";
+  version = "5.0.0";
 
   src = fetchurl {
     url = "https://wayland.freedesktop.org/releases/${name}.tar.xz";
-    sha256 = "0n2big8xw6g6n46zm1jyf00dv9r4d84visdz5b8vxpw3xzkhmz50";
+    sha256 = "1bsc9ry566mpk6fdwkqpvwq2j7m79d9cvh7d3lgf6igsphik98hm";
   };
 
   nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/data/misc/nixos-artwork/grub2-theme.nix b/pkgs/data/misc/nixos-artwork/grub2-theme.nix
new file mode 100644
index 00000000000..8bc6c8adc13
--- /dev/null
+++ b/pkgs/data/misc/nixos-artwork/grub2-theme.nix
@@ -0,0 +1,5 @@
+{fetchzip}:
+fetchzip {
+  url = https://github.com/NixOS/nixos-artwork/releases/download/bootloader-18.09-pre/grub2-installer.tar.bz2;
+  sha256 = "0rhh061m1hpgadm7587inw3fxfacnd53xjc53w3vzghlck56djq5";
+}
diff --git a/pkgs/desktops/enlightenment/enlightenment.nix b/pkgs/desktops/enlightenment/enlightenment.nix
index 9119d5e93d8..8edf702a24c 100644
--- a/pkgs/desktops/enlightenment/enlightenment.nix
+++ b/pkgs/desktops/enlightenment/enlightenment.nix
@@ -6,11 +6,11 @@
 
 stdenv.mkDerivation rec {
   name = "enlightenment-${version}";
-  version = "0.22.3";
+  version = "0.22.4";
 
   src = fetchurl {
     url = "http://download.enlightenment.org/rel/apps/enlightenment/${name}.tar.xz";
-    sha256 = "16zydv7z94aw3rywmb9gr8ya85k7b75h22wng95lfx1x0y1yb0ad";
+    sha256 = "0ygy891rrw5c7lhk539nhif77j88phvz2h0fhx172iaridy9kx2r";
   };
 
   nativeBuildInputs = [
@@ -57,16 +57,6 @@ stdenv.mkDerivation rec {
   ];
 
   postPatch = ''
-    # In order to get the available keyboard layouts Enlightenment looks for
-    # the file xorg.lst, that should be provided by xkeyboard-config (when
-    # configured with option --with-xkb-rules-symlink=xorg). Currently
-    # xkeyboard-config is not configured with this option in
-    # NixOS. Therefore it is needed to add base.lst (which xorg.lst would be
-    # a symbolic link to) explicitly as an alternative.
-
-    sed "/#ifdef XKB_BASE/a XKB_BASE \"\/rules\/base.lst\"," \
-      -i src/modules/wizard/page_011.c src/modules/xkbswitch/e_mod_parse.c
-
     # edge_cc is a binary provided by efl and cannot be found at the directory
     # given by e_prefix_bin_get(), which is $out/bin
 
diff --git a/pkgs/desktops/gnome-3/apps/file-roller/default.nix b/pkgs/desktops/gnome-3/apps/file-roller/default.nix
index 45aab553c41..42f0ddc6e4b 100644
--- a/pkgs/desktops/gnome-3/apps/file-roller/default.nix
+++ b/pkgs/desktops/gnome-3/apps/file-roller/default.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ glib gtk json-glib libarchive file gnome3.defaultIconTheme libnotify nautilus ];
 
-  PKG_CONFIG_LIBNAUTILUS_EXTENSION_EXTENSIONDIR = "lib/nautilus/extensions-3.0";
+  PKG_CONFIG_LIBNAUTILUS_EXTENSION_EXTENSIONDIR = "${placeholder "out"}/lib/nautilus/extensions-3.0";
 
   postPatch = ''
     chmod +x postinstall.py # patchShebangs requires executable file
diff --git a/pkgs/desktops/gnome-3/apps/gnome-characters/default.nix b/pkgs/desktops/gnome-3/apps/gnome-characters/default.nix
index b5525957d46..92ce0eb8deb 100644
--- a/pkgs/desktops/gnome-3/apps/gnome-characters/default.nix
+++ b/pkgs/desktops/gnome-3/apps/gnome-characters/default.nix
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ glib gtk3 gjs pango gnome3.gsettings-desktop-schemas gnome3.defaultIconTheme libunistring ];
 
   mesonFlags = [
-    "-Ddbus_service_dir=share/dbus-1/services"
+    "-Ddbus_service_dir=${placeholder "out"}/share/dbus-1/services"
   ];
 
   meta = with stdenv.lib; {
diff --git a/pkgs/desktops/gnome-3/core/evolution-data-server/default.nix b/pkgs/desktops/gnome-3/core/evolution-data-server/default.nix
index 842ad663422..c355c9bbce6 100644
--- a/pkgs/desktops/gnome-3/core/evolution-data-server/default.nix
+++ b/pkgs/desktops/gnome-3/core/evolution-data-server/default.nix
@@ -37,11 +37,9 @@ stdenv.mkDerivation rec {
     "-DENABLE_VALA_BINDINGS=ON"
     "-DENABLE_INTROSPECTION=ON"
     "-DCMAKE_SKIP_BUILD_RPATH=OFF"
+    "-DINCLUDE_INSTALL_DIR=${placeholder "dev"}/include"
   ];
 
-  postPatch = ''
-    cmakeFlags="-DINCLUDE_INSTALL_DIR=$dev/include $cmakeFlags"
-  '';
 
   passthru = {
     updateScript = gnome3.updateScript {
diff --git a/pkgs/desktops/gnome-3/core/gnome-settings-daemon/default.nix b/pkgs/desktops/gnome-3/core/gnome-settings-daemon/default.nix
index cfb41c01e6a..bfaf430d593 100644
--- a/pkgs/desktops/gnome-3/core/gnome-settings-daemon/default.nix
+++ b/pkgs/desktops/gnome-3/core/gnome-settings-daemon/default.nix
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
   ];
 
   mesonFlags = [
-    "-Dudev_dir=lib/udev"
+    "-Dudev_dir=${placeholder "out"}/lib/udev"
   ];
 
   postPatch = ''
diff --git a/pkgs/desktops/gnome-3/core/libgee/default.nix b/pkgs/desktops/gnome-3/core/libgee/default.nix
index a5ce9ee5e10..a65d0f401f0 100644
--- a/pkgs/desktops/gnome-3/core/libgee/default.nix
+++ b/pkgs/desktops/gnome-3/core/libgee/default.nix
@@ -6,6 +6,8 @@ in
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
 
+  outputs = [ "out" "dev" ];
+
   src = fetchurl {
     url = "mirror://gnome/sources/${pname}/${gnome3.versionBranch version}/${name}.tar.xz";
     sha256 = "0c26x8gi3ivmhlbqcmiag4jwrkvcy28ld24j55nqr3jikb904a5v";
@@ -13,11 +15,12 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  patches = [ ./fix_introspection_paths.patch ];
-
   nativeBuildInputs = [ pkgconfig autoconf vala gobjectIntrospection ];
   buildInputs = [ glib ];
 
+  PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_GIRDIR = "${placeholder "dev"}/share/gir-1.0";
+  PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_TYPELIBDIR = "${placeholder "out"}/lib/girepository-1.0";
+
   passthru = {
     updateScript = gnome3.updateScript {
       packageName = pname;
diff --git a/pkgs/desktops/gnome-3/core/libgee/fix_introspection_paths.patch b/pkgs/desktops/gnome-3/core/libgee/fix_introspection_paths.patch
deleted file mode 100644
index 67003f45164..00000000000
--- a/pkgs/desktops/gnome-3/core/libgee/fix_introspection_paths.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- fix_introspection_paths.patch/configure	2014-01-07 17:43:53.521339338 +0000
-+++ fix_introspection_paths.patch/configure-fix	2014-01-07 17:45:11.068635069 +0000
-@@ -12085,8 +12085,8 @@
-        INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
-        INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
-        INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
--       INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
--       INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
-+       INTROSPECTION_GIRDIR="${datadir}/gir-1.0"
-+       INTROSPECTION_TYPELIBDIR="${libdir}/girepository-1.0"
-        INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
-        INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
-        INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
diff --git a/pkgs/desktops/gnome-3/core/totem/default.nix b/pkgs/desktops/gnome-3/core/totem/default.nix
index b8197ccf83c..50e060c13c3 100644
--- a/pkgs/desktops/gnome-3/core/totem/default.nix
+++ b/pkgs/desktops/gnome-3/core/totem/default.nix
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
   '';
 
   mesonFlags = [
-    "-Dwith-nautilusdir=lib/nautilus/extensions-3.0"
+    "-Dwith-nautilusdir=${placeholder "out"}/lib/nautilus/extensions-3.0"
     # https://bugs.launchpad.net/ubuntu/+source/totem/+bug/1712021
     # https://bugzilla.gnome.org/show_bug.cgi?id=784236
     # https://github.com/mesonbuild/meson/issues/1994
diff --git a/pkgs/development/libraries/glib-networking/default.nix b/pkgs/development/libraries/glib-networking/default.nix
index e0bbae69c4f..3deaf28373d 100644
--- a/pkgs/development/libraries/glib-networking/default.nix
+++ b/pkgs/development/libraries/glib-networking/default.nix
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  PKG_CONFIG_GIO_2_0_GIOMODULEDIR = "lib/gio/modules";
+  PKG_CONFIG_GIO_2_0_GIOMODULEDIR = "${placeholder "out"}/lib/gio/modules";
 
   postPatch = ''
     chmod +x meson_post_install.py # patchShebangs requires executable file
diff --git a/pkgs/development/libraries/gvfs/default.nix b/pkgs/development/libraries/gvfs/default.nix
index 86cbd01a602..360c1fb41f4 100644
--- a/pkgs/development/libraries/gvfs/default.nix
+++ b/pkgs/development/libraries/gvfs/default.nix
@@ -63,9 +63,9 @@ stdenv.mkDerivation rec {
 
   # Uncomment when switching back to meson
   # mesonFlags = [
-  #   "-Dgio_module_dir=lib/gio/modules"
-  #   "-Dsystemduserunitdir=lib/systemd/user"
-  #   "-Ddbus_service_dir=share/dbus-1/services"
+  #   "-Dgio_module_dir=${placeholder "out"}/lib/gio/modules"
+  #   "-Dsystemduserunitdir=${placeholder "out"}/lib/systemd/user"
+  #   "-Ddbus_service_dir=${placeholder "out"}/share/dbus-1/services"
   #   "-Dtmpfilesdir=no"
   # ] ++ stdenv.lib.optionals (!gnomeSupport) [
   #   "-Dgcr=false" "-Dgoa=false" "-Dkeyring=false" "-Dhttp=false"
diff --git a/pkgs/development/libraries/libfm/default.nix b/pkgs/development/libraries/libfm/default.nix
index ce1d3b138f8..796c03dab5e 100644
--- a/pkgs/development/libraries/libfm/default.nix
+++ b/pkgs/development/libraries/libfm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, glib, intltool, menu-cache, pango, pkgconfig, vala_0_34
+{ stdenv, fetchurl, glib, intltool, menu-cache, pango, pkgconfig, vala
 , extraOnly ? false
 , withGtk3 ? false, gtk2, gtk3 }:
 let
@@ -16,12 +16,11 @@ stdenv.mkDerivation rec {
     sha256 = "0wkwbi1nyvqza3r1dhrq846axiiq0fy0dqgngnagh76fjrwnzl0q";
   };
 
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ glib gtk intltool pango vala_0_34 ]
-                ++ optional (!extraOnly) menu-cache;
+  nativeBuildInputs = [ vala pkgconfig intltool ];
+  buildInputs = [ glib gtk pango ] ++ optional (!extraOnly) menu-cache;
 
-  configureFlags = [ (optional extraOnly "--with-extra-only")
-                     (optional withGtk3 "--with-gtk=3") ];
+  configureFlags = optional extraOnly "--with-extra-only"
+    ++ optional withGtk3 "--with-gtk=3";
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/libwnck/3.x.nix b/pkgs/development/libraries/libwnck/3.x.nix
index 8efd908584e..f2d05d14d69 100644
--- a/pkgs/development/libraries/libwnck/3.x.nix
+++ b/pkgs/development/libraries/libwnck/3.x.nix
@@ -19,8 +19,8 @@ in stdenv.mkDerivation rec{
   nativeBuildInputs = [ pkgconfig intltool gobjectIntrospection ];
   propagatedBuildInputs = [ libX11 gtk3 ];
 
-  PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_GIRDIR = "$(dev)/share/gir-1.0";
-  PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_TYPELIBDIR = "$(out)/lib/girepository-1.0";
+  PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_GIRDIR = "${placeholder "dev"}/share/gir-1.0";
+  PKG_CONFIG_GOBJECT_INTROSPECTION_1_0_TYPELIBDIR = "${placeholder "out"}/lib/girepository-1.0";
 
   passthru = {
     updateScript = gnome3.updateScript {
diff --git a/pkgs/development/libraries/pipewire/default.nix b/pkgs/development/libraries/pipewire/default.nix
index c50fc9fb35c..e87ed8e48a9 100644
--- a/pkgs/development/libraries/pipewire/default.nix
+++ b/pkgs/development/libraries/pipewire/default.nix
@@ -34,7 +34,7 @@ in stdenv.mkDerivation rec {
     "-Denable_gstreamer=true"
   ];
 
-  PKG_CONFIG_SYSTEMD_SYSTEMDUSERUNITDIR = "lib/systemd/user";
+  PKG_CONFIG_SYSTEMD_SYSTEMDUSERUNITDIR = "${placeholder "out"}/lib/systemd/user";
 
   FONTCONFIG_FILE = fontsConf; # Fontconfig error: Cannot load default config file
 
diff --git a/pkgs/development/libraries/science/math/sympow/default.nix b/pkgs/development/libraries/science/math/sympow/default.nix
index c34701e3f91..f421755b618 100644
--- a/pkgs/development/libraries/science/math/sympow/default.nix
+++ b/pkgs/development/libraries/science/math/sympow/default.nix
@@ -34,13 +34,11 @@ stdenv.mkDerivation rec {
     makeWrapper "$out/share/sympow/sympow" "$out/bin/sympow" \
       --run 'export SYMPOW_LOCAL="$HOME/.local/share/sympow"' \
       --run 'if [ ! -d "$SYMPOW_LOCAL" ]; then
-        mkdir -p "$SYMPOW_LOCAL"
-        cp -r @out@/share/sympow/* "$SYMPOW_LOCAL"
+        mkdir -p "$SYMPOW_LOCAL" 
+        cp -r ${placeholder "out"}/share/sympow/* "$SYMPOW_LOCAL"
         chmod -R +xw "$SYMPOW_LOCAL"
     fi' \
       --run 'cd "$SYMPOW_LOCAL"'
-    substituteInPlace $out/bin/sympow --subst-var out
-
     runHook postInstall
   '';
 
diff --git a/pkgs/development/libraries/spice-gtk/default.nix b/pkgs/development/libraries/spice-gtk/default.nix
index f4f10978ec1..f5258c1cd6d 100644
--- a/pkgs/development/libraries/spice-gtk/default.nix
+++ b/pkgs/development/libraries/spice-gtk/default.nix
@@ -52,7 +52,7 @@ in stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkgconfig gettext libsoup autoreconfHook vala gobjectIntrospection ];
 
-  PKG_CONFIG_POLKIT_GOBJECT_1_POLICYDIR = "$(out)/share/polkit-1/actions";
+  PKG_CONFIG_POLKIT_GOBJECT_1_POLICYDIR = "${placeholder "out"}/share/polkit-1/actions";
 
   configureFlags = [
     "--with-gtk3"
diff --git a/pkgs/development/libraries/umockdev/default.nix b/pkgs/development/libraries/umockdev/default.nix
index b89450b810b..912bcac55cd 100644
--- a/pkgs/development/libraries/umockdev/default.nix
+++ b/pkgs/development/libraries/umockdev/default.nix
@@ -3,7 +3,7 @@
 
 stdenv.mkDerivation rec {
   name = "umockdev-${version}";
-  version = "0.11.3";
+  version = "0.12";
 
   outputs = [ "bin" "out" "dev" "doc" ];
 
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     owner  = "martinpitt";
     repo   = "umockdev";
     rev    = version;
-    sha256 = "1z101yw7clxz39im3y435s3rj1gna3kp0fkj9wd62vxqvk68lhik";
+    sha256 = "1j7kkxpqs991w3qdlb779gzv38l1vpnlk3laabi2ndk83j1wl5k2";
   };
 
   # autoreconfHook complains if we try to build the documentation
diff --git a/pkgs/development/python-modules/backports_lzma/default.nix b/pkgs/development/python-modules/backports_lzma/default.nix
index 409546e559a..82025df8b9e 100644
--- a/pkgs/development/python-modules/backports_lzma/default.nix
+++ b/pkgs/development/python-modules/backports_lzma/default.nix
@@ -20,9 +20,8 @@ if !(pythonOlder "3.3") then null else buildPythonPackage rec {
 
   buildInputs = [ lzma ];
 
-  # Needs the compiled module in $out
   checkPhase = ''
-    PYTHONPATH=$out/${python.sitePackages}:$PYTHONPATH ${python.interpreter} -m unittest discover -s test
+    ${python.interpreter} test/test_lzma.py
   '';
 
   # Relative import does not seem to function.
@@ -33,4 +32,4 @@ if !(pythonOlder "3.3") then null else buildPythonPackage rec {
     homepage = https://github.com/peterjc/backports.lzma;
     license = lib.licenses.bsd3;
   };
-}
\ No newline at end of file
+}
diff --git a/pkgs/development/python-modules/docker-registry-core/default.nix b/pkgs/development/python-modules/docker-registry-core/default.nix
deleted file mode 100644
index ad9968af173..00000000000
--- a/pkgs/development/python-modules/docker-registry-core/default.nix
+++ /dev/null
@@ -1,26 +0,0 @@
-{ stdenv, buildPythonPackage, fetchPypi, isPy3k
-, boto, redis, setuptools, simplejson }:
-
-buildPythonPackage rec {
-  pname = "docker-registry-core";
-  version = "2.0.3";
-  disabled = isPy3k;
-
-  src = fetchPypi {
-    inherit pname version;
-    sha256 = "0q036rr0b5734szkj883hkb2kjhgcc5pm3dz4yz8vcim3x7q0zil";
-  };
-
-  DEPS = "loose";
-
-  doCheck = false;
-  propagatedBuildInputs = [ boto redis setuptools simplejson ];
-
-  patchPhase = "> requirements/main.txt";
-
-  meta = with stdenv.lib; {
-    description = "Docker registry core package";
-    homepage = https://github.com/docker/docker-registry;
-    license = licenses.asl20;
-  };
-}
diff --git a/pkgs/development/python-modules/plotly/default.nix b/pkgs/development/python-modules/plotly/default.nix
index 79648c8104b..30293e9798b 100644
--- a/pkgs/development/python-modules/plotly/default.nix
+++ b/pkgs/development/python-modules/plotly/default.nix
@@ -5,6 +5,7 @@
 , nbformat
 , pytz
 , requests
+, retrying
 , six
 }:
 
@@ -22,6 +23,7 @@ buildPythonPackage rec {
     nbformat
     pytz
     requests
+    retrying
     six
   ];
 
diff --git a/pkgs/development/python-modules/pytorch/default.nix b/pkgs/development/python-modules/pytorch/default.nix
index 962ebbecbaa..d31719efa17 100644
--- a/pkgs/development/python-modules/pytorch/default.nix
+++ b/pkgs/development/python-modules/pytorch/default.nix
@@ -25,7 +25,7 @@ let
     "LD_LIBRARY_PATH=${cudaStub}\${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} ";
 
 in buildPythonPackage rec {
-  version = "0.4.0";
+  version = "0.4.1";
   pname = "pytorch";
 
   src = fetchFromGitHub {
@@ -33,7 +33,7 @@ in buildPythonPackage rec {
     repo   = "pytorch";
     rev    = "v${version}";
     fetchSubmodules = true;
-    sha256 = "12d5vqqaprk0igmih7fwa65ldmaawgijxl58h6dnw660wysc132j";
+    sha256 = "1cr8h47jxgfar5bamyvlayvqymnb2qvp7rr0ka2d2d4rdldf9lrp";
   };
 
   preConfigure = lib.optionalString cudaSupport ''
@@ -56,7 +56,7 @@ in buildPythonPackage rec {
   ] ++ lib.optional (pythonOlder "3.5") typing;
 
   checkPhase = ''
-    ${cudaStubEnv}python test/run_test.py --exclude distributed
+    ${cudaStubEnv}python test/run_test.py --exclude distributed autograd distributions jit sparse torch utils nn
   '';
 
   meta = {
diff --git a/pkgs/development/python-modules/pywatchman/default.nix b/pkgs/development/python-modules/pywatchman/default.nix
new file mode 100644
index 00000000000..40aaea9c01a
--- /dev/null
+++ b/pkgs/development/python-modules/pywatchman/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, buildPythonPackage, fetchPypi, watchman }:
+
+buildPythonPackage rec {
+  pname = "pywatchman";
+  version = "1.4.1";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1yf2gm20wc3djpb5larxii3l55xxby0il2ns3q0v1byyfnr7w16h";
+  };
+
+  postPatch = ''
+    substituteInPlace pywatchman/__init__.py \
+      --replace "'watchman'" "'${watchman}/bin/watchman'"
+  '';
+
+  # No tests in archive
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Watchman client for Python";
+    homepage = https://facebook.github.io/watchman/;
+    license = licenses.bsd3;
+  };
+
+}
diff --git a/pkgs/development/tools/corgi/default.nix b/pkgs/development/tools/corgi/default.nix
new file mode 100644
index 00000000000..94596ab68af
--- /dev/null
+++ b/pkgs/development/tools/corgi/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, buildGoPackage, fetchFromGitHub }:
+
+buildGoPackage rec {
+  name = "corgi-${rev}";
+  rev = "v0.2.3";
+
+  goPackagePath = "github.com/DrakeW/corgi";
+
+  src = fetchFromGitHub {
+    owner = "DrakeW";
+    repo = "corgi";
+    inherit rev;
+    sha256 = "0ahwpyd6dac04qw2ak51xfbwkr42sab1gkhh52i7hlcy12jpwl8q";
+  };
+
+  goDeps = ./deps.nix;
+
+  meta = with stdenv.lib; {
+    description = "CLI workflow manager";
+    longDescription = ''
+      Corgi is a command-line tool that helps with your repetitive command usages by organizing them into reusable snippet.
+    '';
+    homepage = https://github.com/DrakeW/corgi;
+    license = licenses.mit;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ kalbasit ];
+  };
+}
diff --git a/pkgs/development/tools/corgi/deps.nix b/pkgs/development/tools/corgi/deps.nix
new file mode 100644
index 00000000000..d48b141627c
--- /dev/null
+++ b/pkgs/development/tools/corgi/deps.nix
@@ -0,0 +1,47 @@
+[
+  {
+    goPackagePath = "github.com/chzyer/readline";
+    fetch = {
+      type = "git";
+      url = "https://github.com/chzyer/readline";
+      rev = "2972be24d48e78746da79ba8e24e8b488c9880de";
+      sha256 = "104q8dazj8yf6b089jjr82fy9h1g80zyyzvp3g8b44a7d8ngjj6r";
+    };
+  }
+  {
+    goPackagePath = "github.com/fatih/color";
+    fetch = {
+      type = "git";
+      url = "https://github.com/fatih/color";
+      rev = "2d684516a8861da43017284349b7e303e809ac21";
+      sha256 = "1fcfmz4wji3gqmmsdx493r7d101s58hwjalqps6hy25nva5pvmfs";
+    };
+  }
+  {
+    goPackagePath = "github.com/mitchellh/go-homedir";
+    fetch = {
+      type = "git";
+      url = "https://github.com/mitchellh/go-homedir";
+      rev = "ae18d6b8b3205b561c79e8e5f69bff09736185f4";
+      sha256 = "0f0z0aa4wivk4z1y503dmnw0k0g0g403dly8i4q263gfshs82sbq";
+    };
+  }
+  {
+    goPackagePath = "github.com/spf13/cobra";
+    fetch = {
+      type = "git";
+      url = "https://github.com/spf13/cobra";
+      rev = "99dc123558852f67743bd0b2caf8383cb3c6d720";
+      sha256 = "0b2rjgycgpkpvpsqgvilqkr66bfk477lyd6l0jxmgxb1h0za5s25";
+    };
+  }
+  {
+    goPackagePath = "github.com/spf13/pflag";
+    fetch = {
+      type = "git";
+      url = "https://github.com/spf13/pflag";
+      rev = "d929dcbb10863323c436af3cf76cb16a6dfc9b29";
+      sha256 = "1qjmqvszs9cmic7brm7pknq86zjra4hq923bn88blfvr3bap5bc4";
+    };
+  }
+]
diff --git a/pkgs/development/tools/kythe/default.nix b/pkgs/development/tools/kythe/default.nix
new file mode 100644
index 00000000000..5aae1d4f3be
--- /dev/null
+++ b/pkgs/development/tools/kythe/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, binutils , fetchurl, glibc }:
+
+stdenv.mkDerivation rec {
+  version = "0.0.28";
+  name = "kythe-${version}";
+
+  src = fetchurl {
+    url = "https://github.com/google/kythe/releases/download/v0.0.28/kythe-v0.0.28.tar.gz";
+    sha256 = "1qc7cngpxw66m3krpr5x50ns7gb3bpv2bdfzpb5afl12qp0mi6zm";
+  };
+
+  buildInputs =
+    [ binutils ];
+
+  doCheck = false;
+
+  dontBuild = true;
+
+  installPhase = ''
+    cd tools
+    for exe in http_server \
+                kythe read_entries triples verifier \
+                write_entries write_tables; do
+      echo "Patching:" $exe
+      patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $exe
+      patchelf --set-rpath "${stdenv.cc.cc.lib}/lib64" $exe
+    done
+    cd ../
+    cp -R ./ $out
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A pluggable, (mostly) language-agnostic ecosystem for building tools that work with code.";
+    longDescription = ''
+    The Kythe project was founded to provide and support tools and standards
+      that encourage interoperability among programs that manipulate source
+      code. At a high level, the main goal of Kythe is to provide a standard,
+      language-agnostic interchange mechanism, allowing tools that operate on
+      source code — including build systems, compilers, interpreters, static
+      analyses, editors, code-review applications, and more — to share
+      information with each other smoothly.  '';
+    homepage = https://kythe.io/;
+    license = licenses.asl20;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.mpickering ];
+  };
+}
diff --git a/pkgs/development/tools/rust/bindgen/default.nix b/pkgs/development/tools/rust/bindgen/default.nix
index aeeae494e58..68df0af6ee4 100644
--- a/pkgs/development/tools/rust/bindgen/default.nix
+++ b/pkgs/development/tools/rust/bindgen/default.nix
@@ -1,6 +1,4 @@
-{ stdenv, fetchFromGitHub, rustPlatform, makeWrapper, llvmPackages }:
-
-# Future work: Automatically communicate NIX_CFLAGS_COMPILE to bindgen's tests and the bindgen executable itself.
+{ stdenv, fetchFromGitHub, fetchpatch, rustPlatform, clang, llvmPackages, rustfmt, writeScriptBin }:
 
 rustPlatform.buildRustPackage rec {
   name = "rust-bindgen-${version}";
@@ -13,23 +11,54 @@ rustPlatform.buildRustPackage rec {
     sha256 = "0cqjr7qspjrfgqcp4nqxljmhhbqyijb2jpw3lajgjj48y6wrnw93";
   };
 
-  nativeBuildInputs = [ makeWrapper ];
-  buildInputs = [ llvmPackages.clang-unwrapped.lib ];
+  cargoSha256 = "0b8v6c7q1abibzygrigldpd31lyd5ngmj4vq5d7zni96m20mm85w";
+
+  libclang = llvmPackages.libclang.lib; #for substituteAll
+
+  buildInputs = [ libclang ];
+
+  propagatedBuildInputs = [ clang ]; # to populate NIX_CXXSTDLIB_COMPILE
+
+  patches = [
+    # https://github.com/rust-lang-nursery/rust-bindgen/pull/1376
+    (fetchpatch {
+      url = https://github.com/rust-lang-nursery/rust-bindgen/commit/c8b5406f08af82a92bf8faf852c21ba941d9c176.patch;
+      sha256 = "16ibr2rplh0qz8rsq6gir45xlz5nasad4y8fprwhrb7ssv8wfkss";
+    })
+  ];
 
   configurePhase = ''
-    export LIBCLANG_PATH="${llvmPackages.clang-unwrapped.lib}/lib"
+    export LIBCLANG_PATH="${libclang}/lib"
   '';
 
   postInstall = ''
-    wrapProgram $out/bin/bindgen --set LIBCLANG_PATH "${llvmPackages.clang-unwrapped.lib}/lib"
+    mv $out/bin/{bindgen,.bindgen-wrapped};
+    substituteAll ${./wrapper.sh} $out/bin/bindgen
+    chmod +x $out/bin/bindgen
   '';
 
-  cargoSha256 = "0b8v6c7q1abibzygrigldpd31lyd5ngmj4vq5d7zni96m20mm85w";
-
-  doCheck = false; # A test fails because it can't find standard headers in NixOS
+  doCheck = false; # half the tests fail because our rustfmt is not nightly enough
+  checkInputs =
+    let fakeRustup = writeScriptBin "rustup" ''
+      #!${stdenv.shell}
+      shift
+      shift
+      exec "$@"
+    '';
+  in [
+    rustfmt
+    fakeRustup # the test suite insists in calling `rustup run nightly rustfmt`
+    clang
+  ];
 
   meta = with stdenv.lib; {
     description = "C and C++ binding generator";
+    longDescription = ''
+      Bindgen takes a c or c++ header file and turns them into
+      rust ffi declarations.
+      As with most compiler related software, this will only work
+      inside a nix-shell with the required libraries as buildInputs.
+    '';
     homepage = https://github.com/rust-lang-nursery/rust-bindgen;
     license = with licenses; [ bsd3 ];
     maintainers = [ maintainers.ralith ];
diff --git a/pkgs/development/tools/rust/bindgen/wrapper.sh b/pkgs/development/tools/rust/bindgen/wrapper.sh
new file mode 100755
index 00000000000..95cd0901cec
--- /dev/null
+++ b/pkgs/development/tools/rust/bindgen/wrapper.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+sep='--'   # whether to add -- before new options
+cxx=0      # whether cxx was explicitly requested
+lastWasx=0 # whether the last argument passed was -x
+for e in "$@"; do
+  if [[ "$e" == "--" ]]; then
+    sep=
+  fi;
+  if [[ "$sep" == "" ]]; then
+    # we look for -x c++ after -- only
+    if [[ "$e" == "-x" ]]; then
+      lastWasx=1
+    fi;
+    if [[ $lastWasx -eq 1 && "$e" == "c++" ]]; then
+      lastWasx=0
+      cxx=1
+    fi;
+    if [[ "$e" == "-xc++" || "$e" == -std=c++* ]]; then
+      cxx=1
+    fi;
+  fi;
+done;
+cxxflags=
+if [[ $cxx -eq 1 ]]; then
+  cxxflags=$NIX_CXXSTDLIB_COMPILE
+fi;
+if [[ -n "$NIX_DEBUG" ]]; then
+  set -x;
+fi;
+export LIBCLANG_PATH="@libclang@/lib"
+# shellcheck disable=SC2086
+# cxxflags and NIX_CFLAGS_COMPILE should be word-split
+exec -a "$0" @out@/bin/.bindgen-wrapped "$@" $sep $cxxflags $NIX_CFLAGS_COMPILE
+# note that we add the flags after $@ which is incorrect. This is only for the sake
+# of simplicity.
+
diff --git a/pkgs/misc/emulators/wine/sources.nix b/pkgs/misc/emulators/wine/sources.nix
index a6b59fc4aca..1a257518e72 100644
--- a/pkgs/misc/emulators/wine/sources.nix
+++ b/pkgs/misc/emulators/wine/sources.nix
@@ -39,16 +39,16 @@ in rec {
 
   unstable = fetchurl rec {
     # NOTE: Don't forget to change the SHA256 for staging as well.
-    version = "3.13";
+    version = "3.14";
     url = "https://dl.winehq.org/wine/source/3.x/wine-${version}.tar.xz";
-    sha256 = "1m5v854r5wgw68b97j6wim1a8692x5sih25c0xp1yb13a94dg187";
+    sha256 = "01dhn3a6k3dwnrbz4bxvszhh5sxwy6s89y459g805hjmq8s6d2a7";
     inherit (stable) mono gecko32 gecko64;
   };
 
   staging = fetchFromGitHub rec {
     # https://github.com/wine-compholio/wine-staging/releases
     inherit (unstable) version;
-    sha256 = "0996gsiqawp24dq8qpff2cpqm8w9d0pxf537bgdbhjncn88xjwhr";
+    sha256 = "0h6gck0p92hin0m13q1hnlfnqs4vy474w66ppinvqms2zn3vibgi";
     owner = "wine-staging";
     repo = "wine-staging";
     rev = "v${version}";
diff --git a/pkgs/misc/vim-plugins/default.nix b/pkgs/misc/vim-plugins/default.nix
index f32c1795409..d251b2da45c 100644
--- a/pkgs/misc/vim-plugins/default.nix
+++ b/pkgs/misc/vim-plugins/default.nix
@@ -1004,7 +1004,7 @@ self = rec {
       sha256 = "03sr53680kcwxaa5xbqzdfbsgday3bkzja33wym49w9gjmlaa320";
     };
     dependencies = ["vimproc" "vimshell" "self" "forms"];
-    pythonDependencies = with pythonPackages; [ sexpdata websocket_client ];
+    passthru.python3Dependencies = ps: with ps; [ sexpdata websocket_client ];
   };
 
   supertab = buildVimPluginFrom2Nix { # created by nix#NixDerivation
diff --git a/pkgs/misc/vim-plugins/vim-utils.nix b/pkgs/misc/vim-plugins/vim-utils.nix
index 514c1daed62..bae1645563f 100644
--- a/pkgs/misc/vim-plugins/vim-utils.nix
+++ b/pkgs/misc/vim-plugins/vim-utils.nix
@@ -280,6 +280,7 @@ let
             installPhase = lib.concatStringsSep
                              "\n"
                              (lib.flatten (lib.mapAttrsToList packageLinks packages));
+            preferLocalBuild = true;
           }
         );
       in
@@ -423,6 +424,7 @@ rec {
   } // a);
 
   requiredPlugins = {
+    packages ? {},
     givenKnownPlugins ? null,
     vam ? null,
     pathogen ? null, ...
@@ -437,8 +439,12 @@ rec {
       vamNames = findDependenciesRecursively { inherit knownPlugins; names = lib.concatMap toNames vam.pluginDictionaries; };
       names = (lib.optionals (pathogen != null) pathogenNames) ++
               (lib.optionals (vam != null) vamNames);
+      nonNativePlugins = map (name: knownPlugins.${name}) names;
+      nativePluginsConfigs = lib.attrsets.attrValues packages;
+      nativePlugins = lib.concatMap ({start?[], opt?[]}: start++opt) nativePluginsConfigs;
     in
-      map (name: knownPlugins.${name}) names;
+      nativePlugins ++ nonNativePlugins;
+
 
   # test cases:
   test_vim_with_vim_addon_nix_using_vam = vim_configurable.customize {
diff --git a/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/ensime-vim b/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/ensime-vim
index 7d6267e9515..e065e0db4f4 100644
--- a/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/ensime-vim
+++ b/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/ensime-vim
@@ -1 +1 @@
-    pythonDependencies = with pythonPackages; [ sexpdata websocket_client ];
+    passthru.python3Dependencies = ps: with ps; [ sexpdata websocket_client ];
diff --git a/pkgs/os-specific/linux/dbus-broker/default.nix b/pkgs/os-specific/linux/dbus-broker/default.nix
index 794ebd126fa..6582825d6f2 100644
--- a/pkgs/os-specific/linux/dbus-broker/default.nix
+++ b/pkgs/os-specific/linux/dbus-broker/default.nix
@@ -17,8 +17,8 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ dbus glib linuxHeaders systemd ];
 
-  PKG_CONFIG_SYSTEMD_SYSTEMDSYSTEMUNITDIR = "lib/systemd/system";
-  PKG_CONFIG_SYSTEMD_SYSTEMDUSERUNITDIR = "lib/systemd/user";
+  PKG_CONFIG_SYSTEMD_SYSTEMDSYSTEMUNITDIR = "${placeholder "out"}/lib/systemd/system";
+  PKG_CONFIG_SYSTEMD_SYSTEMDUSERUNITDIR = "${placeholder "out"}/lib/systemd/user";
 
   postInstall = ''
     install -Dm644 ../README $out/share/doc/dbus-broker/README
diff --git a/pkgs/os-specific/linux/dmidecode/default.nix b/pkgs/os-specific/linux/dmidecode/default.nix
index 65908fd18e2..0216e48d58f 100644
--- a/pkgs/os-specific/linux/dmidecode/default.nix
+++ b/pkgs/os-specific/linux/dmidecode/default.nix
@@ -13,6 +13,7 @@ stdenv.mkDerivation rec {
   meta = with stdenv.lib; {
     homepage = http://www.nongnu.org/dmidecode/;
     description = "A tool that reads information about your system's hardware from the BIOS according to the SMBIOS/DMI standard";
+    license = licenses.gpl2Plus;
     platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/drbd/default.nix b/pkgs/os-specific/linux/drbd/default.nix
index c6792ea17fb..5e990511eed 100644
--- a/pkgs/os-specific/linux/drbd/default.nix
+++ b/pkgs/os-specific/linux/drbd/default.nix
@@ -34,9 +34,10 @@ stdenv.mkDerivation rec {
 
   installFlags = "localstatedir=$(TMPDIR)/var sysconfdir=$(out)/etc INITDIR=$(out)/etc/init.d";
 
-  meta = {
+  meta = with stdenv.lib; {
     homepage = http://www.drbd.org/;
     description = "Distributed Replicated Block Device, a distributed storage system for Linux";
-    platforms = stdenv.lib.platforms.linux;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/ebtables/default.nix b/pkgs/os-specific/linux/ebtables/default.nix
index eec456ff5ad..9d92575b668 100644
--- a/pkgs/os-specific/linux/ebtables/default.nix
+++ b/pkgs/os-specific/linux/ebtables/default.nix
@@ -24,9 +24,10 @@ stdenv.mkDerivation rec {
 
   preInstall = "mkdir -p $out/etc/sysconfig";
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "A filtering tool for Linux-based bridging firewalls";
     homepage = http://ebtables.sourceforge.net/;
-    platforms = stdenv.lib.platforms.linux;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/fbterm/default.nix b/pkgs/os-specific/linux/fbterm/default.nix
index dd3eec6f53c..defb45d7a86 100644
--- a/pkgs/os-specific/linux/fbterm/default.nix
+++ b/pkgs/os-specific/linux/fbterm/default.nix
@@ -49,10 +49,12 @@ stdenv.mkDerivation {
     })
   ];
 
-  meta = {
+  meta = with stdenv.lib; {
     inherit (s) version;
     description = "Framebuffer terminal emulator";
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    homepage = https://code.google.com/archive/p/fbterm/;
+    maintainers = [ maintainers.raskin ];
+    license = licenses.gpl2;
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/gogoclient/default.nix b/pkgs/os-specific/linux/gogoclient/default.nix
index 53895faa66c..89afecbd9cc 100644
--- a/pkgs/os-specific/linux/gogoclient/default.nix
+++ b/pkgs/os-specific/linux/gogoclient/default.nix
@@ -34,10 +34,11 @@ stdenv.mkDerivation rec {
     sed -i -e 's/^.*Exec \$route -A.*$/& metric 128/' $out/template/linux.sh
   '';
 
-  meta = {
-    homepage = http://gogonet.gogo6.com;
+  meta = with stdenv.lib; {
+    homepage = https://ipv6.ernet.in/Tunnel_broker;
     description = "Client to connect to the Freenet6 IPv6 tunnel broker service";
-    maintainers = [stdenv.lib.maintainers.bluescreen303];
-    platforms = stdenv.lib.platforms.linux;
+    maintainers = [ maintainers.bluescreen303 ];
+    license = licenses.bsd3;
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/guvcview/default.nix b/pkgs/os-specific/linux/guvcview/default.nix
index c8146c39cf5..4b9c37686c1 100644
--- a/pkgs/os-specific/linux/guvcview/default.nix
+++ b/pkgs/os-specific/linux/guvcview/default.nix
@@ -27,10 +27,11 @@ stdenv.mkDerivation rec {
       gsl
     ] ++ stdenv.lib.optional pulseaudioSupport libpulseaudio;
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "A simple interface for devices supported by the linux UVC driver";
     homepage = http://guvcview.sourceforge.net;
-    maintainers = [ stdenv.lib.maintainers.coconnor ];
-    platforms = stdenv.lib.platforms.linux;
+    maintainers = [ maintainers.coconnor ];
+    license = licenses.gpl3;
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/iomelt/default.nix b/pkgs/os-specific/linux/iomelt/default.nix
index f57cfd713fb..932b8143898 100644
--- a/pkgs/os-specific/linux/iomelt/default.nix
+++ b/pkgs/os-specific/linux/iomelt/default.nix
@@ -20,6 +20,7 @@ in stdenv.mkDerivation {
     description = "A simple yet effective way to benchmark disk IO in Linux systems";
     homepage    = http://www.iomelt.com;
     maintainers = with maintainers; [ cstrahan ];
+    license = licenses.artistic2;
     platforms   = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/ipsec-tools/default.nix b/pkgs/os-specific/linux/ipsec-tools/default.nix
index dd7d25716dc..0aa074b4df8 100644
--- a/pkgs/os-specific/linux/ipsec-tools/default.nix
+++ b/pkgs/os-specific/linux/ipsec-tools/default.nix
@@ -42,9 +42,10 @@ stdenv.mkDerivation rec {
     "--enable-stats"
   ];
 
-  meta = {
+  meta = with stdenv.lib; {
     homepage = http://ipsec-tools.sourceforge.net/;
     description = "Port of KAME's IPsec utilities to the Linux-2.6 IPsec implementation";
-    platforms = stdenv.lib.platforms.linux;
+    license = licenses.bsd3;
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/os-specific/linux/iptables/default.nix b/pkgs/os-specific/linux/iptables/default.nix
index 9fa7a2cf0aa..84493421481 100644
--- a/pkgs/os-specific/linux/iptables/default.nix
+++ b/pkgs/os-specific/linux/iptables/default.nix
@@ -30,6 +30,7 @@ stdenv.mkDerivation rec {
     homepage = http://www.netfilter.org/projects/iptables/index.html;
     platforms = platforms.linux;
     maintainers = with maintainers; [ fpletz ];
+    license = licenses.gpl2;
     downloadPage = "http://www.netfilter.org/projects/iptables/files/";
     updateWalker = true;
     inherit version;
diff --git a/pkgs/os-specific/linux/kernel/common-config.nix b/pkgs/os-specific/linux/kernel/common-config.nix
index 68b5e7c21a8..bf99729b33e 100644
--- a/pkgs/os-specific/linux/kernel/common-config.nix
+++ b/pkgs/os-specific/linux/kernel/common-config.nix
@@ -61,6 +61,7 @@ let
       X86_INTEL_PSTATE                 = yes;
       INTEL_IDLE                       = yes;
       CPU_FREQ_DEFAULT_GOV_PERFORMANCE = yes;
+      CPU_FREQ_GOV_SCHEDUTIL           = whenAtLeast "4.9" yes;
       PM_WAKELOCKS                     = yes;
     };
 
diff --git a/pkgs/os-specific/linux/kernel/linux-libre.nix b/pkgs/os-specific/linux/kernel/linux-libre.nix
new file mode 100644
index 00000000000..2195bb7a29c
--- /dev/null
+++ b/pkgs/os-specific/linux/kernel/linux-libre.nix
@@ -0,0 +1,38 @@
+{ stdenv, lib, fetchsvn, linux
+, scripts ? fetchsvn {
+    url = "https://www.fsfla.org/svn/fsfla/software/linux-libre/releases/tags/";
+    rev = "r15295";
+    sha256 = "03kqbjy7w9zg6ry86h9sxa33z0rblznhba109lwmjwy0wx7yk1cs";
+  }
+, ...
+}:
+
+let
+  majorMinor = lib.versions.majorMinor linux.modDirVersion;
+
+  major = lib.versions.major linux.modDirVersion;
+  minor = lib.versions.minor linux.modDirVersion;
+  patch = lib.versions.patch linux.modDirVersion;
+
+in linux.override {
+  argsOverride = {
+    modDirVersion = "${linux.modDirVersion}-gnu";
+
+    src = stdenv.mkDerivation {
+      name = "${linux.name}-libre-src";
+      src = linux.src;
+      buildPhase = ''
+        ${scripts}/${majorMinor}-gnu/deblob-${majorMinor} \
+            ${major} ${minor} ${patch}
+      '';
+      checkPhase = ''
+        ${scripts}/deblob-check
+      '';
+      installPhase = ''
+        cp -r . "$out"
+      '';
+    };
+
+    maintainers = [ lib.maintainers.qyliss ];
+  };
+}
diff --git a/pkgs/os-specific/linux/kexectools/default.nix b/pkgs/os-specific/linux/kexectools/default.nix
index f5f0916b90a..069bd17c483 100644
--- a/pkgs/os-specific/linux/kexectools/default.nix
+++ b/pkgs/os-specific/linux/kexectools/default.nix
@@ -22,6 +22,7 @@ stdenv.mkDerivation rec {
     homepage = http://horms.net/projects/kexec/kexec-tools;
     description = "Tools related to the kexec Linux feature";
     platforms = platforms.linux;
+    license = licenses.gpl2;
     badPlatforms = platforms.riscv;
   };
 }
diff --git a/pkgs/os-specific/linux/selinux-sandbox/default.nix b/pkgs/os-specific/linux/selinux-sandbox/default.nix
index 431f5e9ef51..71d2ee6e80a 100644
--- a/pkgs/os-specific/linux/selinux-sandbox/default.nix
+++ b/pkgs/os-specific/linux/selinux-sandbox/default.nix
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
     substituteInPlace Makefile --replace "-m 4755" "-m 755"
     substituteInPlace sandboxX.sh \
       --replace "#!/bin/sh" "#!${bash}/bin/sh" \
-      --replace "/usr/share/sandbox/start" "$out/share/sandbox/start" \
+      --replace "/usr/share/sandbox/start" "${placeholder "out"}/share/sandbox/start" \
       --replace "/usr/bin/cut" "${coreutils}/bin/cut" \
       --replace "/usr/bin/Xephyr" "${xorgserver}/bin/Xepyhr" \
       --replace "secon" "${policycoreutils}/bin/secon"
diff --git a/pkgs/servers/atlassian/jira.nix b/pkgs/servers/atlassian/jira.nix
index 2894f9cec8a..1bff3ad379d 100644
--- a/pkgs/servers/atlassian/jira.nix
+++ b/pkgs/servers/atlassian/jira.nix
@@ -5,11 +5,11 @@
 
 stdenv.mkDerivation rec {
   name = "atlassian-jira-${version}";
-  version = "7.11.0";
+  version = "7.12.0";
 
   src = fetchurl {
     url = "https://downloads.atlassian.com/software/jira/downloads/atlassian-jira-software-${version}.tar.gz";
-    sha256 = "0w2fgs5n2zdvxgcx2rn010nz81z4q3z6cbq9hmpyzxy9ygjby2w4";
+    sha256 = "0kpsgq54xs43rwhg9zwh869jl64ywhb4fcyp5sq1zd19y5cqfnkn";
   };
 
   phases = [ "unpackPhase" "buildPhase" "installPhase" "fixupPhase" ];
diff --git a/pkgs/servers/openafs/1.6/module.nix b/pkgs/servers/openafs/1.6/module.nix
index 2818996e5d4..7ad9199b7ac 100644
--- a/pkgs/servers/openafs/1.6/module.nix
+++ b/pkgs/servers/openafs/1.6/module.nix
@@ -41,7 +41,7 @@ in stdenv.mkDerivation rec {
 
   installPhase = ''
     mkdir -p ${modDestDir}
-    cp src/libafs/MODLOAD-*/libafs-${kernel.version}.* ${modDestDir}/libafs.ko
+    cp src/libafs/MODLOAD-*/libafs-${kernel.modDirVersion}.* ${modDestDir}/libafs.ko
     xz -f ${modDestDir}/libafs.ko
   '';
 
diff --git a/pkgs/servers/openafs/1.8/module.nix b/pkgs/servers/openafs/1.8/module.nix
index 8eeac8696c0..cfd9f0561e9 100644
--- a/pkgs/servers/openafs/1.8/module.nix
+++ b/pkgs/servers/openafs/1.8/module.nix
@@ -44,7 +44,7 @@ in stdenv.mkDerivation rec {
 
   installPhase = ''
     mkdir -p ${modDestDir}
-    cp src/libafs/MODLOAD-*/libafs-${kernel.version}.* ${modDestDir}/libafs.ko
+    cp src/libafs/MODLOAD-*/libafs-${kernel.modDirVersion}.* ${modDestDir}/libafs.ko
     xz -f ${modDestDir}/libafs.ko
   '';
 
diff --git a/pkgs/shells/zsh/zsh-completions/default.nix b/pkgs/shells/zsh/zsh-completions/default.nix
index 92a9d293e84..ba65f90d909 100644
--- a/pkgs/shells/zsh/zsh-completions/default.nix
+++ b/pkgs/shells/zsh/zsh-completions/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   name = "zsh-completions-${version}";
-  version = "0.27.0";
+  version = "0.28.0";
 
   src = fetchFromGitHub {
     owner = "zsh-users";
     repo = "zsh-completions";
     rev = "${version}";
-    sha256 = "1c2xx9bkkvyy0c6aq9vv3fjw7snlm0m5bjygfk5391qgjpvchd29";
+    sha256 = "02n1svaw74y0za856w8zjb98nzg1h6bmy4xsar71irsk1mj3m5h2";
   };
 
   installPhase= ''
diff --git a/pkgs/tools/X11/xpra/default.nix b/pkgs/tools/X11/xpra/default.nix
index 6d6fee0a2d3..fd7f70004db 100644
--- a/pkgs/tools/X11/xpra/default.nix
+++ b/pkgs/tools/X11/xpra/default.nix
@@ -52,6 +52,7 @@ in buildPythonApplication rec {
   preBuild = ''
     export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE $(pkg-config --cflags gtk+-2.0) $(pkg-config --cflags pygtk-2.0) $(pkg-config --cflags xtst)"
     substituteInPlace xpra/server/auth/pam_auth.py --replace "/lib/libpam.so.1" "${pam}/lib/libpam.so"
+    substituteInPlace xpra/x11/bindings/keyboard_bindings.pyx --replace "/usr/share/X11/xkb" "${xorg.xkeyboardconfig}/share/X11/xkb"
   '';
   setupPyBuildFlags = ["--with-Xdummy" "--without-strict"];
 
diff --git a/pkgs/development/python-modules/buttersink/default.nix b/pkgs/tools/filesystems/buttersink/default.nix
index b13251e1ca7..791d59b7ac2 100644
--- a/pkgs/development/python-modules/buttersink/default.nix
+++ b/pkgs/tools/filesystems/buttersink/default.nix
@@ -1,18 +1,20 @@
-{ stdenv, buildPythonPackage, fetchPypi, isPy3k, boto, crcmod, psutil }:
+{ lib, python2 }:
 
-buildPythonPackage rec {
+python2.pkgs.buildPythonApplication rec {
   pname = "buttersink";
   version = "0.6.9";
-  disabled = isPy3k;
 
-  src = fetchPypi {
+  src = python2.pkgs.fetchPypi {
     inherit pname version;
-    sha256 = "c9c05982c44fbb85f17b7ef0e8bee11f375c03d89bcba50cbc2520013512107a";
+    sha256 = "a797b6e92ad2acdf41e033c1368ab365aa268f4d8458b396a5770fa6c2bc3f54";
   };
 
-  propagatedBuildInputs = [ boto crcmod psutil ];
+  propagatedBuildInputs = with python2.pkgs; [ boto crcmod psutil ];
 
-  meta = with stdenv.lib; {
+  # No tests implemented
+  doCheck = false;
+
+  meta = with lib; {
     description = "Synchronise btrfs snapshots";
     longDescription = ''
       ButterSink is like rsync, but for btrfs subvolumes instead of files,
diff --git a/pkgs/tools/graphics/gmic/default.nix b/pkgs/tools/graphics/gmic/default.nix
index c267695dd78..51212a3ea94 100644
--- a/pkgs/tools/graphics/gmic/default.nix
+++ b/pkgs/tools/graphics/gmic/default.nix
@@ -32,16 +32,12 @@ in stdenv.mkDerivation rec {
     "-DBUILD_LIB_STATIC=OFF"
     "-DBUILD_PLUGIN=${if withGimpPlugin then "ON" else "OFF"}"
     "-DENABLE_DYNAMIC_LINKING=ON"
-  ];
+  ] ++ stdenv.lib.optional withGimpPlugin "-DPLUGIN_INSTALL_PREFIX=${placeholder "gimpPlugin"}/${gimp.targetPluginDir}";
 
   postPatch = ''
     cp ${CMakeLists} CMakeLists.txt
   '';
 
-  preConfigure = stdenv.lib.optionalString withGimpPlugin ''
-    cmakeFlags="$cmakeFlags -DPLUGIN_INSTALL_PREFIX=$gimpPlugin/${gimp.targetPluginDir}"
-  '';
-
   meta = with stdenv.lib; {
     description = "G'MIC is an open and full-featured framework for image processing";
     homepage = http://gmic.eu/;
diff --git a/pkgs/tools/misc/colord/default.nix b/pkgs/tools/misc/colord/default.nix
index a5d71a9487c..e442850fbaa 100644
--- a/pkgs/tools/misc/colord/default.nix
+++ b/pkgs/tools/misc/colord/default.nix
@@ -29,11 +29,11 @@ stdenv.mkDerivation rec {
     glib-compile-schemas $out/share/glib-2.0/schemas
   '';
 
-  PKG_CONFIG_SYSTEMD_SYSTEMDSYSTEMUNITDIR = "lib/systemd/system";
-  PKG_CONFIG_SYSTEMD_SYSTEMDUSERUNITDIR = "lib/systemd/user";
-  PKG_CONFIG_SYSTEMD_TMPFILESDIR = "lib/tmpfiles.d";
-  PKG_CONFIG_BASH_COMPLETION_COMPLETIONSDIR= "share/bash-completion/completions";
-  PKG_CONFIG_UDEV_UDEVDIR = "lib/udev";
+  PKG_CONFIG_SYSTEMD_SYSTEMDSYSTEMUNITDIR = "${placeholder "out"}/lib/systemd/system";
+  PKG_CONFIG_SYSTEMD_SYSTEMDUSERUNITDIR = "${placeholder "out"}/lib/systemd/user";
+  PKG_CONFIG_SYSTEMD_TMPFILESDIR = "${placeholder "out"}/lib/tmpfiles.d";
+  PKG_CONFIG_BASH_COMPLETION_COMPLETIONSDIR= "${placeholder "out"}/share/bash-completion/completions";
+  PKG_CONFIG_UDEV_UDEVDIR = "${placeholder "out"}/lib/udev";
 
   postFixup = ''
     wrapProgram "$out/libexec/colord-session" \
diff --git a/pkgs/tools/package-management/nix-review/default.nix b/pkgs/tools/package-management/nix-review/default.nix
index 70fd3f3369a..da32aca28aa 100644
--- a/pkgs/tools/package-management/nix-review/default.nix
+++ b/pkgs/tools/package-management/nix-review/default.nix
@@ -8,13 +8,13 @@
 
 python3.pkgs.buildPythonApplication rec {
   pname = "nix-review";
-  version = "0.5.0";
+  version = "0.5.2";
 
   src = fetchFromGitHub {
     owner = "Mic92";
     repo = "nix-review";
     rev = version;
-    sha256 = "0ncifmp90870v6r651p92wbvpayfblm5k9nxikryjaj1fnvd2np3";
+    sha256 = "0csd7dkdv0csc63dz1h08c8xifxwv5fdz5dyk37sr6vh1ccjdapi";
   };
 
   makeWrapperArgs = [
diff --git a/pkgs/tools/security/sshuttle/default.nix b/pkgs/tools/security/sshuttle/default.nix
index ac21097a09f..f7878df228f 100644
--- a/pkgs/tools/security/sshuttle/default.nix
+++ b/pkgs/tools/security/sshuttle/default.nix
@@ -3,25 +3,14 @@
 
 python3Packages.buildPythonApplication rec {
   name = "sshuttle-${version}";
-  version = "0.78.3";
+  version = "0.78.4";
 
   src = fetchurl {
-    sha256 = "12xyq5h77b57cnkljdk8qyjxzys512b73019s20x6ck5brj1m8wa";
+    sha256 = "0pqk43kd7crqhg6qgnl8kapncwgw1xgaf02zarzypcw64kvdih9h";
     url = "mirror://pypi/s/sshuttle/${name}.tar.gz";
   };
 
-  patches = [
-    ./sudo.patch
-    (fetchpatch {
-      url = "https://github.com/sshuttle/sshuttle/commit/91aa6ff625f7c89a19e6f8702425cfead44a146f.patch";
-      sha256 = "0sqcc6kj53wlas2d3klbyilhns6vakzwbbp8y7j9wlmbnc530pks";
-    })
-    # fix macos patch
-    (fetchpatch {
-      url = "https://github.com/sshuttle/sshuttle/commit/884bd6deb0b699a5648bb1c7bdfbc7be8ea0e7df.patch";
-      sha256 = "1nn0wx0rckxl9yzw9dxjji44zw4xqz7ws4qwjdvfn48w1f786lmz";
-    })
-  ];
+  patches = [ ./sudo.patch ];
 
   nativeBuildInputs = [ makeWrapper python3Packages.setuptools_scm ] ++ stdenv.lib.optional (stdenv.system != "i686-linux") pandoc;
   buildInputs =
diff --git a/pkgs/tools/typesetting/asciidoctor/Gemfile.lock b/pkgs/tools/typesetting/asciidoctor/Gemfile.lock
index 6c52a2c416a..04f9029e6e5 100644
--- a/pkgs/tools/typesetting/asciidoctor/Gemfile.lock
+++ b/pkgs/tools/typesetting/asciidoctor/Gemfile.lock
@@ -5,7 +5,7 @@ GEM
     addressable (2.5.2)
       public_suffix (>= 2.0.2, < 4.0)
     afm (0.2.2)
-    asciidoctor (1.5.6.2)
+    asciidoctor (1.5.7.1)
     asciidoctor-bespoke (1.0.0.alpha.1)
       asciidoctor (>= 1.5.0)
       slim (~> 3.0.6)
@@ -36,7 +36,7 @@ GEM
       addressable
     hashery (2.1.2)
     htmlentities (4.3.4)
-    i18n (1.0.0)
+    i18n (1.1.0)
       concurrent-ruby (~> 1.0)
     json (2.1.0)
     mathematical (1.6.11)
@@ -66,10 +66,10 @@ GEM
     prawn-templates (0.1.1)
       pdf-reader (~> 2.0)
       prawn (~> 2.2)
-    public_suffix (3.0.2)
+    public_suffix (3.0.3)
     pygments.rb (1.2.1)
       multi_json (>= 1.0.0)
-    rack (2.0.4)
+    rack (2.0.5)
     ruby-enum (0.7.2)
       i18n
     ruby-rc4 (0.1.5)
@@ -79,7 +79,7 @@ GEM
       tilt (>= 1.3.3, < 2.1)
     source_map (3.0.1)
       json
-    sprockets (3.7.1)
+    sprockets (3.7.2)
       concurrent-ruby (~> 1.0)
       rack (> 1, < 3)
     temple (0.8.0)
diff --git a/pkgs/tools/typesetting/asciidoctor/default.nix b/pkgs/tools/typesetting/asciidoctor/default.nix
index 1f6a7054b9e..7001b6e3642 100644
--- a/pkgs/tools/typesetting/asciidoctor/default.nix
+++ b/pkgs/tools/typesetting/asciidoctor/default.nix
@@ -37,7 +37,7 @@ bundlerApp {
 
       # For some reason 'mathematical.so' is missing cairo and glib in its RPATH, add them explicitly here
       postFixup = lib.optionalString stdenv.isLinux ''
-        soPath="$out/lib/ruby/gems/2.4.0/gems/mathematical-${attrs.version}/lib/mathematical/mathematical.so"
+        soPath="$out/${ruby.gemPath}/gems/mathematical-${attrs.version}/lib/mathematical/mathematical.so"
         ${patchelf}/bin/patchelf \
           --set-rpath "${lib.makeLibraryPath [ glib cairo ]}:$(${patchelf}/bin/patchelf --print-rpath "$soPath")" \
           "$soPath"
diff --git a/pkgs/tools/typesetting/asciidoctor/gemset.nix b/pkgs/tools/typesetting/asciidoctor/gemset.nix
index 4ae146d289b..8b960fa3d93 100644
--- a/pkgs/tools/typesetting/asciidoctor/gemset.nix
+++ b/pkgs/tools/typesetting/asciidoctor/gemset.nix
@@ -1,6 +1,8 @@
 {
   addressable = {
     dependencies = ["public_suffix"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "0viqszpkggqi8hq87pqp0xykhvz60g99nwmkwsb0v45kc2liwxvk";
@@ -9,6 +11,8 @@
     version = "2.5.2";
   };
   afm = {
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "06kj9hgd0z8pj27bxp2diwqh6fv7qhwwm17z64rhdc4sfn76jgn8";
@@ -17,6 +21,8 @@
     version = "0.2.2";
   };
   Ascii85 = {
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "0658m37jjjn6drzqg1gk4p6c205mgp7g1jh2d00n4ngghgmz5qvs";
@@ -25,15 +31,19 @@
     version = "1.0.3";
   };
   asciidoctor = {
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "0zq3az4836nxkc8g5wnnbzmarw7663s1ky6gf8pc04sfpa8n2l3f";
+      sha256 = "0v52bzc72cvg7zfgq27pa4mgyf29dx9m20fghrw1xmvwgd519n1w";
       type = "gem";
     };
-    version = "1.5.6.2";
+    version = "1.5.7.1";
   };
   asciidoctor-bespoke = {
     dependencies = ["asciidoctor" "slim" "thread_safe"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "1awy933sswxvi2hxpll3rh9phxcvmqhrbb91m6ibjchnf7qsl3zk";
@@ -43,6 +53,8 @@
   };
   asciidoctor-diagram = {
     dependencies = ["asciidoctor"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "0rj02i00d9hkzqzzrk5al9rn8yv5x0wsnrv9y6j4k8rfylm69c1r";
@@ -52,6 +64,8 @@
   };
   asciidoctor-latex = {
     dependencies = ["asciidoctor" "htmlentities" "opal"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "02qvn1ngp4s9y22vk23zzssd4w1bpyk84akjwiq6nqn8im6s4awz";
@@ -61,6 +75,8 @@
   };
   asciidoctor-mathematical = {
     dependencies = ["asciidoctor" "mathematical" "ruby-enum"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "18igbvs70dnlrzgl62jcc0vfxhlb4r7v9bq3qf1v80l17lvq1x8f";
@@ -70,6 +86,8 @@
   };
   asciidoctor-pdf = {
     dependencies = ["asciidoctor" "prawn" "prawn-icon" "prawn-svg" "prawn-table" "prawn-templates" "safe_yaml" "thread_safe" "treetop"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "1899c071hfmzqg9822v7rg8y8iqlfy3dhpfy32ignzap6cajlsqg";
@@ -78,6 +96,8 @@
     version = "1.5.0.alpha.16";
   };
   coderay = {
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "15vav4bhcc2x3jmi3izb11l4d9f3xv8hp2fszb7iqmpsccv1pz4y";
@@ -86,6 +106,8 @@
     version = "1.1.2";
   };
   concurrent-ruby = {
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "183lszf5gx84kcpb779v6a2y0mx9sssy8dgppng1z9a505nj1qcf";
@@ -95,6 +117,8 @@
   };
   css_parser = {
     dependencies = ["addressable"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "0gwvf8mc8gnz4aizfijplv3594998h2j44ydakpzsdmkivs07v61";
@@ -103,6 +127,8 @@
     version = "1.6.0";
   };
   hashery = {
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "0qj8815bf7q6q7llm5rzdz279gzmpqmqqicxnzv066a020iwqffj";
@@ -111,6 +137,8 @@
     version = "2.1.2";
   };
   htmlentities = {
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "1nkklqsn8ir8wizzlakncfv42i32wc0w9hxp00hvdlgjr7376nhj";
@@ -120,14 +148,18 @@
   };
   i18n = {
     dependencies = ["concurrent-ruby"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "191c2xzlvn42sb8dz6gjy0qaigri4chfvflg3d4k6n58flm0yp65";
+      sha256 = "0ppvmla21hssvrfm8g1n2fnb4lxn4yhy9qmmba0imanflgldrjmr";
       type = "gem";
     };
-    version = "1.0.0";
+    version = "1.1.0";
   };
   json = {
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "01v6jjpvh3gnq6sgllpfqahlgxzj50ailwhj9b3cd20hi2dx0vxp";
@@ -137,6 +169,8 @@
   };
   mathematical = {
     dependencies = ["ruby-enum"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "06xkr613hmzbhmm6zv92zlcjyfp0a6i2b3q3hg24lmj4j5l85p21";
@@ -145,6 +179,8 @@
     version = "1.6.11";
   };
   multi_json = {
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "1rl0qy4inf1mp8mybfk56dfga0mvx97zwpmq5xmiwl5r770171nv";
@@ -154,6 +190,8 @@
   };
   opal = {
     dependencies = ["source_map" "sprockets"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "0dmdxhmg43ibd4bsldssslsz8870hzknwcxiv9l1838lh6hd390k";
@@ -162,6 +200,8 @@
     version = "0.6.3";
   };
   pdf-core = {
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "19llwch2wfg51glb0kff0drfp3n6nb9vim4zlvzckxysksvxpby1";
@@ -171,6 +211,8 @@
   };
   pdf-reader = {
     dependencies = ["Ascii85" "afm" "hashery" "ruby-rc4" "ttfunk"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "1b3ig4wpcgdbqa7yw0ahwbmikkkywn2a22bfmrknl5ls7g066x45";
@@ -179,6 +221,8 @@
     version = "2.1.0";
   };
   polyglot = {
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "1bqnxwyip623d8pr29rg6m8r0hdg08fpr2yb74f46rn1wgsnxmjr";
@@ -188,6 +232,8 @@
   };
   prawn = {
     dependencies = ["pdf-core" "ttfunk"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "1qdjf1v6sfl44g3rqxlg8k4jrzkwaxgvh2l4xws97a8f3xv4na4m";
@@ -197,6 +243,8 @@
   };
   prawn-icon = {
     dependencies = ["prawn"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "1pz8n7ajkfmflw05dib2l9qkzkfzwwbzx63qcvjr14k1dnbpx7qk";
@@ -206,6 +254,8 @@
   };
   prawn-svg = {
     dependencies = ["css_parser" "prawn"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "0fykcs10q2j6h04riav1kzrw77mga6gh1rxbh7q0ab6gkr0wamzx";
@@ -215,6 +265,8 @@
   };
   prawn-table = {
     dependencies = ["prawn"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "1nxd6qmxqwl850icp18wjh5k0s3amxcajdrkjyzpfgq0kvilcv9k";
@@ -224,6 +276,8 @@
   };
   prawn-templates = {
     dependencies = ["pdf-reader" "prawn"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "1gs894sj9zdlwx59h3rk4p0l3y8r18p22zhnfiyx9lngsa56gcrj";
@@ -232,15 +286,19 @@
     version = "0.1.1";
   };
   public_suffix = {
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "1x5h1dh1i3gwc01jbg01rly2g6a1qwhynb1s8a30ic507z1nh09s";
+      sha256 = "08q64b5br692dd3v0a9wq9q5dvycc6kmiqmjbdxkxbfizggsvx6l";
       type = "gem";
     };
-    version = "3.0.2";
+    version = "3.0.3";
   };
   "pygments.rb" = {
     dependencies = ["multi_json"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "0lbvnwvz770ambm4d6lxgc2097rydn5rcc5d6986bnkzyxfqqjnv";
@@ -249,15 +307,19 @@
     version = "1.2.1";
   };
   rack = {
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "1mfriw2r2913dv8qf3p87n7yal3qfsrs478x2qz106v8vhmxa017";
+      sha256 = "158hbn7rlc3czp2vivvam44dv6vmzz16qrh5dbzhfxbfsgiyrqw1";
       type = "gem";
     };
-    version = "2.0.4";
+    version = "2.0.5";
   };
   ruby-enum = {
     dependencies = ["i18n"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "0h62avini866kxpjzqxlqnajma3yvj0y25l6hn9h2mv5pp6fcrhx";
@@ -266,6 +328,8 @@
     version = "0.7.2";
   };
   ruby-rc4 = {
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "00vci475258mmbvsdqkmqadlwn6gj9m01sp7b5a3zd90knil1k00";
@@ -274,6 +338,8 @@
     version = "0.1.5";
   };
   safe_yaml = {
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "1hly915584hyi9q9vgd968x2nsi5yag9jyf5kq60lwzi5scr7094";
@@ -283,6 +349,8 @@
   };
   slim = {
     dependencies = ["temple" "tilt"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "0zwz083xsbnlrma1pfkzrqc1fqm90fidn915vlifvkzl5fs43pvl";
@@ -292,6 +360,8 @@
   };
   source_map = {
     dependencies = ["json"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "0fviv92glr51v2zqy4i5jzi3hzpvjrcwyrxddcfr84ki65zb7pkv";
@@ -301,14 +371,18 @@
   };
   sprockets = {
     dependencies = ["concurrent-ruby" "rack"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "0sv3zk5hwxyjvg7iy9sggjc7k3mfxxif7w8p260rharfyib939ar";
+      sha256 = "182jw5a0fbqah5w9jancvfmjbk88h8bxdbwnl4d3q809rpxdg8ay";
       type = "gem";
     };
-    version = "3.7.1";
+    version = "3.7.2";
   };
   temple = {
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "00nxf610nzi4n1i2lkby43nrnarvl89fcl6lg19406msr0k3ycmq";
@@ -317,6 +391,8 @@
     version = "0.8.0";
   };
   thread_safe = {
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "0nmhcgq6cgz44srylra07bmaw99f5271l0dpsvl5f75m44l0gmwy";
@@ -325,6 +401,8 @@
     version = "0.3.6";
   };
   tilt = {
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "0020mrgdf11q23hm1ddd6fv691l51vi10af00f137ilcdb2ycfra";
@@ -334,6 +412,8 @@
   };
   treetop = {
     dependencies = ["polyglot"];
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "0wpl5z33796nz2ah44waflrd1girbra281d9i3m9nz4ylg1ljg5b";
@@ -342,6 +422,8 @@
     version = "1.5.3";
   };
   ttfunk = {
+    groups = ["default"];
+    platforms = [];
     source = {
       remotes = ["https://rubygems.org"];
       sha256 = "1mgrnqla5n51v4ivn844albsajkck7k6lviphfqa8470r46c58cd";
@@ -349,4 +431,4 @@
     };
     version = "1.5.1";
   };
-}
+}
\ No newline at end of file
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 4795670c7f3..43957a6700d 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -117,6 +117,8 @@ with pkgs;
 
   cmark = callPackage ../development/libraries/cmark { };
 
+  corgi = callPackage ../development/tools/corgi { };
+
   dhallToNix = callPackage ../build-support/dhall-to-nix.nix {
     inherit dhall-nix;
   };
@@ -971,6 +973,8 @@ with pkgs;
 
   bustle = haskellPackages.bustle;
 
+  buttersink = callPackage ../tools/filesystems/buttersink { };
+
   bwm_ng = callPackage ../tools/networking/bwm-ng { };
 
   byobu = callPackage ../tools/misc/byobu {
@@ -2391,6 +2395,10 @@ with pkgs;
 
   ext4magic = callPackage ../tools/filesystems/ext4magic { };
 
+  extract_url = callPackage ../applications/misc/extract_url {
+    inherit (perlPackages) MIMEtools HTMLParser CursesUI URIFind;
+  };
+
   extundelete = callPackage ../tools/filesystems/extundelete { };
 
   expect = callPackage ../tools/misc/expect { };
@@ -8393,6 +8401,8 @@ with pkgs;
 
   kustomize = callPackage ../development/tools/kustomize { };
 
+  kythe = callPackage ../development/tools/kythe { };
+
   Literate = callPackage ../development/tools/literate-programming/Literate {};
 
   lcov = callPackage ../development/tools/analysis/lcov { };
@@ -14259,6 +14269,12 @@ with pkgs;
   linuxPackages_hardkernel_latest = linuxPackages_hardkernel_4_14;
   linux_hardkernel_latest = linuxPackages_hardkernel_latest.kernel;
 
+  # GNU Linux-libre kernels
+  linuxPackages-libre = recurseIntoAttrs (linuxPackagesFor linux-libre);
+  linux-libre = callPackage ../os-specific/linux/kernel/linux-libre.nix {};
+  linuxPackages_latest-libre = recurseIntoAttrs (linuxPackagesFor linux_latest-libre);
+  linux_latest-libre = linux-libre.override { linux = linux_latest; };
+
   # A function to build a manually-configured kernel
   linuxManualConfig = makeOverridable (callPackage ../os-specific/linux/kernel/manual-config.nix {});
 
@@ -15797,6 +15813,7 @@ with pkgs;
 
   deadbeefPlugins = {
     headerbar-gtk3 = callPackage ../applications/audio/deadbeef/plugins/headerbar-gtk3.nix { };
+    infobar = callPackage ../applications/audio/deadbeef/plugins/infobar.nix { };
     mpris2 = callPackage ../applications/audio/deadbeef/plugins/mpris2.nix { };
     opus = callPackage ../applications/audio/deadbeef/plugins/opus.nix { };
   };
@@ -21659,12 +21676,21 @@ with pkgs;
 
   nix-top = callPackage ../tools/package-management/nix-top { };
 
+  nix-repl = throw (
+    "nix-repl has been removed because it's not maintained anymore, " +
+    (lib.optionalString (! lib.versionAtLeast "2" (lib.versions.major builtins.nixVersion))
+      "ugrade your Nix installation to a newer version and ") +
+    "use `nix repl` instead. " +
+    "Also see https://github.com/NixOS/nixpkgs/pull/44903"
+  );
+
   nix-review = callPackage ../tools/package-management/nix-review { };
 
   nix-serve = callPackage ../tools/package-management/nix-serve { };
 
   nixos-artwork = callPackage ../data/misc/nixos-artwork { };
   nixos-icons = callPackage ../data/misc/nixos-artwork/icons.nix { };
+  nixos-grub2-theme = callPackage ../data/misc/nixos-artwork/grub2-theme.nix { };
 
   nixos-container = callPackage ../tools/virtualization/nixos-container { };
 
diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix
index be5bf77e93e..a3d39cb3762 100644
--- a/pkgs/top-level/perl-packages.nix
+++ b/pkgs/top-level/perl-packages.nix
@@ -3186,6 +3186,19 @@ let
     };
   };
 
+  CursesUI = buildPerlPackage rec {
+    name = "Curses-UI-0.9609";
+    src = fetchurl {
+      url = "mirror://cpan/authors/id/M/MD/MDXI/${name}.tar.gz";
+      sha256 = "1bqf4h8z70f78nzqq5yj4ahvsbhxxal6bc2g301l9qdn2fjjgf0a";
+    };
+    meta = {
+      description = "curses based OO user interface framework";
+      license = stdenv.lib.licenses.artistic1;
+    };
+    propagatedBuildInputs = [ Curses TermReadKey ];
+  };
+
   CryptX = buildPerlPackage rec {
     name = "CryptX-0.061";
     src = fetchurl {
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 05fd30720cf..0aafe96d927 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -1088,8 +1088,6 @@ in {
 
   bumps = callPackage ../development/python-modules/bumps {};
 
-  buttersink = callPackage ../development/python-modules/buttersink {};
-
   cached-property = callPackage ../development/python-modules/cached-property { };
 
   caffe = pkgs.caffe.override {
@@ -2098,39 +2096,6 @@ in {
 
   docker_pycreds = callPackage ../development/python-modules/docker-pycreds {};
 
-  docker_registry_core = callPackage ../development/python-modules/docker-registry-core {};
-
-  docker_registry = buildPythonPackage rec {
-    name = "docker-registry-0.9.1";
-    disabled = isPy3k;
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/d/docker-registry/${name}.tar.gz";
-      sha256 = "1svm1h59sg4bwj5cy10m016gj0xpiin15nrz5z66h47sbkndvlw3";
-    };
-
-    DEPS = "loose";
-
-    doCheck = false; # requires redis server
-    propagatedBuildInputs = with self; [
-      setuptools docker_registry_core blinker flask gevent gunicorn pyyaml
-      requests rsa sqlalchemy setuptools backports_lzma m2crypto
-    ];
-
-    patchPhase = "> requirements/main.txt";
-
-    # Default config uses needed env variables
-    postInstall = ''
-      ln -s $out/lib/python2.7/site-packages/config/config_sample.yml $out/lib/python2.7/site-packages/config/config.yml
-    '';
-
-    meta = {
-      description = "Docker registry core package";
-      homepage = https://github.com/docker/docker-registry;
-      license = licenses.asl20;
-    };
-  };
-
   docopt = callPackage ../development/python-modules/docopt { };
 
   doctest-ignore-unicode = callPackage ../development/python-modules/doctest-ignore-unicode { };
@@ -4442,23 +4407,7 @@ in {
     };
   };
 
-  pywatchman = buildPythonPackage rec {
-    name = "pywatchman-${version}";
-    version = "1.3.0";
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/p/pywatchman/pywatchman-${version}.tar.gz";
-      sha256 = "c3d5be183b5b04f6ad575fc71b06dd196185dea1558d9f4d0598ba9beaab8245";
-    };
-    postPatch = ''
-      substituteInPlace pywatchman/__init__.py \
-        --replace "'watchman'" "'${pkgs.watchman}/bin/watchman'"
-    '';
-    # SyntaxError
-    disabled = isPy3k;
-    # No tests in archive
-    doCheck = false;
-
-  };
+  pywatchman = callPackage ../development/python-modules/pywatchman { };
 
   pywavelets = callPackage ../development/python-modules/pywavelets { };