summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--COPYING2
-rw-r--r--lib/maintainers.nix3
-rw-r--r--nixos/lib/make-system-tarball.sh2
-rw-r--r--nixos/modules/misc/ids.nix2
-rw-r--r--nixos/modules/module-list.nix3
-rw-r--r--nixos/modules/programs/gphoto2.nix31
-rw-r--r--nixos/modules/rename.nix3
-rw-r--r--nixos/modules/services/audio/alsa.nix41
-rw-r--r--nixos/modules/services/audio/mpd.nix8
-rw-r--r--nixos/modules/services/networking/dnscrypt-proxy.nix2
-rw-r--r--nixos/modules/services/networking/miredo.nix93
-rw-r--r--nixos/modules/services/torrent/flexget.nix6
-rw-r--r--nixos/modules/services/x11/desktop-managers/gnome3.nix1
-rw-r--r--nixos/modules/virtualisation/docker.nix4
-rw-r--r--nixos/modules/virtualisation/openstack/common.nix30
-rw-r--r--nixos/modules/virtualisation/openstack/glance.nix245
-rw-r--r--nixos/release.nix1
-rw-r--r--nixos/tests/glance.nix77
-rw-r--r--pkgs/applications/editors/kakoune/default.nix9
-rw-r--r--pkgs/applications/editors/nano/default.nix4
-rw-r--r--pkgs/applications/gis/grass/default.nix1
-rw-r--r--pkgs/applications/graphics/darktable/default.nix14
-rw-r--r--pkgs/applications/misc/calibre/default.nix6
-rw-r--r--pkgs/applications/misc/font-manager/default.nix1
-rw-r--r--pkgs/applications/misc/rofi/default.nix10
-rw-r--r--pkgs/applications/networking/dropbox/default.nix6
-rw-r--r--pkgs/applications/networking/dyndns/cfdyndns/default.nix1
-rw-r--r--pkgs/applications/networking/flexget/default.nix39
-rw-r--r--pkgs/applications/networking/mailreaders/astroid/default.nix36
-rw-r--r--pkgs/applications/networking/mailreaders/astroid/propagate-environment.patch13
-rw-r--r--pkgs/applications/networking/mailreaders/neomutt/default.nix9
-rw-r--r--pkgs/applications/office/ppl-address-book/Gemfile2
-rw-r--r--pkgs/applications/office/ppl-address-book/Gemfile.lock34
-rw-r--r--pkgs/applications/office/ppl-address-book/default.nix38
-rw-r--r--pkgs/applications/office/ppl-address-book/gemset.nix90
-rw-r--r--pkgs/applications/science/logic/lean/default.nix6
-rw-r--r--pkgs/applications/science/misc/fityk/default.nix4
-rw-r--r--pkgs/applications/science/physics/sherpa/default.nix23
-rw-r--r--pkgs/applications/version-management/cvsps/01_ignoretrunk.dpatch23
-rw-r--r--pkgs/applications/version-management/cvsps/02_dynamicbufferalloc.dpatch125
-rw-r--r--pkgs/applications/version-management/cvsps/03_diffoptstypo.dpatch19
-rw-r--r--pkgs/applications/version-management/cvsps/default.nix48
-rw-r--r--pkgs/applications/version-management/git-and-tools/transcrypt/default.nix4
-rw-r--r--pkgs/applications/version-management/pijul/default.nix1
-rw-r--r--pkgs/build-support/replace-dependency.nix2
-rw-r--r--pkgs/development/compilers/rust/bootstrap.nix12
-rw-r--r--pkgs/development/compilers/rust/cargo.nix4
-rw-r--r--pkgs/development/compilers/rust/default.nix14
-rw-r--r--pkgs/development/compilers/rust/patches/disable-lockfile-check-stable.patch3
-rw-r--r--pkgs/development/idris-modules/httpclient.nix30
-rw-r--r--pkgs/development/libraries/gmime/default.nix5
-rw-r--r--pkgs/development/libraries/kirigami/v2.nix23
-rw-r--r--pkgs/development/libraries/libgphoto2/default.nix6
-rw-r--r--pkgs/development/libraries/libmd/default.nix30
-rw-r--r--pkgs/development/libraries/openbabel/default.nix12
-rw-r--r--pkgs/development/libraries/physics/fastnlo/default.nix23
-rw-r--r--pkgs/development/libraries/physics/mcgrid/default.nix29
-rw-r--r--pkgs/development/libraries/physics/rivet/default.nix11
-rw-r--r--pkgs/development/libraries/qt-5/5.7/default.nix1
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtquickcontrols2.nix6
-rw-r--r--pkgs/development/libraries/science/math/clblas/cuda/default.nix3
-rw-r--r--pkgs/development/libraries/wxGTK-2.9/default.nix14
-rw-r--r--pkgs/development/libraries/wxGTK-3.0/default.nix12
-rw-r--r--pkgs/development/libraries/xylib/default.nix10
-rw-r--r--pkgs/development/ocaml-modules/eliom/default.nix26
-rw-r--r--pkgs/development/ocaml-modules/pgocaml/default.nix18
-rw-r--r--pkgs/development/tools/analysis/kcov/default.nix4
-rw-r--r--pkgs/development/tools/makerpm/default.nix28
-rw-r--r--pkgs/development/tools/nrpl/default.nix44
-rw-r--r--pkgs/development/tools/ocaml/js_of_ocaml/default.nix4
-rw-r--r--pkgs/games/chessx/default.nix4
-rw-r--r--pkgs/games/freeorion/92455f9.patch19
-rw-r--r--pkgs/games/freeorion/default.nix11
-rw-r--r--pkgs/games/freeorion/fix_rpaths.patch11
-rw-r--r--pkgs/games/opendungeons/default.nix14
-rw-r--r--pkgs/misc/screensavers/physlock/default.nix12
-rw-r--r--pkgs/misc/vim-plugins/default.nix12
-rw-r--r--pkgs/misc/vim-plugins/patches/youcompleteme/1-top-cmake.patch14
-rw-r--r--pkgs/misc/vim-plugins/vim2nix/additional-nix-code/youcompleteme12
-rw-r--r--pkgs/os-specific/linux/bcc/default.nix6
-rw-r--r--pkgs/os-specific/linux/dpdk/default.nix6
-rw-r--r--pkgs/os-specific/linux/kernel/patches.nix4
-rw-r--r--pkgs/os-specific/linux/odp-dpdk/default.nix12
-rw-r--r--pkgs/os-specific/linux/pktgen/default.nix11
-rw-r--r--pkgs/os-specific/linux/wireguard/default.nix4
-rw-r--r--pkgs/servers/matrix-synapse/default.nix4
-rw-r--r--pkgs/tools/backup/borg/default.nix11
-rw-r--r--pkgs/tools/graphics/netpbm/default.nix4
-rw-r--r--pkgs/tools/misc/bmon/default.nix10
-rw-r--r--pkgs/tools/networking/miredo/default.nix34
-rw-r--r--pkgs/tools/networking/ndjbdns/default.nix19
-rw-r--r--pkgs/tools/security/gencfsm/default.nix15
-rw-r--r--pkgs/tools/security/gorilla-bin/default.nix41
-rw-r--r--pkgs/top-level/all-packages.nix32
-rw-r--r--pkgs/top-level/python-packages.nix51
-rw-r--r--pkgs/top-level/rust-packages.nix6
96 files changed, 1414 insertions, 459 deletions
diff --git a/COPYING b/COPYING
index 0408a7e40b7a..a632d6f58b12 100644
--- a/COPYING
+++ b/COPYING
@@ -1,4 +1,4 @@
-Copyright (c) 2003-2016 Eelco Dolstra and the Nixpkgs/NixOS contributors
+Copyright (c) 2003-2017 Eelco Dolstra and the Nixpkgs/NixOS contributors
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
diff --git a/lib/maintainers.nix b/lib/maintainers.nix
index 5fa30e863745..0306d6802bf9 100644
--- a/lib/maintainers.nix
+++ b/lib/maintainers.nix
@@ -201,6 +201,7 @@
   ianwookim = "Ian-Woo Kim <ianwookim@gmail.com>";
   igsha = "Igor Sharonov <igor.sharonov@gmail.com>";
   ikervagyok = "Balázs Lengyel <ikervagyok@gmail.com>";
+  ivan-tkatchev = "Ivan Tkatchev <tkatchev@gmail.com>";
   j-keck = "Jürgen Keck <jhyphenkeck@gmail.com>";
   jagajaga = "Arseniy Seroka <ars.seroka@gmail.com>";
   javaguirre = "Javier Aguirre <contacto@javaguirre.net>";
@@ -241,6 +242,7 @@
   lassulus = "Lassulus <lassulus@gmail.com>";
   layus = "Guillaume Maudoux <layus.on@gmail.com>";
   ldesgoui = "Lucas Desgouilles <ldesgoui@gmail.com>";
+  league = "Christopher League <league@contrapunctus.net>";
   lebastr = "Alexander Lebedev <lebastr@gmail.com>";
   leenaars = "Michiel Leenaars <ml.software@leenaa.rs>";
   leonardoce = "Leonardo Cecchi <leonardo.cecchi@gmail.com>";
@@ -315,6 +317,7 @@
   mudri = "James Wood <lamudri@gmail.com>";
   muflax = "Stefan Dorn <mail@muflax.com>";
   myrl = "Myrl Hex <myrl.0xf@gmail.com>";
+  namore = "Roman Naumann <namor@hemio.de>";
   nand0p = "Fernando Jose Pando <nando@hex7.com>";
   Nate-Devv = "Nathan Moore <natedevv@gmail.com>";
   nathan-gs = "Nathan Bijnens <nathan@nathan.gs>";
diff --git a/nixos/lib/make-system-tarball.sh b/nixos/lib/make-system-tarball.sh
index efb83d914287..73a009d8488a 100644
--- a/nixos/lib/make-system-tarball.sh
+++ b/nixos/lib/make-system-tarball.sh
@@ -54,7 +54,7 @@ mkdir -p $out/tarball
 
 rm env-vars
 
-tar --sort=name --mtime='1970-01-01' -cvJf $out/tarball/$fileName.tar.xz * $extraArgs
+tar --sort=name --mtime='@1' --owner=0 --group=0 --numeric-owner -cvJf $out/tarball/$fileName.tar.xz * $extraArgs
 
 mkdir -p $out/nix-support
 echo $system > $out/nix-support/system
diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix
index eb6f8e706896..6ab4b24a3491 100644
--- a/nixos/modules/misc/ids.nix
+++ b/nixos/modules/misc/ids.nix
@@ -281,6 +281,7 @@
       riak-cs = 263;
       infinoted = 264;
       keystone = 265;
+      glance = 266;
 
       # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
 
@@ -532,6 +533,7 @@
       riak-cs = 263;
       infinoted = 264;
       keystone = 265;
+      glance = 266;
 
       # When adding a gid, make sure it doesn't match an existing
       # uid. Users and groups with the same name should have equal
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index cd12fe4f9b36..be09fb80e0ac 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -71,6 +71,7 @@
   ./programs/environment.nix
   ./programs/fish.nix
   ./programs/freetds.nix
+  ./programs/gphoto2.nix
   ./programs/info.nix
   ./programs/java.nix
   ./programs/kbdlight.nix
@@ -392,6 +393,7 @@
   ./services/networking/minidlna.nix
   ./services/networking/miniupnpd.nix
   ./services/networking/mosquitto.nix
+  ./services/networking/miredo.nix
   ./services/networking/mstpd.nix
   ./services/networking/murmur.nix
   ./services/networking/namecoind.nix
@@ -632,4 +634,5 @@
   ./virtualisation/xen-dom0.nix
   ./virtualisation/xe-guest-utilities.nix
   ./virtualisation/openstack/keystone.nix
+  ./virtualisation/openstack/glance.nix
 ]
diff --git a/nixos/modules/programs/gphoto2.nix b/nixos/modules/programs/gphoto2.nix
new file mode 100644
index 000000000000..47822562aee1
--- /dev/null
+++ b/nixos/modules/programs/gphoto2.nix
@@ -0,0 +1,31 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+  meta.maintainers = [ maintainers.league ];
+
+  ###### interface
+  options = {
+    programs.gphoto2 = {
+      enable = mkOption {
+        default = false;
+        example = true;
+        type = types.bool;
+        description = ''
+          Whether to configure system to use gphoto2.
+          To grant digital camera access to a user, the user must
+          be part of the camera group:
+          <code>users.extraUsers.alice.extraGroups = ["camera"];</code>
+        '';
+      };
+    };
+  };
+
+  ###### implementation
+  config = mkIf config.programs.gphoto2.enable {
+    services.udev.packages = [ pkgs.libgphoto2 ];
+    environment.systemPackages = [ pkgs.gphoto2 ];
+    users.extraGroups.camera = {};
+  };
+}
diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix
index a89ce2c743d4..8102e0e1f642 100644
--- a/nixos/modules/rename.nix
+++ b/nixos/modules/rename.nix
@@ -150,6 +150,9 @@ with lib;
     # tarsnap
     (mkRemovedOptionModule [ "services" "tarsnap" "cachedir" ] "Use services.tarsnap.archives.<name>.cachedir")
 
+    # alsa
+    (mkRenamedOptionModule [ "sound" "enableMediaKeys" ] [ "sound" "mediaKeys" "enable" ])
+
     # Options that are obsolete and have no replacement.
     (mkRemovedOptionModule [ "boot" "initrd" "luks" "enable" ] "")
     (mkRemovedOptionModule [ "programs" "bash" "enable" ] "")
diff --git a/nixos/modules/services/audio/alsa.nix b/nixos/modules/services/audio/alsa.nix
index c63f4dc8d7f1..53786dbc6270 100644
--- a/nixos/modules/services/audio/alsa.nix
+++ b/nixos/modules/services/audio/alsa.nix
@@ -33,16 +33,6 @@ in
         '';
       };
 
-      enableMediaKeys = mkOption {
-        type = types.bool;
-        default = false;
-        description = ''
-          Whether to enable volume and capture control with keyboard media keys.
-
-          Enabling this will turn on <option>services.actkbd</option>.
-        '';
-      };
-
       extraConfig = mkOption {
         type = types.lines;
         default = "";
@@ -54,6 +44,31 @@ in
         '';
       };
 
+      mediaKeys = {
+
+        enable = mkOption {
+          type = types.bool;
+          default = false;
+          description = ''
+            Whether to enable volume and capture control with keyboard media keys.
+
+            Enabling this will turn on <option>services.actkbd</option>.
+          '';
+        };
+
+        volumeStep = mkOption {
+          type = types.string;
+          default = "1";
+          example = "1%";
+          description = ''
+            The value by which to increment/decrement volume on media keys.
+
+            See amixer(1) for allowed values.
+          '';
+        };
+
+      };
+
     };
 
   };
@@ -90,17 +105,17 @@ in
         };
       };
 
-    services.actkbd = mkIf config.sound.enableMediaKeys {
+    services.actkbd = mkIf config.sound.mediaKeys.enable {
       enable = true;
       bindings = [
         # "Mute" media key
         { keys = [ 113 ]; events = [ "key" ];       command = "${alsaUtils}/bin/amixer -q set Master toggle"; }
 
         # "Lower Volume" media key
-        { keys = [ 114 ]; events = [ "key" "rep" ]; command = "${alsaUtils}/bin/amixer -q set Master 1- unmute"; }
+        { keys = [ 114 ]; events = [ "key" "rep" ]; command = "${alsaUtils}/bin/amixer -q set Master ${config.sound.mediaKeys.volumeStep}- unmute"; }
 
         # "Raise Volume" media key
-        { keys = [ 115 ]; events = [ "key" "rep" ]; command = "${alsaUtils}/bin/amixer -q set Master 1+ unmute"; }
+        { keys = [ 115 ]; events = [ "key" "rep" ]; command = "${alsaUtils}/bin/amixer -q set Master ${config.sound.mediaKeys.volumeStep}+ unmute"; }
 
         # "Mic Mute" media key
         { keys = [ 190 ]; events = [ "key" ];       command = "${alsaUtils}/bin/amixer -q set Capture toggle"; }
diff --git a/nixos/modules/services/audio/mpd.nix b/nixos/modules/services/audio/mpd.nix
index 5ec2e2c26232..a89215d73828 100644
--- a/nixos/modules/services/audio/mpd.nix
+++ b/nixos/modules/services/audio/mpd.nix
@@ -83,11 +83,11 @@ in {
 
         listenAddress = mkOption {
           type = types.str;
-          default = "any";
+          default = "127.0.0.1";
+          example = "any";
           description = ''
-            This setting sets the address for the daemon to listen on. Careful attention
-            should be paid if this is assigned to anything other then the default, any.
-            This setting can deny access to control of the daemon.
+            The address for the daemon to listen on.
+            Use <literal>any</literal> to listen on all addresses.
           '';
         };
 
diff --git a/nixos/modules/services/networking/dnscrypt-proxy.nix b/nixos/modules/services/networking/dnscrypt-proxy.nix
index 82bf178f4cb7..462039803f80 100644
--- a/nixos/modules/services/networking/dnscrypt-proxy.nix
+++ b/nixos/modules/services/networking/dnscrypt-proxy.nix
@@ -263,6 +263,8 @@ in
     systemd.services.dnscrypt-proxy = {
       description = "dnscrypt-proxy daemon";
 
+      before = [ "nss-lookup.target" ];
+
       after = [ "network.target" ]
         ++ optional apparmorEnabled "apparmor.service"
         ++ optional useUpstreamResolverList "init-dnscrypt-proxy-statedir.service";
diff --git a/nixos/modules/services/networking/miredo.nix b/nixos/modules/services/networking/miredo.nix
new file mode 100644
index 000000000000..e4422e7f5b02
--- /dev/null
+++ b/nixos/modules/services/networking/miredo.nix
@@ -0,0 +1,93 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+  cfg = config.services.miredo;
+  pidFile = "/run/miredo.pid";
+  miredoConf = pkgs.writeText "miredo.conf" ''
+    InterfaceName ${cfg.interfaceName}
+    ServerAddress ${cfg.serverAddress}
+    ${optionalString (cfg.bindAddress != null) "BindAddress ${cfg.bindAddress}"}
+    ${optionalString (cfg.bindPort != null) "BindPort ${cfg.bindPort}"}
+  '';
+in
+{
+
+  ###### interface
+
+  options = {
+
+    services.miredo = {
+
+      enable = mkEnableOption "Whether miredo should be run on startup.";
+
+      package = mkOption {
+        type = types.package;
+        default = pkgs.miredo;
+        defaultText = "pkgs.miredo";
+        description = ''
+          The package to use for the miredo daemon's binary.
+        '';
+      };
+
+      serverAddress = mkOption {
+        default = "teredo.remlab.net";
+        type = types.str;
+        description = ''
+          The hostname or primary IPv4 address of the Teredo server.
+          This setting is required if Miredo runs as a Teredo client.
+          "teredo.remlab.net" is an experimental service for testing only.
+          Please use another server for production and/or large scale deployments.
+        '';
+      };
+
+      interfaceName = mkOption {
+        default = "teredo";
+        type = types.str;
+        description = ''
+          Name of the network tunneling interface.
+        '';
+      };
+
+      bindAddress = mkOption {
+        default = null;
+        type = types.nullOr types.str;
+        description = ''
+          Depending on the local firewall/NAT rules, you might need to force
+          Miredo to use a fixed UDP port and or IPv4 address.
+        '';
+      };
+
+      bindPort = mkOption {
+        default = null;
+        type = types.nullOr types.str;
+        description = ''
+          Depending on the local firewall/NAT rules, you might need to force
+          Miredo to use a fixed UDP port and or IPv4 address.
+        '';
+      };
+    };
+  };
+
+
+  ###### implementation
+
+  config = mkIf cfg.enable {
+
+    systemd.services.miredo = {
+      wantedBy = [ "multi-user.target" ];
+      after = [ "network.target" ];
+      description = "Teredo IPv6 Tunneling Daemon";
+      serviceConfig = {
+        Restart = "always";
+        RestartSec = "5s";
+        ExecStartPre = "${cfg.package}/bin/miredo-checkconf -f ${miredoConf}";
+        ExecStart = "${cfg.package}/bin/miredo -c ${miredoConf} -p ${pidFile} -f";
+        ExecReload = "/bin/kill -HUP $MAINPID";
+      };
+    };
+
+  };
+
+}
diff --git a/nixos/modules/services/torrent/flexget.nix b/nixos/modules/services/torrent/flexget.nix
index 1252aa1c549c..4b9038e3e251 100644
--- a/nixos/modules/services/torrent/flexget.nix
+++ b/nixos/modules/services/torrent/flexget.nix
@@ -4,7 +4,7 @@ with lib;
 
 let
   cfg = config.services.flexget;
-  pkg = pkgs.python27Packages.flexget;
+  pkg = pkgs.flexget;
   ymlFile = pkgs.writeText "flexget.yml" ''
     ${cfg.config}
 
@@ -54,12 +54,12 @@ in {
 
   config = mkIf cfg.enable {
 
-    environment.systemPackages = [ pkgs.python27Packages.flexget ];
+    environment.systemPackages = [ pkg ];
 
     systemd.services = {
       flexget = {
         description = "FlexGet Daemon";
-        path = [ pkgs.pythonPackages.flexget ];
+        path = [ pkg ];
         serviceConfig = {
           User = cfg.user;
           Environment = "TZ=${config.time.timeZone}";
diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix
index 5d1af09e7aa7..17e84b1d9a16 100644
--- a/nixos/modules/services/x11/desktop-managers/gnome3.nix
+++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix
@@ -123,6 +123,7 @@ in {
     services.packagekit.enable = mkDefault true;
     hardware.bluetooth.enable = mkDefault true;
     services.xserver.libinput.enable = mkDefault true; # for controlling touchpad settings via gnome control center
+    services.udev.packages = [ pkgs.gnome3.gnome_settings_daemon ];
 
     fonts.fonts = [ pkgs.dejavu_fonts pkgs.cantarell_fonts ];
 
diff --git a/nixos/modules/virtualisation/docker.nix b/nixos/modules/virtualisation/docker.nix
index 92249573a4b7..4b30a38f832f 100644
--- a/nixos/modules/virtualisation/docker.nix
+++ b/nixos/modules/virtualisation/docker.nix
@@ -130,4 +130,8 @@ in
     }
   ]);
 
+  imports = [
+    (mkRemovedOptionModule ["virtualisation" "docker" "socketActivation"] "This option was removed in favor of starting docker at boot")
+  ];
+
 }
diff --git a/nixos/modules/virtualisation/openstack/common.nix b/nixos/modules/virtualisation/openstack/common.nix
index 3fce54a2fa59..2feb0a873951 100644
--- a/nixos/modules/virtualisation/openstack/common.nix
+++ b/nixos/modules/virtualisation/openstack/common.nix
@@ -51,4 +51,34 @@ rec {
 	      };
             };});
   };
+  
+  databaseOption = name: {
+    host = mkOption {
+      type = types.str;
+      default = "localhost";
+      description = ''
+        Host of the database.
+      '';
+    };
+
+    name = mkOption {
+      type = types.str;
+      default = name;
+      description = ''
+        Name of the existing database.
+      '';
+    };
+
+    user = mkOption {
+      type = types.str;
+      default = name;
+      description = ''
+        The database user. The user must exist and has access to
+        the specified database.
+      '';
+    };
+    password = mkSecretOption {
+      name = name + "MysqlPassword";
+      description = "The database user's password";};
+  };
 }
diff --git a/nixos/modules/virtualisation/openstack/glance.nix b/nixos/modules/virtualisation/openstack/glance.nix
new file mode 100644
index 000000000000..4d85718e369c
--- /dev/null
+++ b/nixos/modules/virtualisation/openstack/glance.nix
@@ -0,0 +1,245 @@
+{ config, lib, pkgs, ... }:
+
+with lib; with import ./common.nix {inherit lib;};
+
+let
+  cfg = config.virtualisation.openstack.glance;
+  commonConf = ''
+    [database]
+    connection = "mysql://${cfg.database.user}:${cfg.database.password.pattern}@${cfg.database.host}/${cfg.database.name}"
+    notification_driver = noop
+
+    [keystone_authtoken]
+    auth_url = ${cfg.authUrl}
+    auth_plugin = password
+    project_name = service
+    project_domain_id = default
+    user_domain_id = default
+    username = ${cfg.serviceUsername}
+    password = ${cfg.servicePassword.pattern}
+
+    [glance_store]
+    default_store = file
+    filesystem_store_datadir = /var/lib/glance/images/
+  '';
+  glanceApiConfTpl = pkgs.writeText "glance-api.conf" ''
+    ${commonConf}
+
+    [paste_deploy]
+    flavor = keystone
+    config_file = ${cfg.package}/etc/glance-api-paste.ini
+  '';
+  glanceRegistryConfTpl = pkgs.writeText "glance-registry.conf" ''
+    ${commonConf}
+
+    [paste_deploy]
+    config_file = ${cfg.package}/etc/glance-registry-paste.ini
+  '';
+  glanceApiConf = "/var/lib/glance/glance-api.conf";
+  glanceRegistryConf = "/var/lib/glance/glance-registry.conf";
+
+in {
+  options.virtualisation.openstack.glance = {
+    package = mkOption {
+      type = types.package;
+      default = pkgs.glance;
+      example = literalExample "pkgs.glance";
+      description = ''
+        Glance package to use.
+      '';
+    };
+
+    enable = mkOption {
+      default = false;
+      type = types.bool;
+      description = ''
+        This option enables Glance as a single-machine
+        installation. That is, all of Glance's components are
+        enabled on this machine. This is useful for evaluating and
+        experimenting with Glance. Note we are currently not
+        providing any configurations for a multi-node setup.
+      '';
+    };
+
+    authUrl = mkOption {
+      type = types.str;
+      default = http://localhost:5000;
+      description = ''
+        Complete public Identity (Keystone) API endpoint. Note this is
+        unversionned.
+      '';
+    };
+
+    serviceUsername = mkOption {
+      type = types.str;
+      default = "glance";
+      description = ''
+        The Glance service username. This user is created if bootstrap
+        is enable, otherwise it has to be manually created before
+        starting this service.
+      '';
+    };
+
+    servicePassword = mkSecretOption {
+      name = "glanceAdminPassword";
+      description = ''
+        The Glance service user's password.
+      '';
+    };
+
+    database = databaseOption "glance";
+
+    bootstrap = {
+      enable = mkOption {
+        default = false;
+        type = types.bool;
+        description = ''
+          Bootstrap the Glance service by creating the service tenant,
+          an admin account and a public endpoint. This option provides
+          a ready-to-use glance service. This is only done at the
+          first Glance execution by the systemd post start section.
+          The keystone admin account is used to create required
+          Keystone resource for the Glance service.
+
+          <note><para> This option is a helper for setting up
+          development or testing environments.</para></note>
+        '';
+      };
+
+      endpointPublic = mkOption {
+        type = types.str;
+        default = "http://localhost:9292";
+        description = ''
+          The public image endpoint. The link <link
+          xlink:href="http://docs.openstack.org/liberty/install-guide-rdo/keystone-services.html">
+          create endpoint</link> provides more informations
+          about that.
+        '';
+      };
+
+      keystoneAdminUsername = mkOption {
+        type = types.str;
+        default = "admin";
+        description = ''
+          The keystone admin user name used to create the Glance account.
+        '';
+      };
+
+      keystoneAdminPassword = mkSecretOption {
+        name = "keystoneAdminPassword";
+        description = ''
+          The keystone admin user's password.
+        '';
+      };
+
+      keystoneAdminTenant = mkOption {
+        type = types.str;
+        default = "admin";
+        description = ''
+          The keystone admin tenant used to create the Glance account.
+        '';
+      };
+      keystoneAuthUrl = mkOption {
+        type = types.str;
+        default = "http://localhost:5000/v2.0";
+        description = ''
+          The keystone auth url used to create the Glance account.
+        '';
+      };
+    };
+  };
+
+  config = mkIf cfg.enable {
+    users.extraUsers = [{
+      name = "glance";
+      group = "glance";
+      uid = config.ids.gids.glance;
+
+    }];
+    users.extraGroups = [{
+      name = "glance";
+      gid = config.ids.gids.glance;
+    }];
+
+    systemd.services.glance-registry = {
+      description = "OpenStack Glance Registry Daemon";
+      after = [ "network.target"];
+      path = [ pkgs.curl pkgs.pythonPackages.keystoneclient pkgs.gawk ];
+      wantedBy = [ "multi-user.target" ];
+      preStart = ''
+        mkdir -m 775 -p /var/lib/glance/{images,scrubber,image_cache}
+        chown glance:glance /var/lib/glance/{images,scrubber,image_cache}
+
+        # Secret file managment
+        cp ${glanceRegistryConfTpl} ${glanceRegistryConf};
+        chown glance:glance ${glanceRegistryConf};
+        chmod 640 ${glanceRegistryConf}
+        ${replaceSecret cfg.database.password glanceRegistryConf}
+        ${replaceSecret cfg.servicePassword glanceRegistryConf}
+
+        cp ${glanceApiConfTpl} ${glanceApiConf};
+        chown glance:glance ${glanceApiConf};
+        chmod 640 ${glanceApiConf}
+        ${replaceSecret cfg.database.password glanceApiConf}
+        ${replaceSecret cfg.servicePassword glanceApiConf}
+
+        # Initialise the database
+        ${cfg.package}/bin/glance-manage --config-file=${glanceApiConf} --config-file=${glanceRegistryConf} db_sync
+      '';
+      postStart = ''
+        set -eu
+        export OS_AUTH_URL=${cfg.bootstrap.keystoneAuthUrl}
+        export OS_USERNAME=${cfg.bootstrap.keystoneAdminUsername}
+        export OS_PASSWORD=${getSecret cfg.bootstrap.keystoneAdminPassword}
+        export OS_TENANT_NAME=${cfg.bootstrap.keystoneAdminTenant}
+
+        # Wait until the keystone is available for use
+        count=0
+        while ! keystone user-get ${cfg.bootstrap.keystoneAdminUsername} > /dev/null
+        do
+            if [ $count -eq 30 ]
+            then
+                echo "Tried 30 times, giving up..."
+                exit 1
+            fi
+
+            echo "Keystone not yet started. Waiting for 1 second..."
+            count=$((count++))
+            sleep 1
+        done
+
+        # If the service glance doesn't exist, we consider glance is
+        # not initialized
+        if ! keystone service-get glance
+        then
+            keystone service-create --type image --name glance
+            ID=$(keystone service-get glance | awk '/ id / { print $4 }')
+            keystone endpoint-create --region RegionOne --service $ID --internalurl http://localhost:9292 --adminurl http://localhost:9292 --publicurl ${cfg.bootstrap.endpointPublic}
+
+            keystone user-create --name ${cfg.serviceUsername} --tenant service --pass ${getSecret cfg.servicePassword}
+            keystone user-role-add --tenant service --user ${cfg.serviceUsername} --role admin
+        fi
+        '';
+      serviceConfig = {
+        PermissionsStartOnly = true; # preStart must be run as root
+        TimeoutStartSec = "600"; # 10min for initial db migrations
+        User = "glance";
+        Group = "glance";
+        ExecStart = "${cfg.package}/bin/glance-registry --config-file=${glanceRegistryConf}";
+      };
+    };
+    systemd.services.glance-api = {
+      description = "OpenStack Glance API Daemon";
+      after = [ "glance-registry.service" "network.target"];
+      requires = [ "glance-registry.service" "network.target"]; 
+      wantedBy = [ "multi-user.target" ];
+      serviceConfig = {
+        PermissionsStartOnly = true; # preStart must be run as root
+        User = "glance";
+        Group = "glance";
+        ExecStart = "${cfg.package}/bin/glance-api --config-file=${glanceApiConf}";
+      };
+    };
+  };
+
+}
diff --git a/nixos/release.nix b/nixos/release.nix
index 366eecf773e2..dfa9b67654fb 100644
--- a/nixos/release.nix
+++ b/nixos/release.nix
@@ -242,6 +242,7 @@ in rec {
   tests.firewall = callTest tests/firewall.nix {};
   tests.fleet = hydraJob (import tests/fleet.nix { system = "x86_64-linux"; });
   #tests.gitlab = callTest tests/gitlab.nix {};
+  tests.glance = callTest tests/glance.nix {};
   tests.gocd-agent = callTest tests/gocd-agent.nix {};
   tests.gocd-server = callTest tests/gocd-server.nix {};
   tests.gnome3 = callTest tests/gnome3.nix {};
diff --git a/nixos/tests/glance.nix b/nixos/tests/glance.nix
new file mode 100644
index 000000000000..992b77227a4b
--- /dev/null
+++ b/nixos/tests/glance.nix
@@ -0,0 +1,77 @@
+{ system ? builtins.currentSystem }:
+
+with import ../lib/testing.nix { inherit system; };
+with pkgs.lib;
+
+let
+  glanceMysqlPassword = "glanceMysqlPassword";
+  glanceAdminPassword = "glanceAdminPassword";
+
+  createDb = pkgs.writeText "db-provisionning.sql" ''
+    create database keystone;
+    GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'keystone';
+    GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' IDENTIFIED BY 'keystone';
+
+    create database glance;
+    GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY '${glanceMysqlPassword}';
+    GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY '${glanceMysqlPassword}';
+  '';
+
+  image =
+    (import ../lib/eval-config.nix {
+      inherit system;
+      modules = [ ../../nixos/modules/virtualisation/nova-image.nix ];
+    }).config.system.build.novaImage;
+
+  # The admin keystone account
+  adminOpenstackCmd = "OS_TENANT_NAME=admin OS_USERNAME=admin OS_PASSWORD=keystone OS_AUTH_URL=http://localhost:5000/v3 OS_IDENTITY_API_VERSION=3 openstack";
+
+in makeTest {
+  meta = with pkgs.stdenv.lib.maintainers; {
+    maintainers = [ lewo ];
+  };
+  machine =
+    { config, pkgs, ... }:
+    {
+      services.mysql.enable = true;
+      services.mysql.package = pkgs.mysql;
+      services.mysql.initialScript = createDb;
+
+      virtualisation = {
+        openstack.keystone = {
+          enable = true;
+          database.password = { value = "keystone"; storage = "fromNixStore"; };
+          adminToken = { value = "adminToken"; storage = "fromNixStore"; };
+          bootstrap.enable = true;
+          bootstrap.adminPassword = { value = "keystone"; storage = "fromNixStore"; };
+        };
+
+        openstack.glance = {
+          enable = true;
+          database.password = { value = glanceMysqlPassword; storage = "fromNixStore"; };
+          servicePassword = { value = glanceAdminPassword; storage = "fromNixStore"; };
+
+          bootstrap = {
+            enable = true;
+            keystoneAdminPassword = { value = "keystone"; storage = "fromNixStore"; };
+          };
+        };
+
+        memorySize = 2096;
+        diskSize = 4 * 1024;
+        };
+
+      environment.systemPackages = with pkgs.pythonPackages; with pkgs; [
+        openstackclient
+      ];
+    };
+
+  testScript =
+    ''
+     $machine->waitForUnit("glance-api.service");
+
+     # Since Glance api can take time to start, we retry until success
+     $machine->waitUntilSucceeds("${adminOpenstackCmd} image create nixos --file ${image}/nixos.img --disk-format qcow2 --container-format bare --public");
+     $machine->succeed("${adminOpenstackCmd} image list") =~ /nixos/ or die;
+    '';
+}
diff --git a/pkgs/applications/editors/kakoune/default.nix b/pkgs/applications/editors/kakoune/default.nix
index 73ee7ed64cd5..14b13c394f31 100644
--- a/pkgs/applications/editors/kakoune/default.nix
+++ b/pkgs/applications/editors/kakoune/default.nix
@@ -4,17 +4,18 @@ with stdenv.lib;
 
 stdenv.mkDerivation rec {
   name = "kakoune-nightly-${version}";
-  version = "2016-12-10";
+  version = "2016-12-30";
   src = fetchFromGitHub {
     repo = "kakoune";
     owner = "mawww";
-    rev = "e44129577a010ebb4dc609b806104d3175659074";
-    sha256 = "1jkpbk6wa9x5nlv002y1whv6ddhqawxzbp3jcbzcb51cg8bz0b1l";
+    rev = "76c58aa022a896dc170c207ff821992ee354d934";
+    sha256 = "0hgpcp6444cyg4bm0a9ypywjwfh19qpqpfr5w0wcd2y3clnsvsdz";
   };
   buildInputs = [ ncurses boost asciidoc docbook_xsl libxslt ];
 
   buildPhase = ''
     sed -ie 's#--no-xmllint#--no-xmllint --xsltproc-opts="--nonet"#g' src/Makefile
+    substituteInPlace src/Makefile --replace "boost_regex-mt" "boost_regex"
     export PREFIX=$out
     (cd src && make )
   '';
@@ -28,6 +29,6 @@ stdenv.mkDerivation rec {
     description = "A vim inspired text editor";
     license = licenses.publicDomain;
     maintainers = with maintainers; [ vrthra ];
-    platforms = platforms.linux;
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/applications/editors/nano/default.nix b/pkgs/applications/editors/nano/default.nix
index 738476b98e2e..0b45f9502fad 100644
--- a/pkgs/applications/editors/nano/default.nix
+++ b/pkgs/applications/editors/nano/default.nix
@@ -12,10 +12,10 @@ with stdenv.lib;
 
 stdenv.mkDerivation rec {
   name = "nano-${version}";
-  version = "2.7.2";
+  version = "2.7.3";
   src = fetchurl {
     url = "mirror://gnu/nano/${name}.tar.xz";
-    sha256 = "1hlhwgvzdgkc7k74fbbn49hn6vmvzqr7h8gclgl7r1c6qrrny0bp";
+    sha256 = "1z0bfyc5cvv83l3bjmlcwl49mpxrp65k5ffsfpnayfyjc18fy9nr";
   };
   nativeBuildInputs = [ texinfo ] ++ optional enableNls gettext;
   buildInputs = [ ncurses ];
diff --git a/pkgs/applications/gis/grass/default.nix b/pkgs/applications/gis/grass/default.nix
index 44e07cc22c0b..7d2828115f77 100644
--- a/pkgs/applications/gis/grass/default.nix
+++ b/pkgs/applications/gis/grass/default.nix
@@ -60,6 +60,7 @@ stdenv.mkDerivation {
     wrapProgram $out/bin/grass70 \
     --set PYTHONPATH $PYTHONPATH \
     --set GRASS_PYTHON ${python2Packages.python}/bin/${python2Packages.python.executable}
+    --suffix LD_LIBRARY_PATH ':' '${gdal}/lib'
     ln -s $out/grass-*/lib $out/lib
   '';
 
diff --git a/pkgs/applications/graphics/darktable/default.nix b/pkgs/applications/graphics/darktable/default.nix
index a9ad0210baa1..ea5113246ba9 100644
--- a/pkgs/applications/graphics/darktable/default.nix
+++ b/pkgs/applications/graphics/darktable/default.nix
@@ -11,12 +11,12 @@
 assert stdenv ? glibc;
 
 stdenv.mkDerivation rec {
-  version = "2.0.7";
+  version = "2.2.0";
   name = "darktable-${version}";
 
   src = fetchurl {
     url = "https://github.com/darktable-org/darktable/releases/download/release-${version}/darktable-${version}.tar.xz";
-    sha256 = "1aqxiaw89xdx0s0h3gb9nvdzw4690y3kp7h794sihf2581bn28m9";
+    sha256 = "3eca193831faae58200bb1cb6ef29e658bce43a81706b54420953a7c33d79377";
   };
 
   buildInputs =
@@ -34,6 +34,16 @@ stdenv.mkDerivation rec {
     "-DBUILD_USERMANUAL=False"
   ];
 
+  # darktable changed its rpath handling in commit
+  # 83c70b876af6484506901e6b381304ae0d073d3c and as a result the
+  # binaries can't find libdarktable.so, so change LD_LIBRARY_PATH in
+  # the wrappers:
+  preFixup = ''
+    gappsWrapperArgs+=(
+      --prefix LD_LIBRARY_PATH ":" "$out/lib/darktable"
+    )
+  '';
+  
   meta = with stdenv.lib; {
     description = "Virtual lighttable and darkroom for photographers";
     homepage = https://www.darktable.org;
diff --git a/pkgs/applications/misc/calibre/default.nix b/pkgs/applications/misc/calibre/default.nix
index b98d327d3b8a..5c05d1e17873 100644
--- a/pkgs/applications/misc/calibre/default.nix
+++ b/pkgs/applications/misc/calibre/default.nix
@@ -5,12 +5,12 @@
 }:
 
 stdenv.mkDerivation rec {
-  version = "2.73.0";
+  version = "2.76.0";
   name = "calibre-${version}";
 
   src = fetchurl {
     url = "https://download.calibre-ebook.com/${version}/${name}.tar.xz";
-    sha256 = "17qs7dakzd25wbshsny2x82ppdqa6kwwfbp2vp1i8qmfc1nq61gc";
+    sha256 = "1xfm586n6gm44mkyn25mbiyhj6w9ji9yl6fvmnr4zk1q6qcga3v8";
   };
 
   patches = [
@@ -56,7 +56,7 @@ stdenv.mkDerivation rec {
     apsw beautifulsoup cssselect cssutils dateutil lxml mechanize netifaces pillow
     python pyqt5 sip
     # the following are distributed with calibre, but we use upstream instead
-    chardet cherrypy html5lib odfpy routes
+    chardet cherrypy html5lib_0_9999999 odfpy routes
   ]);
 
   installPhase = ''
diff --git a/pkgs/applications/misc/font-manager/default.nix b/pkgs/applications/misc/font-manager/default.nix
index 5f8d00ce996a..6d67d3a340f5 100644
--- a/pkgs/applications/misc/font-manager/default.nix
+++ b/pkgs/applications/misc/font-manager/default.nix
@@ -35,6 +35,7 @@ stdenv.mkDerivation rec {
     gnome3.gucharmap
     gnome3.libgee
     gnome3.file-roller
+    gnome3.defaultIconTheme
   ];
 
   enableParallelBuilding = true;
diff --git a/pkgs/applications/misc/rofi/default.nix b/pkgs/applications/misc/rofi/default.nix
index d6ff999b23d4..c7da77a3a030 100644
--- a/pkgs/applications/misc/rofi/default.nix
+++ b/pkgs/applications/misc/rofi/default.nix
@@ -1,14 +1,14 @@
-{ stdenv, fetchurl, autoreconfHook, pkgconfig, libxkbcommon, pango
+{ stdenv, fetchurl, autoreconfHook, pkgconfig, libxkbcommon, pango, which, git
 , cairo, glib, libxcb, xcbutil, xcbutilwm, xcbutilxrm, libstartup_notification
 }:
 
 stdenv.mkDerivation rec {
-  version = "1.2.0";
+  version = "1.3.0";
   name = "rofi-${version}";
 
   src = fetchurl {
     url = "https://github.com/DaveDavenport/rofi/releases/download/${version}/${name}.tar.xz";
-    sha256 = "0xxx0xpxhrhlhi2axq9867zqrhwqavc1qrr833k1xr0pvm5m0aqc";
+    sha256 = "1a65ai93ygras5bi7wc0s5i3zqslzqlnw3klq3sdnp2p0d6hjjqn";
   };
 
   preConfigure = ''
@@ -17,8 +17,8 @@ stdenv.mkDerivation rec {
     sed -i 's/~root/~nobody/g' test/helper-expand.c
   '';
 
-  buildInputs = [ autoreconfHook pkgconfig libxkbcommon pango cairo
-    libstartup_notification libxcb xcbutil xcbutilwm xcbutilxrm
+  buildInputs = [ autoreconfHook pkgconfig libxkbcommon pango cairo git
+    libstartup_notification libxcb xcbutil xcbutilwm xcbutilxrm which
   ];
   doCheck = true;
 
diff --git a/pkgs/applications/networking/dropbox/default.nix b/pkgs/applications/networking/dropbox/default.nix
index 20d50bd0f7a7..e78230a74b4d 100644
--- a/pkgs/applications/networking/dropbox/default.nix
+++ b/pkgs/applications/networking/dropbox/default.nix
@@ -23,11 +23,11 @@
 let
   # NOTE: When updating, please also update in current stable,
   # as older versions stop working
-  version = "16.4.29";
+  version = "16.4.30";
   sha256 =
     {
-      "x86_64-linux" = "0zng19qisbr3c9d312ar43p1b44xidabj4x2l3g3q85i300vj661";
-      "i686-linux"   = "0hc5fs0akc437valbxwlymk7ncjkdnhc51pja5bbiy48gqmd42bb";
+      "x86_64-linux" = "0inwc12d14i6gyfllxbhizb434a7vy0l5nvc07kz0bca7c4665wb";
+      "i686-linux"   = "0pdn8558ll317k3jrrjir90pn6abwbm99y9wzdq39wxj4dmrlh6w";
     }."${stdenv.system}" or (throw "system ${stdenv.system} not supported");
 
   arch =
diff --git a/pkgs/applications/networking/dyndns/cfdyndns/default.nix b/pkgs/applications/networking/dyndns/cfdyndns/default.nix
index d3be9c28df35..a79404e77c85 100644
--- a/pkgs/applications/networking/dyndns/cfdyndns/default.nix
+++ b/pkgs/applications/networking/dyndns/cfdyndns/default.nix
@@ -27,5 +27,6 @@ buildRustPackage rec {
     license = stdenv.lib.licenses.mit;
     maintainers = with maintainers; [ colemickens ];
     platforms = with platforms; linux;
+    broken = true;
   };
 }
diff --git a/pkgs/applications/networking/flexget/default.nix b/pkgs/applications/networking/flexget/default.nix
new file mode 100644
index 000000000000..f7dd96183070
--- /dev/null
+++ b/pkgs/applications/networking/flexget/default.nix
@@ -0,0 +1,39 @@
+{ lib
+, pythonPackages
+, fetchurl
+, transmission
+, deluge
+, config
+}:
+
+with pythonPackages;
+
+buildPythonPackage rec {
+  version = "1.2.337";
+  name = "FlexGet-${version}";
+  disabled = isPy3k;
+
+  src = fetchurl {
+    url = "mirror://pypi/F/FlexGet/${name}.tar.gz";
+    sha256 = "0f7aaf0bf37860f0c5adfb0ba59ca228aa3f5c582131445623a4c3bc82d45346";
+  };
+
+  doCheck = false;
+
+  buildInputs = [ nose ];
+  propagatedBuildInputs = [
+    paver feedparser sqlalchemy pyyaml rpyc
+    beautifulsoup_4_1_3 html5lib_0_9999999 pyrss2gen pynzb progressbar jinja2 flask
+    cherrypy requests dateutil_2_1 jsonschema python_tvrage tmdb3
+    guessit pathpy apscheduler ]
+  # enable deluge and transmission plugin support, if they're installed
+  ++ lib.optional (config.deluge or false) deluge
+  ++ lib.optional (transmission != null) transmissionrpc;
+
+  meta = {
+    homepage = http://flexget.com/;
+    description = "Multipurpose automation tool for content like torrents";
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ domenkozar ];
+  };
+}
\ No newline at end of file
diff --git a/pkgs/applications/networking/mailreaders/astroid/default.nix b/pkgs/applications/networking/mailreaders/astroid/default.nix
new file mode 100644
index 000000000000..31cad15296cf
--- /dev/null
+++ b/pkgs/applications/networking/mailreaders/astroid/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitHub, scons, pkgconfig, gnome3, gmime, webkitgtk24x
+  , libsass, notmuch, boost, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  name = "astroid-${version}";
+  version = "0.6";
+
+  src = fetchFromGitHub {
+    owner = "astroidmail";
+    repo = "astroid";
+    rev = "v${version}";
+    sha256 = "0zashjmqv8ips9q8ckyhgm9hfyf01wpgs6g21cwl05q5iklc5x7r";
+  };
+
+  patches = [ ./propagate-environment.patch ];
+
+  buildInputs = [ scons pkgconfig gnome3.gtkmm gmime webkitgtk24x libsass
+                  gnome3.libpeas notmuch boost gnome3.gsettings_desktop_schemas
+                  makeWrapper ];
+
+  buildPhase = "scons --prefix=$out build";
+  installPhase = "scons --prefix=$out install";
+
+  preFixup = ''
+    wrapProgram "$out/bin/astroid" \
+      --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
+  '';
+
+  meta = {
+    homepage = "https://astroidmail.github.io/";
+    description = "GTK+ frontend to the notmuch mail system";
+    maintainers = [ stdenv.lib.maintainers.bdimcheff ];
+    license = stdenv.lib.licenses.gpl3Plus;
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/pkgs/applications/networking/mailreaders/astroid/propagate-environment.patch b/pkgs/applications/networking/mailreaders/astroid/propagate-environment.patch
new file mode 100644
index 000000000000..db536ea721f2
--- /dev/null
+++ b/pkgs/applications/networking/mailreaders/astroid/propagate-environment.patch
@@ -0,0 +1,13 @@
+diff --git a/SConstruct b/SConstruct
+index a80bca3..ed2cd6d 100644
+--- a/SConstruct
++++ b/SConstruct
+@@ -5,7 +5,7 @@ from subprocess import *
+ def getGitDesc():
+   return Popen('git describe --abbrev=8 --tags --always', stdout=PIPE, shell=True).stdout.read ().strip ()
+ 
+-env = Environment ()
++env = Environment(ENV = os.environ)
+ 
+ AddOption ("--release", action="store", dest="release", default="git", help="Make a release (default: git describe output)")
+ AddOption ("--enable-debug", action="store", dest="debug", default=None, help="Enable the -g flag for debugging (default: true when release is git)")
diff --git a/pkgs/applications/networking/mailreaders/neomutt/default.nix b/pkgs/applications/networking/mailreaders/neomutt/default.nix
index 2033dfc8e913..57f633d2c990 100644
--- a/pkgs/applications/networking/mailreaders/neomutt/default.nix
+++ b/pkgs/applications/networking/mailreaders/neomutt/default.nix
@@ -1,20 +1,20 @@
 { stdenv, fetchFromGitHub, which, autoconf, automake, ncurses, perl
-, cyrus_sasl, gdbm, gpgme, kerberos, libidn, notmuch, openssl }:
+, cyrus_sasl, gdbm, gpgme, kerberos, libidn, notmuch, openssl, lmdb }:
 
 stdenv.mkDerivation rec {
-  version = "20161104";
+  version = "20161126";
   name = "neomutt-${version}";
 
   src = fetchFromGitHub {
     owner = "neomutt";
     repo = "neomutt";
     rev = "neomutt-${version}";
-    sha256 = "070p18khvxsrcn30jhyrnagka5mgza9mi5vmrrr6xl8mpgkyrlaw";
+    sha256 = "10ycfya11pvwv0rdyyak56r6f8ia8yf0h8qyi904bbpvm8lqvqfd";
   };
 
   buildInputs =
     [ autoconf automake cyrus_sasl gdbm gpgme kerberos libidn ncurses
-      notmuch which openssl perl ];
+      notmuch which openssl perl lmdb ];
 
   configureFlags = [
     "--enable-debug"
@@ -36,6 +36,7 @@ stdenv.mkDerivation rec {
     "--with-curses"
     "--with-regex"
     "--with-idn"
+    "--with-lmdb"
 
     # Look in $PATH at runtime, instead of hardcoding /usr/bin/sendmail
     "ac_cv_path_SENDMAIL=sendmail"
diff --git a/pkgs/applications/office/ppl-address-book/Gemfile b/pkgs/applications/office/ppl-address-book/Gemfile
new file mode 100644
index 000000000000..0039c4366963
--- /dev/null
+++ b/pkgs/applications/office/ppl-address-book/Gemfile
@@ -0,0 +1,2 @@
+source 'https://rubygems.org'
+gem 'ppl'
diff --git a/pkgs/applications/office/ppl-address-book/Gemfile.lock b/pkgs/applications/office/ppl-address-book/Gemfile.lock
new file mode 100644
index 000000000000..5054bb8b9c8b
--- /dev/null
+++ b/pkgs/applications/office/ppl-address-book/Gemfile.lock
@@ -0,0 +1,34 @@
+GEM
+  remote: https://rubygems.org/
+  specs:
+    colored (1.2)
+    greencard (0.0.5)
+    i18n (0.7.0)
+    inifile (2.0.2)
+    mail (2.5.3)
+      i18n (>= 0.4.0)
+      mime-types (~> 1.16)
+      treetop (~> 1.4.8)
+    mime-types (1.25.1)
+    morphine (0.1.1)
+    polyglot (0.3.5)
+    ppl (2.4.0)
+      colored (= 1.2)
+      greencard (= 0.0.5)
+      inifile (= 2.0.2)
+      mail (= 2.5.3)
+      morphine (= 0.1.1)
+      rugged (= 0.17.0.b6)
+    rugged (0.17.0.b6)
+    treetop (1.4.15)
+      polyglot
+      polyglot (>= 0.3.1)
+
+PLATFORMS
+  ruby
+
+DEPENDENCIES
+  ppl
+
+BUNDLED WITH
+   1.12.5
diff --git a/pkgs/applications/office/ppl-address-book/default.nix b/pkgs/applications/office/ppl-address-book/default.nix
new file mode 100644
index 000000000000..1c48fc50842d
--- /dev/null
+++ b/pkgs/applications/office/ppl-address-book/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, lib, bundlerEnv, ruby, makeWrapper, which }:
+
+let
+  pname = "ppl-address-book";
+
+  version = (import ./gemset.nix).ppl.version;
+
+  env = bundlerEnv rec {
+    name = "${pname}-env-${version}";
+    inherit ruby;
+    gemfile = ./Gemfile;
+    lockfile = ./Gemfile.lock;
+    gemset = ./gemset.nix;
+
+    gemConfig.rugged = attrs: { buildInputs = [ which ]; };
+  };
+
+in stdenv.mkDerivation {
+  name = "${pname}-${version}";
+
+  phases = [ "installPhase" ];
+
+  buildInputs = [ env makeWrapper ];
+
+  installPhase = ''
+    mkdir -p $out/bin
+    makeWrapper ${env}/bin/ppl $out/bin/ppl
+  '';
+
+  meta = with lib; {
+    description = "Address book software for command-line users";
+    homepage    = http://ppladdressbook.org/;
+    license     = with licenses; mit;
+    maintainers = with maintainers; [ chris-martin ];
+    platforms   = platforms.unix;
+  };
+
+}
diff --git a/pkgs/applications/office/ppl-address-book/gemset.nix b/pkgs/applications/office/ppl-address-book/gemset.nix
new file mode 100644
index 000000000000..e8229f6153fd
--- /dev/null
+++ b/pkgs/applications/office/ppl-address-book/gemset.nix
@@ -0,0 +1,90 @@
+{
+  colored = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "0b0x5jmsyi0z69bm6sij1k89z7h0laag3cb4mdn7zkl9qmxb90lx";
+      type = "gem";
+    };
+    version = "1.2";
+  };
+  greencard = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "11pxrl1w8c7m7rmnnmdaplrv53qgylyvkv8bzsfyjna7k16hynvq";
+      type = "gem";
+    };
+    version = "0.0.5";
+  };
+  i18n = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "1i5z1ykl8zhszsxcs8mzl8d0dxgs3ylz8qlzrw74jb0gplkx6758";
+      type = "gem";
+    };
+    version = "0.7.0";
+  };
+  inifile = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "03rpacxnrnisjhd2zhc7629ica958bkdbakicl5kipw1wbprck25";
+      type = "gem";
+    };
+    version = "2.0.2";
+  };
+  mail = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "1afr3acz7vsvr4gp6wnrkw1iwbjhf14mh8g8mlm40r86wcwzr39k";
+      type = "gem";
+    };
+    version = "2.5.3";
+  };
+  mime-types = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "0mhzsanmnzdshaba7gmsjwnv168r1yj8y0flzw88frw1cickrvw8";
+      type = "gem";
+    };
+    version = "1.25.1";
+  };
+  morphine = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "05aw93cijd1gq39ikw2dw3i2c79bjq05kvxrs81mqxqdlini5wwa";
+      type = "gem";
+    };
+    version = "0.1.1";
+  };
+  polyglot = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "1bqnxwyip623d8pr29rg6m8r0hdg08fpr2yb74f46rn1wgsnxmjr";
+      type = "gem";
+    };
+    version = "0.3.5";
+  };
+  ppl = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "0vpp4s12ggbk5kpl9z1i7vi9vvghgxrc8my35yk8knckg5waxg47";
+      type = "gem";
+    };
+    version = "2.4.0";
+  };
+  rugged = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "025rj3rkj5yxf4pjj1s8x4yzshlyni3hgrjwhggg54nvw6b688qi";
+      type = "gem";
+    };
+    version = "0.17.0.b6";
+  };
+  treetop = {
+    source = {
+      remotes = ["https://rubygems.org"];
+      sha256 = "1zqj5y0mvfvyz11nhsb4d5ch0i0rfcyj64qx19mw4qhg3hh8z9pz";
+      type = "gem";
+    };
+    version = "1.4.15";
+  };
+}
\ No newline at end of file
diff --git a/pkgs/applications/science/logic/lean/default.nix b/pkgs/applications/science/logic/lean/default.nix
index d1f4bc0a4145..af338338550f 100644
--- a/pkgs/applications/science/logic/lean/default.nix
+++ b/pkgs/applications/science/logic/lean/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   name = "lean-${version}";
-  version = "2016-12-08";
+  version = "2016-12-30";
 
   src = fetchFromGitHub {
     owner  = "leanprover";
     repo   = "lean";
-    rev    = "7b63d6566faaf1dc0f2c8e873c61f51dce9ab618";
-    sha256 = "0xxr7dnh7pmdbpxhl3cq9clwamxjk54zcxplsrz6xirk0qy7ga4l";
+    rev    = "fd4fffea27c442b12a45f664a8680ebb47482ca3";
+    sha256 = "1izbjxbr1nvv5kv2b7qklqjx2b1qmwrxhmvk0f2lrl9pxz9h0bmd";
   };
 
   buildInputs = [ gmp mpfr cmake gperftools ];
diff --git a/pkgs/applications/science/misc/fityk/default.nix b/pkgs/applications/science/misc/fityk/default.nix
index 7d9f8542eed3..1c1cac203f8b 100644
--- a/pkgs/applications/science/misc/fityk/default.nix
+++ b/pkgs/applications/science/misc/fityk/default.nix
@@ -3,7 +3,7 @@
 
 let
   name    = "fityk";
-  version = "1.3.0";
+  version = "1.3.1";
 in
 stdenv.mkDerivation {
   name = "${name}-${version}";
@@ -12,7 +12,7 @@ stdenv.mkDerivation {
     owner = "wojdyr";
     repo = "fityk";
     rev = "v${version}";
-    sha256 = "07xzhy47q5ddg1qn51qds4wp6r5g2cx8bla0hm0a9ipr2hg92lm9";
+    sha256 = "0kmrjjjwrh6xgw590awcd52b86kksmv6rfgih75zvpiavr1ygwsi";
   };
 
   buildInputs = [ autoreconfHook wxGTK30 boost lua zlib bzip2 xylib readline
diff --git a/pkgs/applications/science/physics/sherpa/default.nix b/pkgs/applications/science/physics/sherpa/default.nix
new file mode 100644
index 000000000000..d863964ad90a
--- /dev/null
+++ b/pkgs/applications/science/physics/sherpa/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, gfortran, sqlite }:
+
+stdenv.mkDerivation rec {
+  name = "sherpa-${version}";
+  version = "2.2.1";
+
+  src = fetchurl {
+    url = "http://www.hepforge.org/archive/sherpa/SHERPA-MC-${version}.tar.gz";
+    sha256 = "13vkz6w8kqyv8sgy3mxnlps5ykml5rnlj50vjj0pp9rgbl5y8ali";
+  };
+
+  buildInputs = [ gfortran sqlite ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "Simulation of High-Energy Reactions of PArticles in lepton-lepton, lepton-photon, photon-photon, lepton-hadron and hadron-hadron collisions";
+    license     = stdenv.lib.licenses.gpl2;
+    homepage    = https://sherpa.hepforge.org;
+    platforms   = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+  };
+}
diff --git a/pkgs/applications/version-management/cvsps/01_ignoretrunk.dpatch b/pkgs/applications/version-management/cvsps/01_ignoretrunk.dpatch
deleted file mode 100644
index 39185ae2bfa6..000000000000
--- a/pkgs/applications/version-management/cvsps/01_ignoretrunk.dpatch
+++ /dev/null
@@ -1,23 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 01_ignoretrunk.dpatch by  <crafterm@debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Ignore TRUNK branch name patch
-
-@DPATCH@
-
-diff -urN cvsps-2.1.orig/cvsps.c cvsps-2.1/cvsps.c
---- cvsps-2.1.orig/cvsps.c	2005-05-25 22:39:40.000000000 -0500
-+++ cvsps-2.1/cvsps.c	2005-06-19 23:07:20.000000000 -0500
-@@ -2104,6 +2109,11 @@
-     
-     if (!get_branch_ext(rev, eot, &leaf))
-     {
-+	if (strcmp(tag, "TRUNK") == 0)
-+	{
-+	    debug(DEBUG_STATUS, "ignoring the TRUNK branch/tag");
-+	    return;
-+	}
- 	debug(DEBUG_APPERROR, "malformed revision");
- 	exit(1);
-     }
diff --git a/pkgs/applications/version-management/cvsps/02_dynamicbufferalloc.dpatch b/pkgs/applications/version-management/cvsps/02_dynamicbufferalloc.dpatch
deleted file mode 100644
index 70ffb02a21aa..000000000000
--- a/pkgs/applications/version-management/cvsps/02_dynamicbufferalloc.dpatch
+++ /dev/null
@@ -1,125 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 02_dynamicbufferalloc.dpatch by  <crafterm@debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Dynamic buffer allocation
-
-@DPATCH@
-
-diff -urN cvsps-2.1-orig/cache.c cvsps-2.1/cache.c
---- cvsps-2.1-orig/cache.c	2005-05-25 22:39:40.000000000 -0500
-+++ cvsps-2.1/cache.c	2005-07-26 15:21:29.716569500 -0500
-@@ -108,10 +108,19 @@
-     int tag_flags = 0;
-     char branchbuff[LOG_STR_MAX] = "";
-     int branch_add = 0;
--    char logbuff[LOG_STR_MAX] = "";
-+    int logbufflen = LOG_STR_MAX + 1;
-+    char * logbuff = malloc(logbufflen);
-     time_t cache_date = -1;
-     int read_version;
- 
-+    if (logbuff == NULL)
-+    {
-+	debug(DEBUG_SYSERROR, "could not malloc %d bytes for logbuff in read_cache", logbufflen);
-+	exit(1);
-+    }
-+
-+    logbuff[0] = 0;
-+
-     if (!(fp = cache_open("r")))
- 	goto out;
- 
-@@ -299,8 +308,19 @@
- 	    else
- 	    {
- 		/* Make sure we have enough in the buffer */
--		if (strlen(logbuff)+strlen(buff)<LOG_STR_MAX)
--		    strcat(logbuff, buff);
-+		int len = strlen(buff);
-+		if (strlen(logbuff) + len >= LOG_STR_MAX)
-+		{
-+		    logbufflen += (len >= LOG_STR_MAX ? (len+1) : LOG_STR_MAX);
-+		    char * newlogbuff = realloc(logbuff, logbufflen);
-+		    if (newlogbuff == NULL)
-+		    {
-+			debug(DEBUG_SYSERROR, "could not realloc %d bytes for logbuff in read_cache", logbufflen);
-+			exit(1);
-+		    }
-+		    logbuff = newlogbuff;
-+		}
-+		strcat(logbuff, buff);
- 	    }
- 	    break;
- 	case CACHE_NEED_PS_MEMBERS:
-@@ -332,6 +352,7 @@
-  out_close:
-     fclose(fp);
-  out:
-+    free(logbuff);
-     return cache_date;
- }
- 
-diff -urN cvsps-2.1-orig/cvsps.c cvsps-2.1/cvsps.c
---- cvsps-2.1-orig/cvsps.c	2005-05-25 22:39:40.000000000 -0500
-+++ cvsps-2.1/cvsps.c	2005-07-26 15:22:02.558230700 -0500
-@@ -265,7 +265,8 @@
-     PatchSetMember * psm = NULL;
-     char datebuff[20];
-     char authbuff[AUTH_STR_MAX];
--    char logbuff[LOG_STR_MAX + 1];
-+    int logbufflen = LOG_STR_MAX + 1;
-+    char * logbuff = malloc(logbufflen);
-     int loglen = 0;
-     int have_log = 0;
-     char cmd[BUFSIZ];
-@@ -273,6 +274,12 @@
-     char use_rep_buff[PATH_MAX];
-     char * ltype;
- 
-+    if (logbuff == NULL)
-+    {
-+	debug(DEBUG_SYSERROR, "could not malloc %d bytes for logbuff in load_from_cvs", logbufflen);
-+	exit(1);
-+    }
-+
-     if (!no_rlog && !test_log_file && cvs_check_cap(CAP_HAVE_RLOG))
-     {
- 	ltype = "rlog";
-@@ -480,24 +487,22 @@
- 		 */
- 		if (have_log || !is_revision_metadata(buff))
- 		{
--		    /* if the log buffer is full, that's it.  
--		     * 
--		     * Also, read lines (fgets) always have \n in them
--		     * which we count on.  So if truncation happens,
--		     * be careful to put a \n on.
--		     * 
--		     * Buffer has LOG_STR_MAX + 1 for room for \0 if
--		     * necessary
--		     */
--		    if (loglen < LOG_STR_MAX)
-+		    /* If the log buffer is full, try to reallocate more. */
-+		    if (loglen < logbufflen)
- 		    {
- 			int len = strlen(buff);
- 			
--			if (len >= LOG_STR_MAX - loglen)
-+			if (len >= logbufflen - loglen)
- 			{
--			    debug(DEBUG_APPMSG1, "WARNING: maximum log length exceeded, truncating log");
--			    len = LOG_STR_MAX - loglen;
--			    buff[len - 1] = '\n';
-+			    debug(DEBUG_STATUS, "reallocating logbufflen to %d bytes for file %s", logbufflen, file->filename);
-+			    logbufflen += (len >= LOG_STR_MAX ? (len+1) : LOG_STR_MAX);
-+			    char * newlogbuff = realloc(logbuff, logbufflen);
-+			    if (newlogbuff == NULL)
-+			    {
-+				debug(DEBUG_SYSERROR, "could not realloc %d bytes for logbuff in load_from_cvs", logbufflen);
-+				exit(1);
-+			    }
-+			    logbuff = newlogbuff;
- 			}
- 
- 			debug(DEBUG_STATUS, "appending %s to log", buff);
diff --git a/pkgs/applications/version-management/cvsps/03_diffoptstypo.dpatch b/pkgs/applications/version-management/cvsps/03_diffoptstypo.dpatch
deleted file mode 100644
index eb3818ed97e9..000000000000
--- a/pkgs/applications/version-management/cvsps/03_diffoptstypo.dpatch
+++ /dev/null
@@ -1,19 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## 03_diffoptstypo.dpatch by  <crafterm@debian.org>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Diff opts typo fix
-
-@DPATCH@
-
---- cvsps-2.1-orig/cvsps.1	2005-05-26 05:39:40.000000000 +0200
-+++ cvsps-2.1/cvsps.1	2005-07-28 15:17:48.885112048 +0200
-@@ -83,7 +83,7 @@
- disable the use of rlog internally.  Note: rlog is
- required for stable PatchSet numbering.  Use with care.
- .TP
--.B \-\-diffs\-opts <option string>
-+.B \-\-diff\-opts <option string>
- send a custom set of options to diff, for example to increase
- the number of context lines, or change the diff format.
- .TP
diff --git a/pkgs/applications/version-management/cvsps/default.nix b/pkgs/applications/version-management/cvsps/default.nix
index 9bc4401e0681..aa3bcb273949 100644
--- a/pkgs/applications/version-management/cvsps/default.nix
+++ b/pkgs/applications/version-management/cvsps/default.nix
@@ -1,22 +1,53 @@
-{ fetchurl, stdenv, cvs, zlib }:
+{ stdenv, fetchurl, fetchpatch, cvs, zlib }:
 
 stdenv.mkDerivation rec {
-  name = "cvsps-2.1";
+  name = "cvsps-${version}";
+  version = "2.1";
+
   src = fetchurl {
-    url = "http://www.cobite.com/cvsps/${name}.tar.gz";
+    url = "mirror://debian/pool/main/c/cvsps/cvsps_${version}.orig.tar.gz";
     sha256 = "0nh7q7zcmagx0i63h6fqqkkq9i55k77myvb8h6jn2f266f5iklwi";
   };
 
-  # Patches from Debian's `cvsps-2.1-4'.
-  patches = [ ./01_ignoretrunk.dpatch
-              ./02_dynamicbufferalloc.dpatch
-	      ./03_diffoptstypo.dpatch ];
+  # Patches from https://sources.debian.net/src/cvsps/2.1-7/debian/patches
+  patches =
+    [ (fetchpatch {
+        url = "https://sources.debian.net/data/main/c/cvsps/2.1-7/debian/patches/01_ignoretrunk.patch";
+        sha256 = "1gzb97dw2a6bm0bmim7p7wvsn0r82y3a8n22ln6rbbkkd8vlnzcb";
+      })
+
+      (fetchpatch {
+        url = "https://sources.debian.net/data/main/c/cvsps/2.1-7/debian/patches/02_dynamicbufferalloc.patch";
+        sha256 = "0dm7azxnw0g9pdqkb3y4y2h047zgrclbh40av6c868wfp2j6l9sc";
+      })
+
+      (fetchpatch {
+        url = "https://sources.debian.net/data/main/c/cvsps/2.1-7/debian/patches/03_diffoptstypo.patch";
+        sha256 = "06n8652g7inpv8cgqir7ijq00qw1fr0v44m2pbmgx7ilmna2vrcw";
+      })
+
+      (fetchpatch {
+        url = "https://sources.debian.net/data/main/c/cvsps/2.1-7/debian/patches/05-inet_addr_fix.patch";
+        sha256 = "10w6px96dz8bb69asjzshvp787ccazmqnjsggqc4gwdal95q3cn7";
+      })
+
+      (fetchpatch {
+        url = "https://sources.debian.net/data/main/c/cvsps/2.1-7/debian/patches/fix-makefile";
+        sha256 = "0m92b55hgldwg6lwdaybbj0n3lw1b3wj2xkk1cz1ywq073bpf3jm";
+      })
+
+      (fetchpatch {
+        url = "https://sources.debian.net/data/main/c/cvsps/2.1-7/debian/patches/fix-manpage";
+        sha256 = "0gky14rhx82wv0gj8bkc74ki5xilhv5i3k1jc7khklr4lb6mmhpx";
+      })
+    ];
 
   buildInputs = [ cvs zlib ];
 
-  installPhase = "make install prefix=$out";
+  installFlags = [ "prefix=$(out)" ];
 
   meta = {
+    description = ''A tool to generate CVS patch set information'';
     longDescription = ''
       CVSps is a program for generating `patchset' information from a
       CVS repository.  A patchset in this case is defined as a set of
@@ -25,5 +56,6 @@ stdenv.mkDerivation rec {
     '';
     homepage = http://www.cobite.com/cvsps/;
     license = stdenv.lib.licenses.gpl2;
+    platforms = stdenv.lib.platforms.unix;
   };
 }
diff --git a/pkgs/applications/version-management/git-and-tools/transcrypt/default.nix b/pkgs/applications/version-management/git-and-tools/transcrypt/default.nix
index 3047ca023423..44a00238a5c1 100644
--- a/pkgs/applications/version-management/git-and-tools/transcrypt/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/transcrypt/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   name = "transcrypt-${version}";
-  version = "0.9.9";
+  version = "1.0.0";
 
   src = fetchFromGitHub {
     owner = "elasticdog";
     repo = "transcrypt";
     rev = "v${version}";
-    sha256 = "0brsgj3qmvkgxzqqamk8krwyarwff1dlb3jjd09snnbfl0kdq1a5";
+    sha256 = "195hi8lq1i9rfcwj3raw4pa7fhvv3ghznxp4crmbjm7c0sqilcpd";
   };
 
   buildInputs = [ git makeWrapper openssl ];
diff --git a/pkgs/applications/version-management/pijul/default.nix b/pkgs/applications/version-management/pijul/default.nix
index 4f1f28a7aac7..04a91a6b4a44 100644
--- a/pkgs/applications/version-management/pijul/default.nix
+++ b/pkgs/applications/version-management/pijul/default.nix
@@ -33,5 +33,6 @@ buildRustPackage rec {
     license = licenses.gpl3;
     platforms = stdenv.lib.platforms.x86_64;  # i686 builds fail due to lmdb
     maintainers = with maintainers; [ puffnfresh ];
+    broken = true;
   };
 }
diff --git a/pkgs/build-support/replace-dependency.nix b/pkgs/build-support/replace-dependency.nix
index b0174ca24ab8..15ab50bf3974 100644
--- a/pkgs/build-support/replace-dependency.nix
+++ b/pkgs/build-support/replace-dependency.nix
@@ -22,7 +22,7 @@
 with lib;
 
 let
-  warn = if verbose then builtins.trace else (x:y:y);
+  warn = if verbose then builtins.trace else (x: y: y);
   references = import (runCommand "references.nix" { exportReferencesGraph = [ "graph" drv ]; } ''
     (echo {
     while read path
diff --git a/pkgs/development/compilers/rust/bootstrap.nix b/pkgs/development/compilers/rust/bootstrap.nix
index b912a9d7933c..93deee01e56e 100644
--- a/pkgs/development/compilers/rust/bootstrap.nix
+++ b/pkgs/development/compilers/rust/bootstrap.nix
@@ -14,16 +14,16 @@ let
     then "x86_64-apple-darwin"
     else abort "missing boostrap url for platform ${stdenv.system}";
 
-  # fetch hashes by running `print-hashes.sh 1.12.1`
+  # fetch hashes by running `print-hashes.sh 1.13.0`
   bootstrapHash =
     if stdenv.system == "i686-linux"
-    then "ede9b9d14d1ddbc29975d1ead73fcf2758719b4b371363afe1c32eb8d6e96bb3"
+    then "239734113f6750d31085c7a08c260d492991cc1ef10817b6d44154515f3f9439"
     else if stdenv.system == "x86_64-linux"
-    then "9e546aec13e389429ba2d86c8f4e67eba5af146c979e4faa16ffb40ddaf9984c"
+    then "95f4c372b1b81ac1038161e87e932dd7ab875d25c167a861c3949b0f6a65516d"
     else if stdenv.system == "i686-darwin"
-    then "2648645c4fe1ecf36beb7de63501dd99e9547a7a6d5683acf2693b919a550b69"
+    then "f6e01cab3bf8d0a6fe9cc2447aa10ce894569daaa72d44063c229da918b96023"
     else if stdenv.system == "x86_64-darwin"
-    then "0ac5e58dba3d24bf09dcc90eaac02d2df053122b0def945ec4cfe36ac6d4d011"
+    then "f538ca5732b844cf7f00fc4aaaf200a49a845b58b4ec8aef38da0b00e2cf6efe"
     else throw "missing boostrap hash for platform ${stdenv.system}";
 
   needsPatchelf = stdenv.isLinux;
@@ -33,7 +33,7 @@ let
      sha256 = bootstrapHash;
   };
 
-  version = "1.12.1";
+  version = "1.13.0";
 in
 
 rec {
diff --git a/pkgs/development/compilers/rust/cargo.nix b/pkgs/development/compilers/rust/cargo.nix
index 537764ebca2b..2b544d754d79 100644
--- a/pkgs/development/compilers/rust/cargo.nix
+++ b/pkgs/development/compilers/rust/cargo.nix
@@ -24,7 +24,7 @@ rustPlatform.buildRustPackage rec {
   LIBGIT2_SYS_USE_PKG_CONFIG=1;
 
   configurePhase = ''
-    ./configure --enable-optimize --prefix=$out --local-cargo=${rustPlatform.rust.cargo}/bin/cargo
+    ./configure --enable-optimize --prefix=$out
   '';
 
   buildPhase = "make";
@@ -60,7 +60,7 @@ rustPlatform.buildRustPackage rec {
     cargo test
   '';
 
-  # Disable check phase as there are failures (author_prefers_cargo test fails)
+  # Disable check phase as there are failures (4 tests fail)
   doCheck = false;
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix
index c090cc07d01f..4d9668da2e33 100644
--- a/pkgs/development/compilers/rust/default.nix
+++ b/pkgs/development/compilers/rust/default.nix
@@ -7,12 +7,12 @@ in
 
 rec {
   rustc = callPackage ./rustc.nix {
-    shortVersion = "1.13";
+    shortVersion = "1.14";
     isRelease = true;
     forceBundledLLVM = false;
     configureFlags = [ "--release-channel=stable" ];
-    srcRev = "2c6933acc05c61e041be764cb1331f6281993f3f";
-    srcSha = "1w0alyyc29cy2lczrqvg1kfycjxy0xg8fpzdac80m88fxpv23glp";
+    srcRev = "e8a0123241f0d397d39cd18fcc4e5e7edde22730";
+    srcSha = "1sla3gnx9dqvivnyhvwz299mc3jmdy805q2y5xpmpi1vhfk0bafx";
 
     patches = [
       ./patches/disable-lockfile-check-stable.patch
@@ -25,10 +25,10 @@ rec {
   };
 
   cargo = callPackage ./cargo.nix rec {
-    version = "0.14.0";
-    srcRev = "eca9e159b6b0d484788ac757cf23052eba75af55";
-    srcSha = "1zm5rzw1mvixnkzr4775pcxx6k235qqxbysyp179cbxsw3dm045s";
-    depsSha256 = "0gpn0cpwgpzwhc359qn6qplx371ag9pqbwayhqrsydk1zm5bm3zr";
+    version = "0.15.0";
+    srcRev = "298a0127f703d4c2500bb06d309488b92ef84ae1";
+    srcSha = "0v74r18vszapw2rfk7w72czkp9gbq4s1sggphm5vx0kyh058dxc5";
+    depsSha256 = "0ksiywli8r4lkprfknm0yz1w27060psi3db6wblqmi8sckzdm44h";
 
     inherit rustc; # the rustc that will be wrapped by cargo
     inherit rustPlatform; # used to build cargo
diff --git a/pkgs/development/compilers/rust/patches/disable-lockfile-check-stable.patch b/pkgs/development/compilers/rust/patches/disable-lockfile-check-stable.patch
index 0c01cb1a7f19..c5009b7ba672 100644
--- a/pkgs/development/compilers/rust/patches/disable-lockfile-check-stable.patch
+++ b/pkgs/development/compilers/rust/patches/disable-lockfile-check-stable.patch
@@ -11,12 +11,13 @@ diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs
 index 2839bbd..50142ff 100644
 --- a/src/tools/tidy/src/main.rs
 +++ b/src/tools/tidy/src/main.rs
-@@ -47,7 +47,7 @@ fn main() {
+@@ -48,7 +48,7 @@ fn main() {
      errors::check(&path, &mut bad);
      cargo::check(&path, &mut bad);
      features::check(&path, &mut bad);
 -    cargo_lock::check(&path, &mut bad);
 +    //cargo_lock::check(&path, &mut bad);
+     pal::check(&path, &mut bad);
  
      if bad {
          panic!("some tidy checks failed");
diff --git a/pkgs/development/idris-modules/httpclient.nix b/pkgs/development/idris-modules/httpclient.nix
new file mode 100644
index 000000000000..ec41956b9634
--- /dev/null
+++ b/pkgs/development/idris-modules/httpclient.nix
@@ -0,0 +1,30 @@
+{ pkgs
+, build-idris-package
+, fetchFromGitHub
+, lightyear
+, contrib
+, lib
+, idris
+}:
+
+let
+  date = "2016-12-20";
+in
+build-idris-package {
+  name = "httpclient-${date}";
+
+  src = fetchFromGitHub {
+    owner = "justjoheinz";
+    repo = "idris-httpclient";
+    rev = "4a7296d572d7f7fde87d27da07d5c9566dc4ff14";
+    sha256 = "0sy0q7gri9lwbqdmx9720pby3w1470w7wzn62bf2rir532219hhl";
+  };
+
+  propagatedBuildInputs = [ pkgs.curl lightyear contrib ];
+
+  meta = {
+    description = "HTTP Client for Idris";
+    homepage = https://github.com/justjoheinz/idris-httpclient;
+    inherit (idris.meta) platforms;
+  };
+}
diff --git a/pkgs/development/libraries/gmime/default.nix b/pkgs/development/libraries/gmime/default.nix
index 4239b4458b8f..8796a5f67404 100644
--- a/pkgs/development/libraries/gmime/default.nix
+++ b/pkgs/development/libraries/gmime/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, glib, zlib, libgpgerror }:
+{ stdenv, fetchurl, pkgconfig, glib, zlib, libgpgerror, gobjectIntrospection }:
 
 stdenv.mkDerivation rec {
   name = "gmime-2.6.20";
@@ -10,8 +10,9 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "dev" ];
 
-  nativeBuildInputs = [ pkgconfig ];
+  nativeBuildInputs = [ pkgconfig gobjectIntrospection ];
   propagatedBuildInputs = [ glib zlib libgpgerror ];
+  configureFlags = [ "--enable-introspection=yes" ];
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/kirigami/v2.nix b/pkgs/development/libraries/kirigami/v2.nix
new file mode 100644
index 000000000000..8476eebfd501
--- /dev/null
+++ b/pkgs/development/libraries/kirigami/v2.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, cmake, ecm, pkgconfig, plasma-framework, qtbase, qtquickcontrols2 }:
+
+stdenv.mkDerivation rec {
+  pname = "kirigami";
+  version = "1.90.0";
+  name = "${pname}2-${version}";
+
+  src = fetchurl {
+    url = "mirror://kde/unstable/${pname}/${pname}-${version}.tar.xz";
+    sha256 = "a5ca094a60d1cc48116cbed07bbe68be016773d2488a91e278859c90f59e64a8";
+  };
+
+  buildInputs = [ qtbase qtquickcontrols2 plasma-framework ];
+
+  nativeBuildInputs = [ cmake pkgconfig ecm ];
+
+  meta = with stdenv.lib; {
+    license = licenses.lgpl2;
+    homepage = http://www.kde.org;
+    maintainers = with maintainers; [ ttuegel peterhoeg ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/development/libraries/libgphoto2/default.nix b/pkgs/development/libraries/libgphoto2/default.nix
index 68736608ad4f..e9b6968d13bc 100644
--- a/pkgs/development/libraries/libgphoto2/default.nix
+++ b/pkgs/development/libraries/libgphoto2/default.nix
@@ -25,6 +25,11 @@ stdenv.mkDerivation rec {
 
   hardeningDisable = [ "format" ];
 
+  postInstall = ''
+    mkdir -p $out/lib/udev/rules.d
+    $out/lib/libgphoto2/print-camera-list udev-rules version 175 group camera >$out/lib/udev/rules.d/40-gphoto2.rules
+  '';
+
   meta = {
     homepage = http://www.gphoto.org/proj/libgphoto2/;
     description = "A library for accessing digital cameras";
@@ -41,4 +46,3 @@ stdenv.mkDerivation rec {
     maintainers = with stdenv.lib.maintainers; [ jcumming ];
   };
 }
-
diff --git a/pkgs/development/libraries/libmd/default.nix b/pkgs/development/libraries/libmd/default.nix
new file mode 100644
index 000000000000..989670bc0594
--- /dev/null
+++ b/pkgs/development/libraries/libmd/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "${pname}-${version}";
+  pname = "libmd";
+  version = "0.0.0";
+
+  src = fetchurl {
+    url = "https://archive.hadrons.org/software/${pname}/${pname}-${version}.tar.xz";
+    sha256 = "121s73pgbqsnmy6xblbrkj9y44c5zzzpf2hcmh6zvcvg4dk26gzx";
+  };
+
+  buildInputs = [ autoreconfHook ];
+
+  # Writing the version to a .dist-version file is required for the get-version
+  # shell script because fetchgit removes the .git directory.
+  prePatch = ''
+    echo '${version}' > .dist-version;
+  '';
+
+  autoreconfPhase = "./autogen";
+
+  meta = with stdenv.lib; {
+    homepage = "https://www.hadrons.org/software/${pname}/";
+    description = "Message Digest functions from BSD systems";
+    license = with licenses; [ bsd3 bsd2 isc beerware publicDomain ];
+    maintainers = with maintainers; [ primeos ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/development/libraries/openbabel/default.nix b/pkgs/development/libraries/openbabel/default.nix
index 3c4cd8bb6c8d..b124e592f367 100644
--- a/pkgs/development/libraries/openbabel/default.nix
+++ b/pkgs/development/libraries/openbabel/default.nix
@@ -1,23 +1,23 @@
-{stdenv, fetchurl, cmake, zlib, libxml2, eigen, python, cairo, pkgconfig }:
+{stdenv, fetchurl, cmake, zlib, libxml2, eigen, python, cairo, pcre, pkgconfig }:
 
 stdenv.mkDerivation rec {
-  name = "openbabel-2.3.2";
+  name = "openbabel-${version}";
+  version = "2.4.1";
 
   src = fetchurl {
-    url = "mirror://sourceforge/openbabel/${name}.tar.gz";
-    sha256 = "122if0jkm71ngd1b0dic8k567b3j2hcikbwnpxgchv5ag5ka5b2f";
+    url = "https://github.com/openbabel/openbabel/archive/openbabel-${stdenv.lib.replaceStrings ["."] ["-"] version}.tar.gz";
+    sha256 = "0xm7y859ivq2cp0q08mwshfxm0jq31xkyr4x8s0j6l7khf57yk2r";
   };
 
   # TODO : perl & python bindings;
   # TODO : wxGTK: I have no time to compile
   # TODO : separate lib and apps
-  buildInputs = [ zlib libxml2 eigen python cairo ];
+  buildInputs = [ zlib libxml2 eigen python cairo pcre ];
 
   nativeBuildInputs = [ cmake pkgconfig ];
 
   meta = {
     platforms = stdenv.lib.platforms.all;
     maintainers = [ stdenv.lib.maintainers.urkud ];
-    broken = true; # doesn't build with GCC 5; fix in GitHub
   };
 }
diff --git a/pkgs/development/libraries/physics/fastnlo/default.nix b/pkgs/development/libraries/physics/fastnlo/default.nix
new file mode 100644
index 000000000000..703681337063
--- /dev/null
+++ b/pkgs/development/libraries/physics/fastnlo/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchurl, boost, lhapdf, root, yoda }:
+
+stdenv.mkDerivation rec {
+  name = "fastnlo_toolkit-${version}";
+  version = "2.3.1pre-2212";
+
+  src = fetchurl {
+    url = "http://fastnlo.hepforge.org/code/v23/${name}.tar.gz";
+    sha256 = "0xgnnwc002awvz6dhn7792jc8kdff843yjgvwmgcs60yvcj6blgp";
+  };
+
+  buildInputs = [ boost lhapdf root yoda ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    descritption = "A computer code to create and evaluate fast interpolation tables of pre-computed coefficients in perturbation theory for observables in hadron-induced processes";
+    license      = stdenv.lib.licenses.gpl3;
+    homepage     = http://fastnlo.hepforge.org;
+    platforms    = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+  };
+}
diff --git a/pkgs/development/libraries/physics/mcgrid/default.nix b/pkgs/development/libraries/physics/mcgrid/default.nix
new file mode 100644
index 000000000000..033bf2f214fc
--- /dev/null
+++ b/pkgs/development/libraries/physics/mcgrid/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, fastnlo, rivet, sherpa }:
+
+stdenv.mkDerivation rec {
+  name = "mcgrid-${version}";
+  version = "2.0.2";
+
+  src = fetchurl {
+    url = "http://www.hepforge.org/archive/mcgrid/${name}.tar.gz";
+    sha256 = "1mw82x7zqbdchnd6shj3dirsav5i2cndp2hjwb8a8xdh4xh9zvfy";
+  };
+
+  buildInputs = [ fastnlo rivet ];
+
+  preConfigure = ''
+    substituteInPlace mcgrid.pc.in \
+      --replace "Cflags:" "Cflags: -std=c++11"
+  '';
+
+  CXXFLAGS = "-std=c++11";
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "A software package that provides access to the APPLgrid and fastNLO interpolation tools for Monte Carlo event generator codes, allowing for fast and flexible variations of scales, coupling parameters and PDFs in cutting edge leading- and next-to-leading-order QCD calculations";
+    license     = stdenv.lib.licenses.gpl3;
+    homepage    = http://mcgrid.hepforge.org;
+    platforms   = stdenv.lib.platforms.unix;
+    maintainers = with stdenv.lib.maintainers; [ veprbl ];
+  };
+}
diff --git a/pkgs/development/libraries/physics/rivet/default.nix b/pkgs/development/libraries/physics/rivet/default.nix
index 775ee75f61fc..91b5881d1a8b 100644
--- a/pkgs/development/libraries/physics/rivet/default.nix
+++ b/pkgs/development/libraries/physics/rivet/default.nix
@@ -2,19 +2,16 @@
 
 stdenv.mkDerivation rec {
   name = "rivet-${version}";
-  version = "2.5.2";
+  version = "2.5.3";
 
   src = fetchurl {
     url = "http://www.hepforge.org/archive/rivet/Rivet-${version}.tar.bz2";
-    sha256 = "01agf0bswqvci8nwp67kvrlwc2k0sg1s0lxpq2a9q58l99v2gakh";
+    sha256 = "1r0x575ivvm68nnh9qlfvdra5298i047qcbxcg37ki2aaqq07qcr";
   };
 
-  pythonPath = []; # python wrapper support
+  postPatch = "patchShebangs ./src/Analyses/cat_with_lines";
 
-  patches = [
-    ./key_val.patch
-    ./zaxis_fix.patch
-  ];
+  pythonPath = []; # python wrapper support
 
   latex = texlive.combine { inherit (texlive)
     scheme-basic
diff --git a/pkgs/development/libraries/qt-5/5.7/default.nix b/pkgs/development/libraries/qt-5/5.7/default.nix
index 9c35e814a04e..d62bd3d1b51d 100644
--- a/pkgs/development/libraries/qt-5/5.7/default.nix
+++ b/pkgs/development/libraries/qt-5/5.7/default.nix
@@ -82,6 +82,7 @@ let
         inherit (pkgs.gst_all_1) gstreamer gst-plugins-base;
       };
       qtquickcontrols = callPackage ./qtquickcontrols.nix {};
+      qtquickcontrols2 = callPackage ./qtquickcontrols2.nix {};
       qtscript = callPackage ./qtscript {};
       qtsensors = callPackage ./qtsensors.nix {};
       qtserialport = callPackage ./qtserialport {};
diff --git a/pkgs/development/libraries/qt-5/5.7/qtquickcontrols2.nix b/pkgs/development/libraries/qt-5/5.7/qtquickcontrols2.nix
new file mode 100644
index 000000000000..19750f2fd99d
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtquickcontrols2.nix
@@ -0,0 +1,6 @@
+{ qtSubmodule, qtdeclarative }:
+
+qtSubmodule {
+  name = "qtquickcontrols2";
+  qtInputs = [ qtdeclarative ];
+}
diff --git a/pkgs/development/libraries/science/math/clblas/cuda/default.nix b/pkgs/development/libraries/science/math/clblas/cuda/default.nix
index c142514b2625..6d3faa2fb7ff 100644
--- a/pkgs/development/libraries/science/math/clblas/cuda/default.nix
+++ b/pkgs/development/libraries/science/math/clblas/cuda/default.nix
@@ -7,6 +7,7 @@
 , python
 , cudatoolkit
 , nvidia_x11
+, gtest
 }:
 
 stdenv.mkDerivation rec {
@@ -40,6 +41,7 @@ stdenv.mkDerivation rec {
     cmake ../src -DCMAKE_INSTALL_PREFIX=$out \
                  -DCMAKE_BUILD_TYPE=Release \
                  -DOPENCL_ROOT=${cudatoolkit} \
+                 -DUSE_SYSTEM_GTEST=ON
   '';
 
   dontStrip = true; 
@@ -51,6 +53,7 @@ stdenv.mkDerivation rec {
     python
     cudatoolkit
     nvidia_x11
+    gtest
   ]; 
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/wxGTK-2.9/default.nix b/pkgs/development/libraries/wxGTK-2.9/default.nix
index 82ba9daed80f..b2f40978f51b 100644
--- a/pkgs/development/libraries/wxGTK-2.9/default.nix
+++ b/pkgs/development/libraries/wxGTK-2.9/default.nix
@@ -1,6 +1,7 @@
 { stdenv, fetchurl, pkgconfig, gtk2, libXinerama, libSM, libXxf86vm, xf86vidmodeproto
 , gstreamer, gst_plugins_base, GConf, setfile
-, withMesa ? true, mesa ? null, compat24 ? false, compat26 ? true, unicode ? true,
+, withMesa ? true, mesa ? null, compat24 ? false, compat26 ? true, unicode ? true
+, Carbon ? null, Cocoa ? null, Kernel ? null, QuickTime ? null, AGL ? null
 }:
 
 assert withMesa -> mesa != null;
@@ -22,10 +23,12 @@ stdenv.mkDerivation {
     [ gtk2 libXinerama libSM libXxf86vm xf86vidmodeproto gstreamer
       gst_plugins_base GConf ]
     ++ optional withMesa mesa
-    ++ optional stdenv.isDarwin setfile;
+    ++ optionals stdenv.isDarwin [ setfile Carbon Cocoa Kernel QuickTime ];
 
   nativeBuildInputs = [ pkgconfig ];
 
+  propagatedBuildInputs = optional stdenv.isDarwin AGL;
+
   configureFlags =
     [ "--enable-gtk2" "--disable-precomp-headers" "--enable-mediactrl"
       (if compat24 then "--enable-compat24" else "--disable-compat24")
@@ -34,7 +37,7 @@ stdenv.mkDerivation {
     ++ optional withMesa "--with-opengl"
     ++ optionals stdenv.isDarwin
       # allow building on 64-bit
-      [ "--with-cocoa" "--enable-universal-binaries" ];
+      [ "--with-cocoa" "--enable-universal-binaries" "--with-macosx-version-min=10.7" ];
 
   SEARCH_LIB = optionalString withMesa "${mesa}/lib";
 
@@ -46,6 +49,9 @@ stdenv.mkDerivation {
     substituteInPlace configure --replace \
       'ac_cv_prog_SETFILE="/Developer/Tools/SetFile"' \
       'ac_cv_prog_SETFILE="${setfile}/bin/SetFile"'
+    substituteInPlace configure --replace \
+      "-framework System" \
+      -lSystem
   '';
 
   postInstall = "
@@ -60,6 +66,6 @@ stdenv.mkDerivation {
   enableParallelBuilding = true;
   
   meta = {
-    platforms = stdenv.lib.platforms.linux;
+    platforms = with stdenv.lib.platforms; darwin ++ linux;
   };
 }
diff --git a/pkgs/development/libraries/wxGTK-3.0/default.nix b/pkgs/development/libraries/wxGTK-3.0/default.nix
index 313e99f1087f..5c45b29ec5cd 100644
--- a/pkgs/development/libraries/wxGTK-3.0/default.nix
+++ b/pkgs/development/libraries/wxGTK-3.0/default.nix
@@ -2,6 +2,7 @@
 , gstreamer, gst_plugins_base, GConf, setfile
 , withMesa ? true, mesa ? null, compat24 ? false, compat26 ? true, unicode ? true
 , withWebKit ? false, webkitgtk2 ? null
+, AGL ? null, Carbon ? null, Cocoa ? null, Kernel ? null, QTKit ? null
 }:
 
 
@@ -26,10 +27,12 @@ stdenv.mkDerivation {
       gst_plugins_base GConf ]
     ++ optional withMesa mesa
     ++ optional withWebKit webkitgtk2
-    ++ optional stdenv.isDarwin setfile;
+    ++ optionals stdenv.isDarwin [ setfile Carbon Cocoa Kernel QTKit ];
 
   nativeBuildInputs = [ pkgconfig ];
 
+  propagatedBuildInputs = optional stdenv.isDarwin AGL;
+
   configureFlags =
     [ "--enable-gtk2" "--disable-precomp-headers" "--enable-mediactrl"
       (if compat24 then "--enable-compat24" else "--disable-compat24")
@@ -38,7 +41,7 @@ stdenv.mkDerivation {
     ++ optional withMesa "--with-opengl"
     ++ optionals stdenv.isDarwin
       # allow building on 64-bit
-      [ "--with-cocoa" "--enable-universal-binaries" ]
+      [ "--with-cocoa" "--enable-universal-binaries" "--with-macosx-version-min=10.7" ]
     ++ optionals withWebKit
       ["--enable-webview" "--enable-webview-webkit"];
 
@@ -52,6 +55,9 @@ stdenv.mkDerivation {
     substituteInPlace configure --replace \
       'ac_cv_prog_SETFILE="/Developer/Tools/SetFile"' \
       'ac_cv_prog_SETFILE="${setfile}/bin/SetFile"'
+    substituteInPlace configure --replace \
+      "-framework System" \
+      -lSystem
   '';
 
   postInstall = "
@@ -66,6 +72,6 @@ stdenv.mkDerivation {
   enableParallelBuilding = true;
   
   meta = {
-    platforms = stdenv.lib.platforms.linux;
+    platforms = with stdenv.lib.platforms; darwin ++ linux;
   };
 }
diff --git a/pkgs/development/libraries/xylib/default.nix b/pkgs/development/libraries/xylib/default.nix
index 030e2f0857bf..c9c84f4e1d89 100644
--- a/pkgs/development/libraries/xylib/default.nix
+++ b/pkgs/development/libraries/xylib/default.nix
@@ -1,15 +1,15 @@
-{ stdenv, fetchurl, boost, zlib, bzip2 }:
+{ stdenv, fetchurl, boost, zlib, bzip2, wxGTK30 }:
 
 stdenv.mkDerivation rec {
   name = "xylib-${version}";
-  version = "1.4";
+  version = "1.5";
 
   src = fetchurl {
-    url = "https://github.com/wojdyr/xylib/releases/download/v${version}/${name}-${version}.tar.bz2";
-    sha256 = "09j426qjbg3damch1hfw16j992kn2hj8gs4lpvqgfqdw61kvqivh";
+    url = "https://github.com/wojdyr/xylib/releases/download/v${version}/${name}.tar.bz2";
+    sha256 = "1r2kx80zhdvz39k6h2fsncm2742xxvxl3z8a3fnr13jl9sl7mnnd";
   };
 
-  buildInputs = [ boost zlib bzip2 ];
+  buildInputs = [ boost zlib bzip2 wxGTK30 ];
 
   meta = with stdenv.lib; {
     description = "Portable library for reading files that contain x-y data from powder diffraction, spectroscopy and other experimental methods";
diff --git a/pkgs/development/ocaml-modules/eliom/default.nix b/pkgs/development/ocaml-modules/eliom/default.nix
index 219f104271d3..293faad2301d 100644
--- a/pkgs/development/ocaml-modules/eliom/default.nix
+++ b/pkgs/development/ocaml-modules/eliom/default.nix
@@ -1,15 +1,10 @@
-{ stdenv, fetchurl, ocaml, findlib, which, ocsigen_server, ocsigen_deriving,
+{ buildOcaml, stdenv, fetchurl, which, ocsigen_server, ocsigen_deriving, ocaml,
   js_of_ocaml, ocaml_react, ocaml_lwt, calendar, cryptokit, tyxml,
   ipaddr, ocamlnet, ocaml_ssl, ocaml_pcre, ocaml_optcomp,
-  reactivedata, opam, ppx_tools, camlp4}:
+  reactivedata, opam, ppx_tools, ppx_deriving, camlp4}:
 
-let ocamlVersion = (stdenv.lib.getVersion ocaml);
-  in
-
-(
-assert stdenv.lib.versionAtLeast ocamlVersion "4";
-
-stdenv.mkDerivation rec
+let ocamlVersion = (stdenv.lib.getVersion ocaml); in
+buildOcaml rec
 {
   pname = "eliom";
   version = "5.0.0";
@@ -22,12 +17,11 @@ stdenv.mkDerivation rec
 
   patches = [ ./camlp4.patch ];
 
-  buildInputs = [ocaml which ocsigen_server findlib ocsigen_deriving
-                 js_of_ocaml ocaml_optcomp opam ppx_tools camlp4 ];
+  buildInputs = [ which ocaml_optcomp opam ppx_tools camlp4 ];
 
-  propagatedBuildInputs = [ ocaml_lwt reactivedata tyxml ipaddr
-                            calendar cryptokit ocamlnet ocaml_react ocaml_ssl
-                            ocaml_pcre ];
+  propagatedBuildInputs = [ ocaml_lwt reactivedata tyxml ipaddr ocsigen_server ppx_deriving
+                            ocsigen_deriving js_of_ocaml
+                            calendar cryptokit ocamlnet ocaml_react ocaml_ssl ocaml_pcre ];
 
   preConfigure = stdenv.lib.optionalString (!stdenv.lib.versionAtLeast ocamlVersion "4.02") ''
       export PPX=false
@@ -57,8 +51,6 @@ stdenv.mkDerivation rec
 
     license = stdenv.lib.licenses.lgpl21;
 
-    platforms = ocaml.meta.platforms or [];
-
     maintainers = [ stdenv.lib.maintainers.gal_bolle ];
   };
-})
+}
diff --git a/pkgs/development/ocaml-modules/pgocaml/default.nix b/pkgs/development/ocaml-modules/pgocaml/default.nix
index 6b9ae97ad54e..a8b3ed158625 100644
--- a/pkgs/development/ocaml-modules/pgocaml/default.nix
+++ b/pkgs/development/ocaml-modules/pgocaml/default.nix
@@ -1,14 +1,17 @@
-{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, camlp4, calendar, csv, ocaml_pcre }:
+{ stdenv, fetchurl, buildOcaml, calendar, csv, re }:
 
-stdenv.mkDerivation {
-  name = "ocaml-pgocaml-2.2";
+buildOcaml {
+  name = "pgocaml";
+  version = "2.3";
   src = fetchurl {
-    url = http://forge.ocamlcore.org/frs/download.php/1506/pgocaml-2.2.tgz;
-    sha256 = "0x0dhlz2rqxpwfdqi384f9fn0ng2irifadmxfm2b4gcz7y1cl9rh";
+    url = https://github.com/darioteixeira/pgocaml/archive/v2.3.tar.gz;
+    sha256 = "18lymxlvcf4nwxawkidq3pilsp5rhl0l8ifq6pjk3ssjlx9w53pg";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild camlp4 ];
-  propagatedBuildInputs = [ calendar csv ocaml_pcre ];
+  buildInputs = [ ];
+  propagatedBuildInputs = [ calendar csv re ];
+
+  configureFlags = [ "--enable-p4" ];
 
   createFindlibDestdir = true;
 
@@ -16,7 +19,6 @@ stdenv.mkDerivation {
     description = "An interface to PostgreSQL databases for OCaml applications";
     homepage = http://pgocaml.forge.ocamlcore.org/;
     license = licenses.lgpl2;
-    platforms = ocaml.meta.platforms or [];
     maintainers = with maintainers; [ vbgl ];
   };
 }
diff --git a/pkgs/development/tools/analysis/kcov/default.nix b/pkgs/development/tools/analysis/kcov/default.nix
index cf5b974b50f9..cbe6e5fdde9e 100644
--- a/pkgs/development/tools/analysis/kcov/default.nix
+++ b/pkgs/development/tools/analysis/kcov/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "kcov-${version}";
-  version = "29";
+  version = "32";
 
   src = fetchurl {
     url = "https://github.com/SimonKagstrom/kcov/archive/v${version}.tar.gz";
-    sha256 = "0nspf1bfq8zv7zmcmvkbgg3c90k10qcd56gyg8ln5z64nadvha9d";
+    sha256 = "0ic5w6r3cpwb32iky1jmyvfclgkqr0rnfyim7j2r6im21846sa85";
   };
 
   preConfigure = "patchShebangs src/bin-to-c-source.py";
diff --git a/pkgs/development/tools/makerpm/default.nix b/pkgs/development/tools/makerpm/default.nix
new file mode 100644
index 000000000000..404f3758ced4
--- /dev/null
+++ b/pkgs/development/tools/makerpm/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, zlib, libarchive, openssl }: 
+
+stdenv.mkDerivation rec { 
+  version = "1.0";
+  name = "makerpm-${version}";
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp makerpm $out/bin
+  '';
+
+  buildInputs = [ zlib libarchive openssl ];
+
+  src = fetchFromGitHub {
+    owner = "ivan-tkatchev";
+    repo = "makerpm";
+    rev = "${version}";
+    sha256 = "089dkbh5705ppyi920rd0ksjc0143xmvnhm8qrx93rsgwc1ggi1y";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/ivan-tkatchev/makerpm/;
+    description = "A clean, simple RPM packager reimplemented completely from scratch";
+    license = licenses.free;
+    platforms = platforms.all;
+    maintainers = [ maintainers.ivan-tkatchev ];
+  };
+}
diff --git a/pkgs/development/tools/nrpl/default.nix b/pkgs/development/tools/nrpl/default.nix
new file mode 100644
index 000000000000..d6a357235902
--- /dev/null
+++ b/pkgs/development/tools/nrpl/default.nix
@@ -0,0 +1,44 @@
+{ stdenv, lib, fetchFromGitHub, fetchpatch, makeWrapper, nim, pcre, tinycc }:
+
+stdenv.mkDerivation rec {
+  name = "nrpl-${version}";
+  version = "20150522";
+
+  src = fetchFromGitHub {
+    owner  = "wheineman";
+    repo   = "nrpl";
+    rev    = "6d6c189ab7d1c905cc29dc678d66e9e132026f69";
+    sha256 = "1cly9lhrawnc42r31b7r0p0i6hcx8r00aa17gv7w9pcpj8ngb4v2";
+  };
+
+  buildInputs = [ makeWrapper nim pcre ];
+
+  patches = [
+    (fetchpatch {
+      url    = https://patch-diff.githubusercontent.com/raw/wheineman/nrpl/pull/12.patch;
+      name   = "update_for_new_nim.patch";
+      sha256 = "1zff7inhn3l1jnxcnidy705lzi3wqib1chf4rayh1g9i23an7wg1";
+    })
+  ];
+
+  NIX_LDFLAGS = [
+    "-lpcre"
+  ];
+
+  buildPhase = "nim c -d:release nrpl.nim";
+
+  installPhase = "install -Dt $out/bin nrpl";
+
+  postFixup = ''
+    wrapProgram $out/bin/nrpl \
+      --prefix PATH : ${lib.makeBinPath [ nim tinycc ]}
+  '';
+
+  meta = with stdenv.lib; {
+    description = "REPL for the Nim programming language";
+    homepage = https://github.com/wheineman/nrpl;
+    license = licenses.mit;
+    maintainers = with maintainers; [ peterhoeg ];
+    platforms = with platforms; linux ++ darwin;
+  };
+}
diff --git a/pkgs/development/tools/ocaml/js_of_ocaml/default.nix b/pkgs/development/tools/ocaml/js_of_ocaml/default.nix
index b19f078d9a27..33a7fe52c394 100644
--- a/pkgs/development/tools/ocaml/js_of_ocaml/default.nix
+++ b/pkgs/development/tools/ocaml/js_of_ocaml/default.nix
@@ -8,9 +8,9 @@ stdenv.mkDerivation {
     sha256 = "1dali1akyd4zmkwav0d957ynxq2jj6cc94r4xiaql7ca89ajz4jj";
     };
 
-  buildInputs = [ ocaml findlib menhir ocsigen_deriving ppx_deriving
+  buildInputs = [ ocaml findlib menhir ocsigen_deriving
                  cmdliner tyxml reactivedata cppo which base64];
-  propagatedBuildInputs = [ ocaml_lwt camlp4 ];
+  propagatedBuildInputs = [ ocaml_lwt camlp4 ppx_deriving ];
 
   patches = [ ./Makefile.conf.diff ];
 
diff --git a/pkgs/games/chessx/default.nix b/pkgs/games/chessx/default.nix
index 404b3b90d7cd..f1dd86d67b92 100644
--- a/pkgs/games/chessx/default.nix
+++ b/pkgs/games/chessx/default.nix
@@ -17,7 +17,9 @@ stdenv.mkDerivation rec {
    qmakeHook
   ];
 
-  enableParallelBuilding = true;
+  # RCC: Error in 'resources.qrc': Cannot find file 'i18n/chessx_da.qm'
+  #enableParallelBuilding = true;
+
   installPhase = ''
       runHook preInstall
       mkdir -p "$out/bin"
diff --git a/pkgs/games/freeorion/92455f9.patch b/pkgs/games/freeorion/92455f9.patch
deleted file mode 100644
index e40ee78de6df..000000000000
--- a/pkgs/games/freeorion/92455f9.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-diff -Naur GG/src/Font.cpp
---- /GG/src/Font.cpp
-+++ /GG/src/Font.cpp
-@@ -1586,8 +1586,13 @@
-     using boost::lexical_cast;
-     FT_UInt index = FT_Get_Char_Index(face, ch);
-     if (index) {
--        if (FT_Load_Glyph(face, index, FT_LOAD_DEFAULT))
--            ThrowBadGlyph("GG::Font::GetGlyphBitmap : Freetype could not load the glyph for character '%1%'", ch);
-+        if (FT_Load_Glyph(face, index, FT_LOAD_DEFAULT)) {
-+            // loading of a glpyh failed so we replace it with
-+            // the 'Replacement Character' at codepoint 0xFFFD
-+            FT_UInt tmp_index = FT_Get_Char_Index(face, 0xFFFD);
-+            if (FT_Load_Glyph(face, tmp_index, FT_LOAD_DEFAULT))
-+                ThrowBadGlyph("GG::Font::GetGlyphBitmap : Freetype could not load the glyph for character '%1%'", ch);
-+        }
- 
-         FT_GlyphSlot glyph = face->glyph;
- 
diff --git a/pkgs/games/freeorion/default.nix b/pkgs/games/freeorion/default.nix
index e143b6ebcf31..91d4db32b683 100644
--- a/pkgs/games/freeorion/default.nix
+++ b/pkgs/games/freeorion/default.nix
@@ -2,18 +2,19 @@
 , libxslt, makeWrapper }:
 
 stdenv.mkDerivation rec {
-  version = "0.4.5";
+  version = "0.4.6";
   name = "freeorion-${version}";
 
   src = fetchurl {
-    url = "https://github.com/freeorion/freeorion/releases/download/v0.4.5/FreeOrion_v0.4.5_2015-09-01.f203162_Source.tar.gz";
-    sha256 = "3b99b92eeac72bd059566dbabfab54368989ba83f72e769bc94eb8dd4fe414c0";
+    url = "https://github.com/freeorion/freeorion/releases/download/v0.4.6/FreeOrion_v0.4.6_2016-09-16.49f9123_Source.tar.gz";
+    sha256 = "04g3x1cymf7mnmc2f5mm3c2r5izjmy7z3pvk2ykzz8f8b2kz6gry";
   };
 
   buildInputs = [ cmake boost SDL2 python2 freetype openal libogg libvorbis zlib libpng libtiff libjpeg mesa glew doxygen makeWrapper ];
 
-  # cherry pick for acceptable performance https://github.com/freeorion/freeorion/commit/92455f97c28055e296718230d2e3744eccd738ec
-  patches = [ ./92455f9.patch ];
+  patches = [
+    ./fix_rpaths.patch
+  ];
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/games/freeorion/fix_rpaths.patch b/pkgs/games/freeorion/fix_rpaths.patch
new file mode 100644
index 000000000000..f53e9821e5dd
--- /dev/null
+++ b/pkgs/games/freeorion/fix_rpaths.patch
@@ -0,0 +1,11 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -46,7 +46,7 @@
+     set(FreeOrion_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}/freeorion")
+ endif()
+ 
+-set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${FreeOrion_INSTALL_LIBDIR}")
++set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}/freeorion")
+ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+ 
+ if (WIN32)
diff --git a/pkgs/games/opendungeons/default.nix b/pkgs/games/opendungeons/default.nix
index fe3a381c7f5b..94a44446b6cd 100644
--- a/pkgs/games/opendungeons/default.nix
+++ b/pkgs/games/opendungeons/default.nix
@@ -1,17 +1,19 @@
-{ stdenv, fetchurl, ogre, cegui, boost, sfml, openal, cmake, ois }:
+{ stdenv, fetchFromGitHub, ogre, cegui, boost, sfml, openal, cmake, ois, pkgconfig }:
 
 stdenv.mkDerivation rec {
   name = "opendungeons-${version}";
-  version = "0.6.0";
+  version = "0.7.1";
 
-  src = fetchurl {
-    url = "ftp://download.tuxfamily.org/opendungeons/${version}/${name}.tar.xz";
-    sha256 = "1g0sjh732794h26cbkr0p96i3c0avm0mx9ip5zbvb2y3sbpjcbib";
+  src = fetchFromGitHub {
+    owner = "OpenDungeons";
+    repo = "OpenDungeons";
+    rev = version;
+    sha256 = "0nipb2h0gn628yxlahjgnfhmpfqa19mjdbj3aqabimdfqds9pryh";
   };
 
   patches = [ ./cmakepaths.patch ];
 
-  buildInputs = [ cmake ogre cegui boost sfml openal ois ];
+  buildInputs = [ cmake ogre cegui boost sfml openal ois pkgconfig ];
 
   meta = with stdenv.lib; {
     description = "An open source, real time strategy game sharing game elements with the Dungeon Keeper series and Evil Genius.";
diff --git a/pkgs/misc/screensavers/physlock/default.nix b/pkgs/misc/screensavers/physlock/default.nix
index 683b70120580..e580c9efea82 100644
--- a/pkgs/misc/screensavers/physlock/default.nix
+++ b/pkgs/misc/screensavers/physlock/default.nix
@@ -1,13 +1,13 @@
 { stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
-  version = "git-20150126";
-  name = "physlock-${version}";
+  version = "0.5";
+  name = "physlock-v${version}";
   src = fetchFromGitHub {
-    owner  = "muennich";
-    repo   = "physlock";
-    rev    = "b64dccc8c22710f8bf01eb5419590cdb0e65cabb";
-    sha256 = "1dapkwj3y6bb4j8q4glms7zsqm7drr37nrnr30sbahwq67rnvzcc";
+    owner = "muennich";
+    repo = "physlock";
+    rev = "v${version}";
+    sha256 = "102kdixrf7xxsxr69lbz73i1ss7959716cmdf8d5kbnhmk6argv7";
   };
 
   preConfigure = ''
diff --git a/pkgs/misc/vim-plugins/default.nix b/pkgs/misc/vim-plugins/default.nix
index 08cdb3465c82..b277f9268bca 100644
--- a/pkgs/misc/vim-plugins/default.nix
+++ b/pkgs/misc/vim-plugins/default.nix
@@ -1309,17 +1309,18 @@ rec {
     dependencies = [];
     buildInputs = [
       python go cmake
-      (if stdenv.isDarwin then llvmPackages.clang else llvmPackages.clang-unwrapped)
-      llvmPackages.llvm
     ] ++ stdenv.lib.optional stdenv.isDarwin Cocoa;
 
     propagatedBuildInputs = stdenv.lib.optional (!stdenv.isDarwin) rustracerd;
 
     patches = [
-      ./patches/youcompleteme/1-top-cmake.patch
       ./patches/youcompleteme/2-ycm-cmake.patch
     ];
 
+    # YCM requires path to external libclang 3.9
+    # For explicit use and as env variable for ../third_party/ycmd/build.py
+    EXTRA_CMAKE_ARGS="-DEXTERNAL_LIBCLANG_PATH=${llvmPackages.clang.cc}/lib/libclang.${if stdenv.isDarwin then "dylib" else "so"}";
+
     buildPhase = ''
       patchShebangs .
       substituteInPlace plugin/youcompleteme.vim \
@@ -1327,9 +1328,10 @@ rec {
 
       mkdir build
       pushd build
-      cmake -G "Unix Makefiles" . ../third_party/ycmd/cpp -DPYTHON_LIBRARIES:PATH=${python}/lib/libpython2.7.so -DPYTHON_INCLUDE_DIR:PATH=${python}/include/python2.7 -DUSE_CLANG_COMPLETER=ON -DUSE_SYSTEM_LIBCLANG=ON
+      cmake -G "Unix Makefiles" . ../third_party/ycmd/cpp -DPYTHON_LIBRARIES:PATH=${python}/lib/libpython2.7.so -DPYTHON_INCLUDE_DIR:PATH=${python}/include/python2.7 -DUSE_CLANG_COMPLETER=ON \
+        $EXTRA_CMAKE_ARGS
       make ycm_core -j''${NIX_BUILD_CORES} -l''${NIX_BUILD_CORES}}
-      ${python}/bin/python ../third_party/ycmd/build.py --gocode-completer --clang-completer --system-libclang
+      ${python}/bin/python ../third_party/ycmd/build.py --gocode-completer --clang-completer
       popd
     '';
 
diff --git a/pkgs/misc/vim-plugins/patches/youcompleteme/1-top-cmake.patch b/pkgs/misc/vim-plugins/patches/youcompleteme/1-top-cmake.patch
deleted file mode 100644
index fddf91b1c57c..000000000000
--- a/pkgs/misc/vim-plugins/patches/youcompleteme/1-top-cmake.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-
---- ./third_party/ycmd/cpp/CMakeLists.txt
-+++ ./third_party/ycmd/cpp/CMakeLists.txt
-@@ -121,8 +121,8 @@
-     set( CPP11_AVAILABLE true )
-   endif()
- elseif( COMPILER_IS_CLANG )
--  set( CPP11_AVAILABLE true )
--  set( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11" )
-+  #set( CPP11_AVAILABLE true )
-+  #  set( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11" )
-   set( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++" )
- endif()
- 
diff --git a/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/youcompleteme b/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/youcompleteme
index 4b81be5205b8..8da267837fb7 100644
--- a/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/youcompleteme
+++ b/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/youcompleteme
@@ -1,16 +1,17 @@
     buildInputs = [
       python go cmake
-      (if stdenv.isDarwin then llvmPackages.clang else llvmPackages.clang-unwrapped)
-      llvmPackages.llvm
     ] ++ stdenv.lib.optional stdenv.isDarwin Cocoa;
 
     propagatedBuildInputs = stdenv.lib.optional (!stdenv.isDarwin) rustracerd;
 
     patches = [
-      ./patches/youcompleteme/1-top-cmake.patch
       ./patches/youcompleteme/2-ycm-cmake.patch
     ];
 
+    # YCM requires path to external libclang 3.9
+    # For explicit use and as env variable for ../third_party/ycmd/build.py
+    EXTRA_CMAKE_ARGS="-DEXTERNAL_LIBCLANG_PATH=${llvmPackages.clang.cc}/lib/libclang.${if stdenv.isDarwin then "dylib" else "so"}";
+
     buildPhase = ''
       patchShebangs .
       substituteInPlace plugin/youcompleteme.vim \
@@ -18,9 +19,10 @@
 
       mkdir build
       pushd build
-      cmake -G "Unix Makefiles" . ../third_party/ycmd/cpp -DPYTHON_LIBRARIES:PATH=${python}/lib/libpython2.7.so -DPYTHON_INCLUDE_DIR:PATH=${python}/include/python2.7 -DUSE_CLANG_COMPLETER=ON -DUSE_SYSTEM_LIBCLANG=ON
+      cmake -G "Unix Makefiles" . ../third_party/ycmd/cpp -DPYTHON_LIBRARIES:PATH=${python}/lib/libpython2.7.so -DPYTHON_INCLUDE_DIR:PATH=${python}/include/python2.7 -DUSE_CLANG_COMPLETER=ON \
+        $EXTRA_CMAKE_ARGS
       make ycm_core -j''${NIX_BUILD_CORES} -l''${NIX_BUILD_CORES}}
-      ${python}/bin/python ../third_party/ycmd/build.py --gocode-completer --clang-completer --system-libclang
+      ${python}/bin/python ../third_party/ycmd/build.py --gocode-completer --clang-completer
       popd
     '';
 
diff --git a/pkgs/os-specific/linux/bcc/default.nix b/pkgs/os-specific/linux/bcc/default.nix
index d6593b4ee500..f3b262f1f7d3 100644
--- a/pkgs/os-specific/linux/bcc/default.nix
+++ b/pkgs/os-specific/linux/bcc/default.nix
@@ -2,14 +2,14 @@
   flex, bison, elfutils, python, pythonPackages, luajit, netperf, iperf }:
 
 stdenv.mkDerivation rec {
-  version = "git-2016-08-30";
+  version = "0.2.0";
   name = "bcc-${version}";
 
   src = fetchFromGitHub {
     owner = "iovisor";
     repo = "bcc";
-    rev = "4c2b5388f8d685a127a4d757c254a380e0aa915c";
-    sha256 = "1bd4darmr60vfr5414zq0bd9rq42r6h3cwiiwjllksbi4v2jvx77";
+    rev = "v${version}";
+    sha256 = "1xifh8lcqmn4mk6w4srjf4zk6mlwgck4fpcyhhliy39963ch5k08";
   };
 
   buildInputs = [ makeWrapper cmake llvmPackages.llvm llvmPackages.clang-unwrapped kernel
diff --git a/pkgs/os-specific/linux/dpdk/default.nix b/pkgs/os-specific/linux/dpdk/default.nix
index 0f55fa963a42..cd561df0ec41 100644
--- a/pkgs/os-specific/linux/dpdk/default.nix
+++ b/pkgs/os-specific/linux/dpdk/default.nix
@@ -4,11 +4,11 @@ assert lib.versionAtLeast kernel.version "3.18";
 
 stdenv.mkDerivation rec {
   name = "dpdk-${version}-${kernel.version}";
-  version = "16.07";
+  version = "16.07.2";
 
   src = fetchurl {
-    url = "http://dpdk.org/browse/dpdk/snapshot/dpdk-${version}.tar.gz";
-    sha256 = "1sgh55w3xpc0lb70s74cbyryxdjijk1fbv9b25jy8ms3lxaj966c";
+    url = "http://fast.dpdk.org/rel/dpdk-${version}.tar.xz";
+    sha256 = "1mzwazmzpq8mvwiham80y6h53qpvjpp76v0d58gz9bfiphbi9876";
   };
 
   buildInputs = [ pkgconfig libvirt ];
diff --git a/pkgs/os-specific/linux/kernel/patches.nix b/pkgs/os-specific/linux/kernel/patches.nix
index 68117e141812..e54189b078a5 100644
--- a/pkgs/os-specific/linux/kernel/patches.nix
+++ b/pkgs/os-specific/linux/kernel/patches.nix
@@ -96,8 +96,8 @@ rec {
 
   grsecurity_testing = grsecPatch
     { kver   = "4.8.15";
-      grrev  = "201612151923";
-      sha256 = "1di4v0b0sn7ibg9vrn8w7d5vjxd2mdlxdmqsnyd6xyn8g00fra89";
+      grrev  = "201612301949";
+      sha256 = "1083r30ipvdi3kjixlsp3f1mmf7848f2p32ds956caarvr4vkm3b";
     };
 
   # This patch relaxes grsec constraints on the location of usermode helpers,
diff --git a/pkgs/os-specific/linux/odp-dpdk/default.nix b/pkgs/os-specific/linux/odp-dpdk/default.nix
index e8b6cea08eb6..8182394536c5 100644
--- a/pkgs/os-specific/linux/odp-dpdk/default.nix
+++ b/pkgs/os-specific/linux/odp-dpdk/default.nix
@@ -2,12 +2,12 @@
 
 stdenv.mkDerivation rec {
   name = "odp-dpdk-${version}";
-  version = "2016-08-16";
+  version = "1.12.0.0";
 
   src = fetchgit {
     url = "https://git.linaro.org/lng/odp-dpdk.git";
-    rev = "7068593f600e2b5a23ee1780d5c722c54e966df1";
-    sha256 = "0pz0zkxqaac193x21wmj3x88gfza6bvhmv5yf8fzkpm9zxnl2sy4";
+    rev = "5e370e1113973feafb43a8e57d4c59be40e9aeab";
+    sha256 = "0rrakbxnbsqaj148xaz2hwxjvg3cmzlynfkvcp8w56sqyly75d0n";
   };
 
   nativeBuildInputs = [ autoreconfHook ];
@@ -16,12 +16,6 @@ stdenv.mkDerivation rec {
   RTE_SDK = "${dpdk}";
   RTE_TARGET = "x86_64-native-linuxapp-gcc";
 
-  patchPhase = ''
-    substituteInPlace scripts/git_hash.sh --replace /bin/bash /bin/sh
-    substituteInPlace scripts/get_impl_str.sh --replace /bin/bash /bin/sh
-    echo -n ${version} > .scmversion
-  '';
-
   dontDisableStatic = true;
 
   configureFlags = [
diff --git a/pkgs/os-specific/linux/pktgen/default.nix b/pkgs/os-specific/linux/pktgen/default.nix
index 3ce9617ec5b1..2aa4d26f913e 100644
--- a/pkgs/os-specific/linux/pktgen/default.nix
+++ b/pkgs/os-specific/linux/pktgen/default.nix
@@ -5,11 +5,11 @@
 
 stdenv.mkDerivation rec {
   name = "pktgen-${version}";
-  version = "3.0.13";
+  version = "3.1.0";
 
   src = fetchurl {
-    url = "http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/pktgen-${version}.tar.gz";
-    sha256 = "64629b454ed8dc036d5e9bb30b3ae84a0bab0142b651c72da85ab1454e9ae0d6";
+    url = "http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/pktgen-v${version}.tar.gz";
+    sha256 = "1a1dl8h8p76wlcjlvn736mz4nc2nc5c3764rlydiz86wl45mb0nb";
   };
 
   nativeBuildInputs = stdenv.lib.optionals withGtk [ pkgconfig ];
@@ -24,11 +24,6 @@ stdenv.mkDerivation rec {
 
   NIX_CFLAGS_COMPILE = [ "-march=core2" ];
 
-  postPatch = ''
-    substituteInPlace lib/lua/src/luaconf.h --replace /usr/local $out
-    substituteInPlace lib/common/wr_lscpu.h --replace /usr/bin/lscpu ${utillinux}/bin/lscpu
-  '';
-
   installPhase = ''
     install -d $out/bin
     install -m 0755 app/app/${RTE_TARGET}/app/pktgen $out/bin
diff --git a/pkgs/os-specific/linux/wireguard/default.nix b/pkgs/os-specific/linux/wireguard/default.nix
index 06b012fa434a..c8169c52e806 100644
--- a/pkgs/os-specific/linux/wireguard/default.nix
+++ b/pkgs/os-specific/linux/wireguard/default.nix
@@ -6,11 +6,11 @@ assert kernel != null -> stdenv.lib.versionAtLeast kernel.version "4.1";
 let
   name = "wireguard-${version}";
 
-  version = "0.0.20161223";
+  version = "0.0.20161230";
 
   src = fetchurl {
     url    = "https://git.zx2c4.com/WireGuard/snapshot/WireGuard-${version}.tar.xz";
-    sha256 = "0wmrsap34nd1x4gvz80isgsjjxbplvkrxnw56qlaqxkycvv8zndv";
+    sha256 = "15p3k8msk3agr0i96k12y5h4fxv0gc8zqjk15mizd3wwmw6pgjb9";
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/servers/matrix-synapse/default.nix b/pkgs/servers/matrix-synapse/default.nix
index 00f9287bea53..7eac25afd780 100644
--- a/pkgs/servers/matrix-synapse/default.nix
+++ b/pkgs/servers/matrix-synapse/default.nix
@@ -24,13 +24,13 @@ let
   };
 in pythonPackages.buildPythonApplication rec {
   name = "matrix-synapse-${version}";
-  version = "0.18.5";
+  version = "0.18.6-rc2";
 
   src = fetchFromGitHub {
     owner = "matrix-org";
     repo = "synapse";
     rev = "v${version}";
-    sha256 = "1l9vfx08alf71323jrfjjvcb7pww613dwxskdgc1bplnva4khj4f";
+    sha256 = "0alsby8hghhzgpzism2f9v5pmz91v20bd18nflfka79f3ss03h0q";
   };
 
   patches = [ ./matrix-synapse.patch ];
diff --git a/pkgs/tools/backup/borg/default.nix b/pkgs/tools/backup/borg/default.nix
index 09c2dddd5159..b27d5c834b1b 100644
--- a/pkgs/tools/backup/borg/default.nix
+++ b/pkgs/tools/backup/borg/default.nix
@@ -15,11 +15,12 @@ python3Packages.buildPythonApplication rec {
     # For building documentation:
     sphinx sphinx_rtd_theme
   ];
-  propagatedBuildInputs = [
-    acl lz4 openssl
-  ] ++ (with python3Packages; [
-    cython msgpack llfuse tox detox setuptools_scm
-  ]);
+  buildInputs = [
+    acl lz4 openssl python3Packages.setuptools_scm
+  ];
+  propagatedBuildInputs = with python3Packages; [
+    cython llfuse msgpack
+  ];
 
   preConfigure = ''
     export BORG_OPENSSL_PREFIX="${openssl.dev}"
diff --git a/pkgs/tools/graphics/netpbm/default.nix b/pkgs/tools/graphics/netpbm/default.nix
index d0381e912511..7fafc5218e9e 100644
--- a/pkgs/tools/graphics/netpbm/default.nix
+++ b/pkgs/tools/graphics/netpbm/default.nix
@@ -24,7 +24,9 @@ stdenv.mkDerivation rec {
     echo "STATICLIB_TOO = n" >> config.mk
     substituteInPlace "config.mk" \
         --replace "TIFFLIB = NONE" "TIFFLIB = ${libtiff.out}/lib/libtiff.so" \
-        --replace "TIFFHDR_DIR =" "TIFFHDR_DIR = ${libtiff.dev}/include"
+        --replace "TIFFHDR_DIR =" "TIFFHDR_DIR = ${libtiff.dev}/include" \
+        --replace "JPEGLIB = NONE" "JPEGLIB = ${libjpeg.out}/lib/libjpeg.so" \
+        --replace "JPEGHDR_DIR =" "JPEGHDR_DIR = ${libjpeg.dev}/include"
    '' + stdenv.lib.optionalString stdenv.isDarwin ''
     echo "LDSHLIB=-dynamiclib -install_name $out/lib/libnetpbm.\$(MAJ).dylib" >> config.mk
     echo "NETPBMLIBTYPE = dylib" >> config.mk
diff --git a/pkgs/tools/misc/bmon/default.nix b/pkgs/tools/misc/bmon/default.nix
index 30412016e507..9c7eafe351f7 100644
--- a/pkgs/tools/misc/bmon/default.nix
+++ b/pkgs/tools/misc/bmon/default.nix
@@ -1,23 +1,21 @@
-{ stdenv, fetchFromGitHub, autoconf, automake, pkgconfig, ncurses, confuse
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, ncurses, confuse
 , libnl }:
 
 stdenv.mkDerivation rec {
   name = "bmon-${version}";
-  version = "3.9";
+  version = "4.0";
 
   src = fetchFromGitHub {
     owner = "tgraf";
     repo = "bmon";
     rev = "v${version}";
-    sha256 = "1a4sj8pf02392zghr9wa1dc8x38fj093d4hg1fcakzrdjvrg1p2h";
+    sha256 = "1ilba872c09mnlvylslv4hqv6c9cz36l76q74rr99jvis1dg69gf";
   };
 
-  nativeBuildInputs = [ autoconf automake pkgconfig ];
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
 
   buildInputs = [ ncurses confuse libnl ];
 
-  preConfigure = "sh ./autogen.sh";
-
   meta = with stdenv.lib; {
     description = "Network bandwidth monitor";
     homepage = https://github.com/tgraf/bmon;
diff --git a/pkgs/tools/networking/miredo/default.nix b/pkgs/tools/networking/miredo/default.nix
new file mode 100644
index 000000000000..efe2847ae355
--- /dev/null
+++ b/pkgs/tools/networking/miredo/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchurl, nettools, iproute, judy }:
+
+stdenv.mkDerivation rec {
+  version = "1.2.6";
+  name = "miredo-${version}";
+
+  buildInputs = [ judy ];
+
+  src = fetchurl {
+    url = "http://www.remlab.net/files/miredo/miredo-${version}.tar.xz";
+    sha256 = "0j9ilig570snbmj48230hf7ms8kvcwi2wblycqrmhh85lksd49ps";
+  };
+
+  postPatch = ''
+    substituteInPlace misc/client-hook.bsd \
+      --replace '/sbin/route' '${nettools}/bin/route' \
+      --replace '/sbin/ifconfig' '${nettools}/bin/ifconfig'
+    substituteInPlace misc/client-hook.iproute --replace '/sbin/ip' '${iproute}/bin/ip'
+  '';
+
+  configureFlags = [ "--with-Judy" ];
+
+  postInstall = ''
+    rm -rf $out/lib/systemd $out/var $out/etc/miredo/miredo.conf
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Teredo IPv6 Tunneling Daemon";
+    homepage = http://www.remlab.net/miredo/;
+    license = licenses.gpl2;
+    maintainers = [ maintainers.volth ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/tools/networking/ndjbdns/default.nix b/pkgs/tools/networking/ndjbdns/default.nix
index 256f50e5c546..3269f92d7f42 100644
--- a/pkgs/tools/networking/ndjbdns/default.nix
+++ b/pkgs/tools/networking/ndjbdns/default.nix
@@ -1,17 +1,22 @@
-{ stdenv, fetchurl, systemd, pkgconfig }:
+{ stdenv, fetchFromGitHub, autoreconfHook, systemd, pkgconfig }:
+
+with stdenv.lib;
 
 stdenv.mkDerivation rec {
   version = "1.06";
   name = "ndjbdns-${version}";
 
-  src = fetchurl {
-    url = "http://pjp.dgplug.org/ndjbdns/${name}.tar.gz";
-    sha256 = "09qi5a9abqm08iqmxj74fzzq9x1w5lzr1jlbzj2hl8hz0g2sgraw";
+  src = fetchFromGitHub {
+    owner = "pjps";
+    repo = "ndjbdns";
+    rev = "64d371b6f887621de7bf8bd495be10442b2accd0";
+    sha256 = "0gjyvn8r66kp49gasd6sqfvg2pj0c6v67hnq7cqwl04kj69rfy86";
   };
 
-  buildInputs = [ pkgconfig systemd ];
+  buildInputs = [ autoreconfHook pkgconfig ]
+    ++ optional stdenv.isLinux systemd;
 
-  meta = with stdenv.lib; {
+  meta = {
     description = "A brand new release of the Djbdns";
     longDescription = ''
       Djbdns is a fully‐fledged Domain Name System(DNS), originally written by the eminent author of qmail, Dr. D J Bernstein.
@@ -19,7 +24,7 @@ stdenv.mkDerivation rec {
     homepage = http://pjp.dgplug.org/ndjbdns/;
     license = licenses.gpl2;
     maintainers = [ maintainers.msackman ];
-    platforms = platforms.linux;
+    platforms = platforms.linux ++ platforms.darwin;
   };
 
 }
diff --git a/pkgs/tools/security/gencfsm/default.nix b/pkgs/tools/security/gencfsm/default.nix
index 871ba1d8b854..fbd32cdc22df 100644
--- a/pkgs/tools/security/gencfsm/default.nix
+++ b/pkgs/tools/security/gencfsm/default.nix
@@ -1,19 +1,18 @@
 { stdenv, fetchurl, autoconf, automake, intltool, libtool, pkgconfig, encfs
-, glib , gnome3, gtk3, libgnome_keyring, vala_0_23, wrapGAppsHook, xorg
-, libgee_0_6
+, glib , gnome3, gtk3, libgnome_keyring, vala, wrapGAppsHook, xorg
 }:
 
 stdenv.mkDerivation rec {
-  version = "1.8.16";
+  version = "1.8.18";
   name = "gnome-encfs-manager-${version}";
 
   src = fetchurl {
-    url = "https://launchpad.net/gencfsm/trunk/1.8/+download/gnome-encfs-manager_${version}.tar.gz";
-    sha256 = "06sz6zcmvxkqww5gx4brcqs4hlpy9d8sal9nmw0pdsvh8k5vmpgn";
+    url = "https://launchpad.net/gencfsm/trunk/1.8/+download/gnome-encfs-manager_${version}.tar.xz";
+    sha256 = "1rpf683lxa78fmxxb0hnq7vdh3yn7qid2gqq67q9mk65sp9vdhdj";
   };
 
-  buildInputs = [ autoconf automake intltool libtool pkgconfig vala_0_23 glib encfs
-    gtk3 libgnome_keyring libgee_0_6 xorg.libSM xorg.libICE
+  buildInputs = [ autoconf automake intltool libtool pkgconfig vala glib encfs
+    gtk3 libgnome_keyring gnome3.libgee xorg.libSM xorg.libICE
     wrapGAppsHook ];
 
   patches = [ ./makefile-mkdir.patch ];
@@ -28,10 +27,10 @@ stdenv.mkDerivation rec {
 
   meta = with stdenv.lib; {
     homepage = http://www.libertyzero.com/GEncfsM/;
+    downloadPage = https://launchpad.net/gencfsm/;
     description = "EncFS manager and mounter with GNOME3 integration";
     license = licenses.gpl2Plus;
     platforms = platforms.linux;
     maintainers = [ maintainers.spacefrogg ];
-    broken = true;
   };
 }
diff --git a/pkgs/tools/security/gorilla-bin/default.nix b/pkgs/tools/security/gorilla-bin/default.nix
new file mode 100644
index 000000000000..cbd260455d8e
--- /dev/null
+++ b/pkgs/tools/security/gorilla-bin/default.nix
@@ -0,0 +1,41 @@
+{ fetchurl, makeWrapper, patchelf, pkgs, stdenv, libXft, libX11, freetype, fontconfig, libXrender, libXScrnSaver, libXext }:
+
+stdenv.mkDerivation rec {
+  name = "gorilla-bin-${version}";
+  version = "1.5.3.7";
+
+  src = fetchurl {
+    name = "gorilla1537_64.bin";
+    url = "http://gorilla.dp100.com/downloads/gorilla1537_64.bin";
+    sha256 = "19ir6x4c01825hpx2wbbcxkk70ymwbw4j03v8b2xc13ayylwzx0r";
+  };
+
+  buildInputs = [ patchelf makeWrapper ];
+  phases = [ "unpackPhase" "installPhase" ];
+
+  unpackCmd = ''
+    mkdir gorilla;
+    cp $curSrc gorilla/gorilla-${version};
+  '';
+
+  installPhase = let
+    interpreter = "$(< \"$NIX_CC/nix-support/dynamic-linker\")";
+    libPath = stdenv.lib.makeLibraryPath [ libXft libX11 freetype fontconfig libXrender libXScrnSaver libXext ];
+  in ''
+    mkdir -p $out/opt/password-gorilla
+    mkdir -p $out/bin
+    cp gorilla-${version} $out/opt/password-gorilla
+    chmod ugo+x $out/opt/password-gorilla/gorilla-${version}
+    patchelf --set-interpreter "${interpreter}" "$out/opt/password-gorilla/gorilla-${version}"
+    makeWrapper "$out/opt/password-gorilla/gorilla-${version}" "$out/bin/gorilla" \
+      --prefix LD_LIBRARY_PATH : "${libPath}"
+  '';
+
+  meta = {
+    description = "Password Gorilla is a Tk based password manager";
+    homepage = https://github.com/zdia/gorilla/wiki;
+    maintainers = [ stdenv.lib.maintainers.namore ];
+    platforms = [ "x86_64-linux" ];
+    license = stdenv.lib.licenses.gpl2;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index d9842aaede35..ac48186d58f7 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -905,6 +905,8 @@ in
 
   goa = callPackage ../development/tools/goa { };
 
+  gorilla-bin = callPackage ../tools/security/gorilla-bin { };
+
   gringo = callPackage ../tools/misc/gringo { };
 
   gti = callPackage ../tools/misc/gti { };
@@ -2712,6 +2714,8 @@ in
 
   makemkv = callPackage ../applications/video/makemkv { };
 
+  makerpm = callPackage ../development/tools/makerpm { };
+
   # See https://github.com/NixOS/nixpkgs/issues/15849. I'm switching on isLinux because
   # it looks like gnulib is broken on non-linux, so it seems likely that this would cause
   # trouble on bsd and/or cygwin as well.
@@ -2799,6 +2803,8 @@ in
 
   minixml = callPackage ../development/libraries/minixml { };
 
+  miredo = callPackage ../tools/networking/miredo { };
+
   mjpegtoolsFull = callPackage ../tools/video/mjpegtools { };
 
   mjpegtools = self.mjpegtoolsFull.override {
@@ -5225,6 +5231,7 @@ in
 
   nim = callPackage ../development/compilers/nim { };
   nimble = callPackage ../development/tools/nimble { };
+  nrpl = callPackage ../development/tools/nrpl { };
 
   neko = callPackage ../development/compilers/neko { };
 
@@ -8199,6 +8206,8 @@ in
 
   libmcs = callPackage ../development/libraries/libmcs { };
 
+  libmd = callPackage ../development/libraries/libmd { };
+
   libmemcached = callPackage ../development/libraries/libmemcached { };
 
   libmicrohttpd = callPackage ../development/libraries/libmicrohttpd { };
@@ -9085,7 +9094,14 @@ in
 
     grantlee = callPackage ../development/libraries/grantlee/5.x.nix { };
 
-    kirigami = callPackage ../development/libraries/kirigami { };
+    kirigami_1 = callPackage ../development/libraries/kirigami { };
+
+    kirigami_2 = callPackage ../development/libraries/kirigami/v2.nix {
+      # kirigami v2 requires qt 5.7 and above
+      inherit (qt57) qtbase qtquickcontrols2;
+    };
+
+    kirigami = kirigami_1;
 
     libcommuni = callPackage ../development/libraries/libcommuni { };
 
@@ -9675,12 +9691,14 @@ in
   wxGTK29 = callPackage ../development/libraries/wxGTK-2.9/default.nix {
     inherit (gnome2) GConf;
     inherit (darwin.stubs) setfile;
+    inherit (darwin.apple_sdk.frameworks) AGL Carbon Cocoa Kernel QuickTime;
     withMesa = lib.elem system lib.platforms.mesaPlatforms;
   };
 
   wxGTK30 = callPackage ../development/libraries/wxGTK-3.0/default.nix {
     inherit (gnome2) GConf;
     inherit (darwin.stubs) setfile;
+    inherit (darwin.apple_sdk.frameworks) AGL Carbon Cocoa Kernel QTKit;
     withMesa = lib.elem system lib.platforms.mesaPlatforms;
   };
 
@@ -12299,6 +12317,8 @@ in
     giflib = giflib_4_1;
   };
 
+  astroid = callPackage ../applications/networking/mailreaders/astroid { };
+
   audacious = callPackage ../applications/audio/audacious { };
   audaciousQt5 = qt5.callPackage ../applications/audio/audacious/qt-5.nix { };
 
@@ -13004,6 +13024,8 @@ in
 
   flacon = callPackage ../applications/audio/flacon { };
 
+  flexget = callPackage ../applications/networking/flexget { };
+
   fldigi = callPackage ../applications/audio/fldigi { };
 
   fluidsynth = callPackage ../applications/audio/fluidsynth {
@@ -14441,6 +14463,8 @@ in
 
   posterazor = callPackage ../applications/misc/posterazor { };
 
+  ppl-address-book = callPackage ../applications/office/ppl-address-book { };
+
   pqiv = callPackage ../applications/graphics/pqiv { };
 
   qiv = callPackage ../applications/graphics/qiv { };
@@ -16777,6 +16801,8 @@ in
 
   sacrifice = callPackage ../applications/science/physics/sacrifice {};
 
+  sherpa = callPackage ../applications/science/physics/sherpa {};
+
   ### SCIENCE/PROGRAMMING
 
   plm = callPackage ../applications/science/programming/plm { };
@@ -17129,6 +17155,8 @@ in
 
   fastjet = callPackage ../development/libraries/physics/fastjet { };
 
+  fastnlo = callPackage ../development/libraries/physics/fastnlo { };
+
   geant4 = callPackage ../development/libraries/physics/geant4 {
     enableMultiThreading = true;
     enableG3toG4         = false;
@@ -17161,6 +17189,8 @@ in
 
   lhapdf = callPackage ../development/libraries/physics/lhapdf { };
 
+  mcgrid = callPackage ../development/libraries/physics/mcgrid { };
+
   nlojet = callPackage ../development/libraries/physics/nlojet { };
 
   pythia = callPackage ../development/libraries/physics/pythia { };
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 06fe9cbf1b2f..dee76b8bf29e 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -2808,7 +2808,7 @@ in {
     };
   };
 
-  # Needed for bleach 1.5.0
+  # Needed for bleach 1.5.0 and calibre 2.76.0
   html5lib_0_9999999 = self.html5lib.override rec {
     name = "html5lib-${version}";
     buildInputs = with self; [ nose flake8 ];
@@ -11488,38 +11488,6 @@ in {
     };
   };
 
-  flexget = buildPythonPackage rec {
-    version = "1.2.337";
-    name = "FlexGet-${version}";
-    disabled = isPy3k;
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/F/FlexGet/${name}.tar.gz";
-      sha256 = "0f7aaf0bf37860f0c5adfb0ba59ca228aa3f5c582131445623a4c3bc82d45346";
-    };
-
-    doCheck = false;
-
-    buildInputs = with self; [ nose ];
-    propagatedBuildInputs = with self; [
-      paver feedparser sqlalchemy pyyaml rpyc
-      beautifulsoup_4_1_3 html5lib pyrss2gen pynzb progressbar jinja2 flask
-      cherrypy requests dateutil_2_1 jsonschema python_tvrage tmdb3
-      guessit pathpy apscheduler ]
-    # enable deluge and transmission plugin support, if they're installed
-    ++ stdenv.lib.optional (pkgs.config.pythonPackages.deluge or false)
-      pythonpackages.deluge
-    ++ stdenv.lib.optional (pkgs.transmission != null)
-      self.transmissionrpc;
-
-    meta = {
-      homepage = http://flexget.com/;
-      description = "Multipurpose automation tool for content like torrents";
-      license = licenses.mit;
-      maintainers = with maintainers; [ domenkozar ];
-    };
-  };
-
   # py3k disabled, see https://travis-ci.org/NixOS/nixpkgs/builds/48759067
   graph-tool = if isPy3k then throw "graph-tool in Nix doesn't support py3k yet"
     else callPackage ../development/python-modules/graph-tool/2.x.x.nix { boost = pkgs.boost159; };
@@ -25088,19 +25056,28 @@ in {
   };
 
   syncthing-gtk = buildPythonPackage rec {
-    version = "0.6.3";
+    version = "0.9.2.3";
     name = "syncthing-gtk-${version}";
     src = pkgs.fetchFromGitHub {
       owner = "syncthing";
       repo = "syncthing-gtk";
       rev = "v${version}";
-      sha256 = "1qa5bw2qizjiqvkms8i31wsjf8cw9p0ciamxgfgq6n37wcalv6ms";
+      sha256 = "0chl0f0kp6z0z00d1f3xjlicjfr9rzabw39wmjr66fwb5w5hcc42";
     };
 
     disabled = isPy3k;
 
-    propagatedBuildInputs = with self; [ pkgs.syncthing dateutil pyinotify pkgs.libnotify pkgs.psmisc
-      pygobject3 pkgs.gtk3 ];
+    propagatedBuildInputs = with self; [ pkgs.syncthing dateutil pyinotify
+      pkgs.libnotify
+      (pkgs.librsvg.override { withGTK = true; })
+      pkgs.psmisc pygobject3 pkgs.gtk3
+    ];
+
+    preFixup = ''
+      wrapProgram $out/bin/syncthing-gtk \
+        --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
+        --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH"
+    '';
 
     patchPhase = ''
       substituteInPlace "scripts/syncthing-gtk" \
diff --git a/pkgs/top-level/rust-packages.nix b/pkgs/top-level/rust-packages.nix
index 29fbac38bd0e..14ef3cfef437 100644
--- a/pkgs/top-level/rust-packages.nix
+++ b/pkgs/top-level/rust-packages.nix
@@ -7,9 +7,9 @@
 { runCommand, fetchFromGitHub, git }:
 
 let
-  version = "2016-12-16";
-  rev = "1da5a7d0cd31d72324481760067bde5cf2e07be5";
-  sha256 = "0kbh3aq738sqns8w6yfia17fwrk98g6m763wqsqwhnrg2ndqrp8d";
+  version = "2016-12-28";
+  rev = "3399254d4a021d07736944b339a8794eddcda517";
+  sha256 = "1vbixbgzv21anqayz8ya0x1qlzndb7fpdf9dyh4yyscl1kaibvg9";
 
   src = fetchFromGitHub {
       inherit rev;