summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--nixos/modules/services/network-filesystems/samba.nix99
-rw-r--r--nixos/modules/system/boot/loader/grub/grub.nix34
-rw-r--r--nixos/modules/system/boot/loader/grub/install-grub.pl120
-rw-r--r--pkgs/applications/audio/ncmpcpp/default.nix39
-rw-r--r--pkgs/applications/networking/sync/rsync/default.nix4
-rw-r--r--pkgs/applications/video/makemkv/default.nix10
-rw-r--r--pkgs/build-support/fetchurl/mirrors.nix5
-rw-r--r--pkgs/development/interpreters/pypy/default.nix14
-rw-r--r--pkgs/development/libraries/celt/0.5.1.nix51
-rw-r--r--pkgs/development/libraries/celt/0.7.nix51
-rw-r--r--pkgs/development/libraries/celt/default.nix50
-rw-r--r--pkgs/development/libraries/celt/generic.nix23
-rw-r--r--pkgs/development/libraries/ctdb/default.nix2
-rw-r--r--pkgs/development/libraries/faac/default.nix26
-rw-r--r--pkgs/development/libraries/ldb/default.nix5
-rw-r--r--pkgs/development/libraries/ntdb/default.nix5
-rw-r--r--pkgs/development/libraries/talloc/default.nix2
-rw-r--r--pkgs/development/libraries/tdb/default.nix5
-rw-r--r--pkgs/development/libraries/tevent/default.nix2
-rw-r--r--pkgs/development/tools/misc/ccache/default.nix2
-rw-r--r--pkgs/os-specific/linux/cifs-utils/default.nix2
-rw-r--r--pkgs/servers/samba/3.x.nix2
-rw-r--r--pkgs/servers/samba/4.x.nix5
-rw-r--r--pkgs/tools/compression/rzip/default.nix2
-rw-r--r--pkgs/tools/misc/grub/2.0x.nix13
-rw-r--r--pkgs/tools/networking/ppp/default.nix2
-rw-r--r--pkgs/top-level/perl-packages.nix8
28 files changed, 320 insertions, 265 deletions
diff --git a/README.md b/README.md
index a2ed0877e9a5..fa5a419f9f84 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,8 @@
 Nixpkgs is a collection of packages for [Nix](https://nixos.org/nix/) package
 manager.
 
+[![Build Status](https://travis-ci.org/NixOS/nixpkgs.svg?branch=master)](https://travis-ci.org/NixOS/nixpkgs) [![Issue Stats](http://www.issuestats.com/github/nixos/nixpkgs/badge/pr)](http://www.issuestats.com/github/nixos/nixpkgs) [![Issue Stats](http://www.issuestats.com/github/nixos/nixpkgs/badge/issue)](http://www.issuestats.com/github/nixos/nixpkgs)
+
 [NixOS](https://nixos.org/nixos/) linux distribution source code is located inside `nixos/` folder.
 
 * [NixOS installation instructions](https://nixos.org/nixos/manual/#ch-installation)
diff --git a/nixos/modules/services/network-filesystems/samba.nix b/nixos/modules/services/network-filesystems/samba.nix
index 6fcf89999523..8c79bf663d15 100644
--- a/nixos/modules/services/network-filesystems/samba.nix
+++ b/nixos/modules/services/network-filesystems/samba.nix
@@ -6,25 +6,11 @@ let
 
   cfg = config.services.samba;
 
-  logDir = "/var/log/samba";
-  privateDir = "/var/samba/private";
-
   samba = cfg.package;
 
   setupScript =
     ''
-      if ! test -d /var/samba ; then
-        mkdir -p /var/samba/locks /var/samba/cores/nmbd  /var/samba/cores/smbd /var/samba/cores/winbindd
-      fi
-
-      passwdFile="$(${pkgs.gnused}/bin/sed -n 's/^.*smb[ ]\+passwd[ ]\+file[ ]\+=[ ]\+\(.*\)/\1/p' ${configFile})"
-      if [ -n "$passwdFile" ]; then
-        echo 'INFO: [samba] creating directory containing passwd file'
-        mkdir -p "$(dirname "$passwdFile")"
-      fi
-
-      mkdir -p ${logDir}
-      mkdir -p ${privateDir}
+      mkdir -p /var/lock/samba /var/log/samba /var/cache/samba /var/lib/samba/private
     '';
 
   shareConfig = name:
@@ -39,9 +25,10 @@ let
     (if cfg.configText != null then cfg.configText else
     ''
       [ global ]
-      log file = ${logDir}/log.%m
-      private dir = ${privateDir}
-      ${optionalString cfg.syncPasswordsByPam "pam password change = true"}
+      security = ${cfg.securityType}
+      passwd program = /var/setuid-wrappers/passwd %u
+      pam password change = ${toString cfg.syncPasswordsByPam}
+      invalid users = ${toString cfg.invalidUsers}
 
       ${cfg.extraConfig}
 
@@ -83,14 +70,16 @@ in
     services.samba = {
 
       enable = mkOption {
+        type = types.bool;
         default = false;
-        description = "
+        description = ''
           Whether to enable Samba, which provides file and print
           services to Windows clients through the SMB/CIFS protocol.
-        ";
+        '';
       };
 
       package = mkOption {
+        type = types.package;
         default = pkgs.samba;
         example = pkgs.samba4;
         description = ''
@@ -99,72 +88,47 @@ in
       };
 
       syncPasswordsByPam = mkOption {
+        type = types.bool;
         default = false;
-        description = "
-          enabling this will add a line directly after pam_unix.so.
+        description = ''
+          Enabling this will add a line directly after pam_unix.so.
           Whenever a password is changed the samba password will be updated as well.
           However you still yave to add the samba password once using smbpasswd -a user
           If you don't want to maintain an extra pwd database you still can send plain text
           passwords which is not secure.
-        ";
+        '';
       };
 
-      extraConfig = mkOption {
-        # !!! Bad default.
-        default = ''
-          # [global] continuing global section here, section is started by nix to set pids etc
-
-            smb passwd file = /etc/samba/passwd
-
-            # is this useful ?
-            domain master = auto
-
-            encrypt passwords = Yes
-            client plaintext auth = No
-
-            # yes: if you use this you probably also want to enable syncPasswordsByPam
-            # no: You can still use the pam password database. However
-            # passwords will be sent plain text on network (discouraged)
-
-            workgroup = Users
-            server string = %h
-            comment = Samba
-            log file = /var/log/samba/log.%m
-            log level = 10
-            max log size = 50000
-            security = ${cfg.securityType}
-
-            client lanman auth = Yes
-            dns proxy = no
-            invalid users = root
-            passdb backend = tdbsam
-            passwd program = /usr/bin/passwd %u
+      invalidUsers = mkOption {
+        type = types.listOf types.str;
+        default = [ "root" ];
+        description = ''
+          List of users who are denied to login via Samba.
         '';
-
-        description = "
-          additional global section and extra section lines go in here.
-        ";
       };
 
-      configFile = mkOption {
-        description = "
-          internal use to pass filepath to samba pam module
-        ";
+      extraConfig = mkOption {
+        type = types.lines;
+        default = "";
+        description = ''
+          Additional global section and extra section lines go in here.
+        '';
       };
 
       configText = mkOption {
         type = types.nullOr types.lines;
         default = null;
-        description = "
+        description = ''
           Verbatim contents of smb.conf. If null (default), use the
           autogenerated file from NixOS instead.
-        ";
+        '';
       };
 
       securityType = mkOption {
-        description = "Samba security type";
+        type = types.str;
         default = "user";
         example = "share";
+        description = "Samba security type";
       };
 
       nsswins = mkOption {
@@ -179,12 +143,11 @@ in
 
       shares = mkOption {
         default = {};
-        description =
-          ''
+        description = ''
           A set describing shared resources.
           See <command>man smb.conf</command> for options.
-          '';
-        type = types.attrsOf (types.attrsOf types.str);
+        '';
+        type = types.attrsOf (types.attrsOf types.unspecified);
         example =
           { srv =
              { path = "/srv";
diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix
index b16a725aba8e..ed2249a4ba7a 100644
--- a/nixos/modules/system/boot/loader/grub/grub.nix
+++ b/nixos/modules/system/boot/loader/grub/grub.nix
@@ -6,6 +6,8 @@ let
 
   cfg = config.boot.loader.grub;
 
+  efi = config.boot.loader.efi;
+
   realGrub = if cfg.version == 1 then pkgs.grub
     else pkgs.grub2.override { zfsSupport = cfg.zfsSupport; };
 
@@ -16,21 +18,31 @@ let
     then null
     else realGrub;
 
+  grubEfi =
+    # EFI version of Grub v2
+    if (cfg.devices != ["nodev"]) && cfg.efiSupport && (cfg.version == 2)
+    then pkgs.grub2.override { zfsSupport = cfg.zfsSupport; efiSupport = cfg.efiSupport; }
+    else null;
+
   f = x: if x == null then "" else "" + x;
 
   grubConfig = pkgs.writeText "grub-config.xml" (builtins.toXML
     { splashImage = f config.boot.loader.grub.splashImage;
       grub = f grub;
+      grubTarget = f grub.grubTarget;
       shell = "${pkgs.stdenv.shell}";
       fullVersion = (builtins.parseDrvName realGrub.name).version;
+      grubEfi = f grubEfi;
+      grubTargetEfi = if cfg.efiSupport && (cfg.version == 2) then f grubEfi.grubTarget else "";
+      inherit (efi) efiSysMountPoint canTouchEfiVariables;
       inherit (cfg)
         version extraConfig extraPerEntryConfig extraEntries
         extraEntriesBeforeNixOS extraPrepareConfig configurationLimit copyKernels timeout
-        default devices fsIdentifier;
-      path = (makeSearchPath "bin" [
+        default devices fsIdentifier efiSupport;
+      path = (makeSearchPath "bin" ([
         pkgs.coreutils pkgs.gnused pkgs.gnugrep pkgs.findutils pkgs.diffutils pkgs.btrfsProgs
-        pkgs.utillinux
-      ]) + ":" + (makeSearchPath "sbin" [
+        pkgs.utillinux ] ++ (if cfg.efiSupport && (cfg.version == 2) then [pkgs.efibootmgr ] else [])
+      )) + ":" + (makeSearchPath "sbin" [
         pkgs.mdadm pkgs.utillinux
       ]);
     });
@@ -231,6 +243,18 @@ in
         type = types.bool;
         description = ''
           Whether grub should be build against libzfs.
+          ZFS support is only available for GRUB v2.
+          This option is ignored for GRUB v1.
+        '';
+      };
+
+      efiSupport = mkOption {
+        default = false;
+        type = types.bool;
+        description = ''
+          Whether grub should be build with EFI support.
+          EFI support is only available for GRUB v2.
+          This option is ignored for GRUB v1.
         '';
       };
 
@@ -269,7 +293,7 @@ in
         if cfg.devices == [] then
           throw "You must set the option ‘boot.loader.grub.device’ to make the system bootable."
         else
-          "PERL5LIB=${makePerlPath (with pkgs.perlPackages; [ FileSlurp XMLLibXML XMLSAX ])} " +
+          "PERL5LIB=${makePerlPath (with pkgs.perlPackages; [ FileSlurp XMLLibXML XMLSAX ListCompare ])} " +
           (if cfg.enableCryptodisk then "GRUB_ENABLE_CRYPTODISK=y " else "") +
           "${pkgs.perl}/bin/perl ${./install-grub.pl} ${grubConfig}";
 
diff --git a/nixos/modules/system/boot/loader/grub/install-grub.pl b/nixos/modules/system/boot/loader/grub/install-grub.pl
index ffee0271e93b..74a934c67931 100644
--- a/nixos/modules/system/boot/loader/grub/install-grub.pl
+++ b/nixos/modules/system/boot/loader/grub/install-grub.pl
@@ -7,6 +7,7 @@ use File::Path;
 use File::stat;
 use File::Copy;
 use File::Slurp;
+require List::Compare;
 use POSIX;
 use Cwd;
 
@@ -39,6 +40,7 @@ sub runCommand {
 
 my $grub = get("grub");
 my $grubVersion = int(get("version"));
+my $grubTarget = get("grubTarget");
 my $extraConfig = get("extraConfig");
 my $extraPrepareConfig = get("extraPrepareConfig");
 my $extraPerEntryConfig = get("extraPerEntryConfig");
@@ -50,6 +52,10 @@ my $copyKernels = get("copyKernels") eq "true";
 my $timeout = int(get("timeout"));
 my $defaultEntry = int(get("default"));
 my $fsIdentifier = get("fsIdentifier");
+my $grubEfi = get("grubEfi");
+my $grubTargetEfi = get("grubTargetEfi");
+my $canTouchEfiVariables = get("canTouchEfiVariables");
+my $efiSysMountPoint = get("efiSysMountPoint");
 $ENV{'PATH'} = get("path");
 
 die "unsupported GRUB version\n" if $grubVersion != 1 && $grubVersion != 2;
@@ -103,6 +109,8 @@ sub GetFs {
 
         # Skip the read-only bind-mount on /nix/store.
         next if $mountPoint eq "/nix/store" && (grep { $_ eq "rw" } @superOptions) && (grep { $_ eq "ro" } @mountOptions);
+        # Skip mount point generated by systemd-efi-boot-generator?
+        next if $fsType eq "autofs";
 
         # Ensure this matches the intended directory
         next unless PathInMount($dir, $mountPoint);
@@ -402,16 +410,114 @@ foreach my $fn (glob "/boot/kernels/*") {
 }
 
 
-# Install GRUB if the version changed from the last time we installed
-# it.  FIXME: shouldn't we reinstall if ‘devices’ changed?
-my $prevVersion = readFile("/boot/grub/version") // "";
-if (($ENV{'NIXOS_INSTALL_GRUB'} // "") eq "1" || get("fullVersion") ne $prevVersion) {
+#
+# Install GRUB if the parameters changed from the last time we installed it.
+#
+
+struct(GrubState => {
+    version => '$',
+    efi => '$',
+    devices => '$',
+    efiMountPoint => '$',
+});
+sub readGrubState {
+    my $defaultGrubState = GrubState->new(version => "", efi => "", devices => "", efiMountPoint => "" );
+    open FILE, "</boot/grub/state" or return $defaultGrubState;
+    local $/ = "\n";
+    my $version = <FILE>;
+    chomp($version);
+    my $efi = <FILE>;
+    chomp($efi);
+    my $devices = <FILE>;
+    chomp($devices);
+    my $efiMountPoint = <FILE>;
+    chomp($efiMountPoint);
+    close FILE;
+    my $grubState = GrubState->new(version => $version, efi => $efi, devices => $devices, efiMountPoint => $efiMountPoint );
+    return $grubState
+}
+
+sub getDeviceTargets {
+    my @devices = ();
     foreach my $dev ($dom->findnodes('/expr/attrs/attr[@name = "devices"]/list/string/@value')) {
         $dev = $dev->findvalue(".") or die;
+        push(@devices, $dev);
+    }
+    return @devices;
+}
+
+# check whether to install GRUB EFI or not
+sub getEfiTarget {
+    if (($grub ne "") && ($grubEfi ne "")) {
+        # EFI can only be installed when target is set;
+        # A target is also required then for non-EFI grub
+        if (($grubTarget eq "") || ($grubTargetEfi eq "")) { die }
+        else { return "both" }
+    } elsif (($grub ne "") && ($grubEfi eq "")) {
+        # TODO: It would be safer to disallow non-EFI grub installation if no taget is given.
+        #       If no target is given, then grub auto-detects the target which can lead to errors.
+        #       E.g. it seems as if grub would auto-detect a EFI target based on the availability
+        #       of a EFI partition.
+        #       However, it seems as auto-detection is currently relied on for non-x86_64 and non-i386
+        #       architectures in NixOS. That would have to be fixed in the nixos modules first.
+        return "no"
+    } elsif (($grub eq "") && ($grubEfi ne "")) {
+        # EFI can only be installed when target is set;
+        if ($grubTargetEfi eq "") { die }
+        else {return "only" }
+    } else {
+        # at least one grub target has to be given
+        die
+    }
+}
+
+my @deviceTargets = getDeviceTargets();
+my $efiTarget = getEfiTarget();
+my $prevGrubState = readGrubState();
+my @prevDeviceTargets = split/:/, $prevGrubState->devices;
+
+my $devicesDiffer = scalar (List::Compare->new( '-u', '-a', \@deviceTargets, \@prevDeviceTargets)->get_symmetric_difference() );
+my $versionDiffer = (get("fullVersion") eq \$prevGrubState->version);
+my $efiDiffer = ($efiTarget eq \$prevGrubState->efi);
+my $efiMountPointDiffer = ($efiSysMountPoint eq \$prevGrubState->efiMountPoint);
+my $requireNewInstall = $devicesDiffer || $versionDiffer || $efiDiffer || $efiMountPointDiffer || (($ENV{'NIXOS_INSTALL_GRUB'} // "") eq "1");
+
+
+# install non-EFI GRUB
+if (($requireNewInstall != 0) && ($efiTarget eq "no" || $efiTarget eq "both")) {
+    foreach my $dev (@deviceTargets) {
         next if $dev eq "nodev";
         print STDERR "installing the GRUB $grubVersion boot loader on $dev...\n";
-        system("$grub/sbin/grub-install", "--recheck", Cwd::abs_path($dev)) == 0
-            or die "$0: installation of GRUB on $dev failed\n";
+        if ($grubTarget eq "") {
+            system("$grub/sbin/grub-install", "--recheck", Cwd::abs_path($dev)) == 0
+                or die "$0: installation of GRUB on $dev failed\n";
+        } else {
+            system("$grub/sbin/grub-install", "--recheck", "--target=$grubTarget", Cwd::abs_path($dev)) == 0
+                or die "$0: installation of GRUB on $dev failed\n";
+        }
     }
-    writeFile("/boot/grub/version", get("fullVersion"));
+}
+
+
+# install EFI GRUB
+if (($requireNewInstall != 0) && ($efiTarget eq "only" || $efiTarget eq "both")) {
+    print STDERR "installing the GRUB $grubVersion EFI boot loader into $efiSysMountPoint...\n";
+    if ($canTouchEfiVariables eq "true") {
+        system("$grubEfi/sbin/grub-install", "--recheck", "--target=$grubTargetEfi", "--efi-directory=$efiSysMountPoint") == 0
+                or die "$0: installation of GRUB EFI into $efiSysMountPoint failed\n";
+    } else {
+        system("$grubEfi/sbin/grub-install", "--recheck", "--target=$grubTargetEfi", "--efi-directory=$efiSysMountPoint", "--no-nvram") == 0
+                or die "$0: installation of GRUB EFI into $efiSysMountPoint failed\n";
+    }
+}
+
+
+# update GRUB state file
+if ($requireNewInstall != 0) {
+    open FILE, ">/boot/grub/state" or die "cannot create /boot/grub/state: $!\n";
+    print FILE get("fullVersion"), "\n" or die;
+    print FILE $efiTarget, "\n" or die;
+    print FILE join( ":", @deviceTargets ), "\n" or die;
+    print FILE $efiSysMountPoint, "\n" or die;
+    close FILE or die;
 }
diff --git a/pkgs/applications/audio/ncmpcpp/default.nix b/pkgs/applications/audio/ncmpcpp/default.nix
index e83e5a8ca74e..5eef35aa0610 100644
--- a/pkgs/applications/audio/ncmpcpp/default.nix
+++ b/pkgs/applications/audio/ncmpcpp/default.nix
@@ -1,23 +1,44 @@
-{ stdenv, fetchurl, ncurses, curl, taglib, fftw, mpd_clientlib, pkgconfig
-, libiconvOrEmpty, boost, readline }:
+{ stdenv, fetchurl, boost, mpd_clientlib, ncurses, pkgconfig, readline
+, libiconvOrEmpty
+, outputsSupport ? false # outputs screen
+, visualizerSupport ? false, fftw ? null # visualizer screen
+, clockSupport ? false # clock screen
+, unicodeSupport ? true # utf8 support
+, curlSupport ? true, curl ? null # allow fetching lyrics from the internet
+, taglibSupport ? true, taglib ? null # tag editor
+}:
 
+assert visualizerSupport -> (fftw != null);
+assert curlSupport -> (curl != null);
+assert taglibSupport -> (taglib != null);
+
+with stdenv.lib;
 stdenv.mkDerivation rec {
-  version = "0.6.2";
   name = "ncmpcpp-${version}";
+  version = "0.6.2";
 
   src = fetchurl {
-    url = "http://ncmpcpp.rybczak.net/stable/ncmpcpp-${version}.tar.bz2";
+    url = "http://ncmpcpp.rybczak.net/stable/${name}.tar.bz2";
     sha256 = "1mrd6m6ph0fscxp9x96ipxh6ai7w0n1miapcfqrqfy058qx5zbck";
   };
 
-  configureFlags = "BOOST_LIB_SUFFIX=";
+  configureFlags = [ "BOOST_LIB_SUFFIX=" ]
+    ++ optional outputsSupport "--enable-outputs"
+    ++ optional visualizerSupport "--enable-visualizer --with-fftw"
+    ++ optional clockSupport "--enable-clock"
+    ++ optional unicodeSupport "--enable-unicode"
+    ++ optional curlSupport "--with-curl"
+    ++ optional taglibSupport "--with-taglib";
 
-  buildInputs = [ ncurses curl taglib fftw mpd_clientlib boost pkgconfig readline ]
+  buildInputs = [ boost mpd_clientlib ncurses pkgconfig readline ]
+    ++ optional curlSupport curl
+    ++ optional visualizerSupport fftw
+    ++ optional taglibSupport taglib
     ++ libiconvOrEmpty;
 
-  meta = with stdenv.lib; {
-    description = "Curses-based interface for MPD (music player daemon)";
-    homepage    = http://unkart.ovh.org/ncmpcpp/;
+  meta = {
+    description = "A featureful ncurses based MPD client inspired by ncmpc";
+    homepage    = http://ncmpcpp.rybczak.net/;
     license     = licenses.gpl2Plus;
     maintainers = with maintainers; [ lovek323 mornfall koral ];
     platforms   = platforms.all;
diff --git a/pkgs/applications/networking/sync/rsync/default.nix b/pkgs/applications/networking/sync/rsync/default.nix
index 8d32c1e5d865..5e29e3cfd0dd 100644
--- a/pkgs/applications/networking/sync/rsync/default.nix
+++ b/pkgs/applications/networking/sync/rsync/default.nix
@@ -11,13 +11,13 @@ stdenv.mkDerivation rec {
 
   mainSrc = fetchurl {
     # signed with key 0048 C8B0 26D4 C96F 0E58  9C2F 6C85 9FB1 4B96 A8C5
-    url = "http://rsync.samba.org/ftp/rsync/src/rsync-${version}.tar.gz";
+    url = "mirror://samba/rsync/src/rsync-${version}.tar.gz";
     sha256 = "0896iah6w72q5izpxgkai75bn40dqkqifi2ivcxjzr2zrx7kdr3x";
   };
 
   patchesSrc = fetchurl {
     # signed with key 0048 C8B0 26D4 C96F 0E58  9C2F 6C85 9FB1 4B96 A8C5
-    url = "http://rsync.samba.org/ftp/rsync/rsync-patches-${version}.tar.gz";
+    url = "mirror://samba/rsync/rsync-patches-${version}.tar.gz";
     sha256 = "0iij996xbyn20yr4w3kv3rw3cx4jwkg2k85x6w5hb5xlgsis8zjl";
   };
 
diff --git a/pkgs/applications/video/makemkv/default.nix b/pkgs/applications/video/makemkv/default.nix
index 1eef680b7d1d..777fbde904ec 100644
--- a/pkgs/applications/video/makemkv/default.nix
+++ b/pkgs/applications/video/makemkv/default.nix
@@ -4,22 +4,22 @@
 
 stdenv.mkDerivation rec {
   name = "makemkv-${ver}";
-  ver = "1.9.0";
+  ver = "1.9.1";
   builder = ./builder.sh;
 
   src_bin = fetchurl {
     url = "http://www.makemkv.com/download/makemkv-bin-${ver}.tar.gz";
-    sha256 = "1rcvg7a1h59mfwsl5w0fr89m101pkqm9vgj06dl91hkgp5nh3wah";
+    sha256 = "0458ilchi64q8yw4kxck565anpn6lf5awrnkz17bk38qdgp0i2nq";
   };
 
-  src_oss = fetchurl { 
+  src_oss = fetchurl {
     url = "http://www.makemkv.com/download/makemkv-oss-${ver}.tar.gz";
-    sha256 = "0415gw2nacb57sz5m0hcaznynmznc6v8qb6028qnsqgv39d4w8f8";
+    sha256 = "1x4mjx32839gf9k2zrjz2250valnqcaa2q89kc7sipgsl4b7wrr2";
   };
 
   buildInputs = [openssl qt4 mesa zlib pkgconfig libav];
 
-  libPath = stdenv.lib.makeLibraryPath [stdenv.cc.cc openssl mesa qt4 zlib ] 
+  libPath = stdenv.lib.makeLibraryPath [stdenv.cc.cc openssl mesa qt4 zlib ]
           + ":" + stdenv.cc.cc + "/lib64";
 
   meta = with stdenv.lib; {
diff --git a/pkgs/build-support/fetchurl/mirrors.nix b/pkgs/build-support/fetchurl/mirrors.nix
index 5f0fe5fa4869..53104f2f1f26 100644
--- a/pkgs/build-support/fetchurl/mirrors.nix
+++ b/pkgs/build-support/fetchurl/mirrors.nix
@@ -137,6 +137,11 @@ rec {
     http://www.centervenus.com/mirrors/nongnu/
   ];
 
+  samba = [
+    http://samba.org/ftp/
+    http://ftp.riken.jp/net/samba
+  ];
+
   # BitlBee mirrors, see http://www.bitlbee.org/main.php/mirrors.html .
   bitlbee = [
     http://get.bitlbee.org/
diff --git a/pkgs/development/interpreters/pypy/default.nix b/pkgs/development/interpreters/pypy/default.nix
index 62a0c0fb5a2f..f67c48c62d8d 100644
--- a/pkgs/development/interpreters/pypy/default.nix
+++ b/pkgs/development/interpreters/pypy/default.nix
@@ -81,6 +81,7 @@ let
        mkdir -p $out/{bin,include,lib,pypy-c}
 
        cp -R {include,lib_pypy,lib-python,pypy-c} $out/pypy-c
+       cp libpypy-c.so $out/lib/
        ln -s $out/pypy-c/pypy-c $out/bin/pypy
        chmod +x $out/bin/pypy
 
@@ -88,13 +89,12 @@ let
        ln -s $out/pypy-c/include $out/include/${libPrefix}
        ln -s $out/pypy-c/lib-python/${pythonVersion} $out/lib/${libPrefix}
 
+       wrapProgram "$out/bin/pypy" \
+         --set LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:$out/lib" \
+         --set LIBRARY_PATH "${LIBRARY_PATH}:$out/lib"
+
        # verify cffi modules
        $out/bin/pypy -c "import Tkinter;import sqlite3;import curses"
-
-       # make sure pypy finds sqlite3 library
-       wrapProgram "$out/bin/pypy" \
-         --set LD_LIBRARY_PATH "${LD_LIBRARY_PATH}" \
-         --set LIBRARY_PATH "${LIBRARY_PATH}"
     '';
 
     passthru = rec {
@@ -105,11 +105,11 @@ let
       interpreter = "${self}/bin/${executable}";
     };
 
-    enableParallelBuilding = true;
+    enableParallelBuilding = true;  # almost no parallelization without STM
 
     meta = with stdenv.lib; {
       homepage = http://pypy.org/;
-      description = "Fast, compliant alternative implementation of the Python language (2.7.3)";
+      description = "Fast, compliant alternative implementation of the Python language (2.7.8)";
       license = licenses.mit;
       platforms = platforms.linux;
       maintainers = with maintainers; [ iElectric ];
diff --git a/pkgs/development/libraries/celt/0.5.1.nix b/pkgs/development/libraries/celt/0.5.1.nix
index a520ffd9c0f3..561be1ba2819 100644
--- a/pkgs/development/libraries/celt/0.5.1.nix
+++ b/pkgs/development/libraries/celt/0.5.1.nix
@@ -1,47 +1,10 @@
-x@{builderDefsPackage
-  , ...}:
-builderDefsPackage
-(a :
-let
-  helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++
-    [];
+{ callPackage, fetchurl, ... } @ args:
 
-  buildInputs = map (n: builtins.getAttr n x)
-    (builtins.attrNames (builtins.removeAttrs x helperArgNames));
-  sourceInfo = rec {
-    baseName="celt";
-    version="0.5.1.3";
-    name="${baseName}-${version}";
-    url="http://downloads.xiph.org/releases/${baseName}/${name}.tar.gz";
-    hash="0bkam9z5vnrxpbxkkh9kw6yzjka9di56h11iijikdd1f71l5nbpw";
-  };
-in
-rec {
-  src = a.fetchurl {
-    url = sourceInfo.url;
-    sha256 = sourceInfo.hash;
-  };
-
-  inherit (sourceInfo) name version;
-  inherit buildInputs;
+callPackage ./generic.nix (args // rec{
+  version = "0.5.1.3";
 
-  /* doConfigure should be removed if not needed */
-  phaseNames = ["doConfigure" "doMakeInstall"];
-
-  meta = {
-    description = "CELT - low-delay audio codec";
-    maintainers = with a.lib.maintainers;
-    [
-      raskin
-    ];
-    platforms = with a.lib.platforms;
-      linux;
-    license = a.lib.licenses.free;
-    branch = "0.5.1";
-  };
-  passthru = {
-    updateInfo = {
-      downloadPage = "http://www.celt-codec.org/downloads/";
-    };
+  src = fetchurl {
+    url = "http://downloads.xiph.org/releases/celt/celt-${version}.tar.gz";
+    sha256 = "0bkam9z5vnrxpbxkkh9kw6yzjka9di56h11iijikdd1f71l5nbpw";
   };
-}) x
+})
diff --git a/pkgs/development/libraries/celt/0.7.nix b/pkgs/development/libraries/celt/0.7.nix
index db4c0821336b..a5dd401ec49d 100644
--- a/pkgs/development/libraries/celt/0.7.nix
+++ b/pkgs/development/libraries/celt/0.7.nix
@@ -1,47 +1,10 @@
-x@{builderDefsPackage
-  , ...}:
-builderDefsPackage
-(a :
-let
-  helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++
-    [];
+{ callPackage, fetchurl, ... } @ args:
 
-  buildInputs = map (n: builtins.getAttr n x)
-    (builtins.attrNames (builtins.removeAttrs x helperArgNames));
-  sourceInfo = rec {
-    baseName="celt";
-    version="0.7.1";
-    name="${baseName}-${version}";
-    url="http://downloads.xiph.org/releases/${baseName}/${name}.tar.gz";
-    hash="93f0e2dfb59021b19e69dc0dee855eb89f19397db1dea0d0d6f9329cff933066";
-  };
-in
-rec {
-  src = a.fetchurl {
-    url = sourceInfo.url;
-    sha256 = sourceInfo.hash;
-  };
-
-  inherit (sourceInfo) name version;
-  inherit buildInputs;
+callPackage ./generic.nix (args // rec{
+  version = "0.7.1";
 
-  /* doConfigure should be removed if not needed */
-  phaseNames = ["doConfigure" "doMakeInstall"];
-
-  meta = {
-    description = "CELT - low-delay audio codec";
-    maintainers = with a.lib.maintainers;
-    [
-      raskin
-    ];
-    platforms = with a.lib.platforms;
-      linux;
-    license = a.lib.licenses.free;
-    branch = "0.7";
-  };
-  passthru = {
-    updateInfo = {
-      downloadPage = "http://www.celt-codec.org/downloads/";
-    };
+  src = fetchurl {
+    url = "http://downloads.xiph.org/releases/celt/celt-${version}.tar.gz";
+    sha256 = "0rihjgzrqcprsv8a1pmiglwik7xqbs2yw3fwd6gb28chnpgy5w4k";
   };
-}) x
+})
diff --git a/pkgs/development/libraries/celt/default.nix b/pkgs/development/libraries/celt/default.nix
index 03eba5a8d254..61352d5caf93 100644
--- a/pkgs/development/libraries/celt/default.nix
+++ b/pkgs/development/libraries/celt/default.nix
@@ -1,46 +1,10 @@
-x@{builderDefsPackage
-  , ...}:
-builderDefsPackage
-(a :
-let
-  helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++
-    [];
+{ callPackage, fetchurl, ... } @ args:
 
-  buildInputs = map (n: builtins.getAttr n x)
-    (builtins.attrNames (builtins.removeAttrs x helperArgNames));
-  sourceInfo = rec {
-    baseName="celt";
-    version="0.11.3";
-    name="${baseName}-${version}";
-    url="http://downloads.xiph.org/releases/${baseName}/${name}.tar.gz";
-    hash="0dh893wqbh0q4a0x1xyqryykmnhpv7mkblpch019s04a99fq2r3y";
-  };
-in
-rec {
-  src = a.fetchurl {
-    url = sourceInfo.url;
-    sha256 = sourceInfo.hash;
-  };
-
-  inherit (sourceInfo) name version;
-  inherit buildInputs;
+callPackage ./generic.nix (args // rec{
+  version = "0.11.3";
 
-  /* doConfigure should be removed if not needed */
-  phaseNames = ["doConfigure" "doMakeInstall"];
-
-  meta = {
-    description = "Low-delay audio codec";
-    maintainers = with a.lib.maintainers;
-    [
-      raskin
-    ];
-    platforms = with a.lib.platforms;
-      linux;
-    license = a.lib.licenses.free;
-  };
-  passthru = {
-    updateInfo = {
-      downloadPage = "http://www.celt-codec.org/downloads/";
-    };
+  src = fetchurl {
+    url = "http://downloads.xiph.org/releases/celt/celt-${version}.tar.gz";
+    sha256 = "0dh893wqbh0q4a0x1xyqryykmnhpv7mkblpch019s04a99fq2r3y";
   };
-}) x
+})
diff --git a/pkgs/development/libraries/celt/generic.nix b/pkgs/development/libraries/celt/generic.nix
new file mode 100644
index 000000000000..59778d36f858
--- /dev/null
+++ b/pkgs/development/libraries/celt/generic.nix
@@ -0,0 +1,23 @@
+{ stdenv, version, src
+, liboggSupport ? true, libogg ? null # if disabled only the library will be built
+, ...
+}:
+
+# The celt codec has been deprecated and is now a part of the opus codec
+
+stdenv.mkDerivation rec {
+  name = "celt-${version}";
+
+  inherit src;
+
+  buildInputs = []
+    ++ stdenv.lib.optional liboggSupport libogg;
+
+  meta = with stdenv.lib; {
+    description = "Ultra-low delay audio codec";
+    homepage    = http://www.celt-codec.org/;
+    license     = licenses.bsd2;
+    maintainers = with maintainers; [ codyopel raskin ];
+    platform    = platforms.unix;
+  };
+}
diff --git a/pkgs/development/libraries/ctdb/default.nix b/pkgs/development/libraries/ctdb/default.nix
index c3321108d865..3176352a72e3 100644
--- a/pkgs/development/libraries/ctdb/default.nix
+++ b/pkgs/development/libraries/ctdb/default.nix
@@ -4,7 +4,7 @@ stdenv.mkDerivation rec {
   name = "ctdb-2.5.4";
 
   src = fetchurl {
-    url = "http://samba.org/ftp/ctdb/${name}.tar.gz";
+    url = "mirror://samba/ctdb/${name}.tar.gz";
     sha256 = "09fb29ngxnh1crsqchykg23bl6s4fifvxwq4gwg1y742mmnjp9fy";
   };
 
diff --git a/pkgs/development/libraries/faac/default.nix b/pkgs/development/libraries/faac/default.nix
index a058fb9cfa21..6fe3601aeaa7 100644
--- a/pkgs/development/libraries/faac/default.nix
+++ b/pkgs/development/libraries/faac/default.nix
@@ -1,20 +1,32 @@
-{ stdenv, fetchurl, mp4v2 }:
+{ stdenv, fetchurl
+, mp4v2Support ? true, mp4v2 ? null
+, drmSupport ? false # Digital Radio Mondiale
+}:
 
+assert mp4v2Support -> (mp4v2 != null);
+
+with stdenv.lib;
 stdenv.mkDerivation rec {
-  name = "faac-1.28";
+  name = "faac-${version}";
+  version = "1.28";
 
   src = fetchurl {
     url = "mirror://sourceforge/faac/${name}.tar.gz";
     sha256 = "1pqr7nf6p2r283n0yby2czd3iy159gz8rfinkis7vcfgyjci2565";
   };
 
-  buildInputs = [ mp4v2 ];
+  configureFlags = [ ]
+    ++ optional mp4v2Support "--with-mp4v2"
+    ++ optional drmSupport "--enable-drm";
+
+  buildInputs = [ ]
+    ++ optional mp4v2Support mp4v2;
 
   meta = {
     description = "Open source MPEG-4 and MPEG-2 AAC encoder";
-    homepage = http://www.audiocoding.com/faac.html;
-    # Incompatible with GPL. Some changes to the base code, included in faac,
-    # are under LGPL though.
-    license = stdenv.lib.licenses.unfreeRedistributable;
+    homepage    = http://www.audiocoding.com/faac.html;
+    license     = licenses.unfree;
+    maintainers = with maintainers; [ codyopel ];
+    platforms   = platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/ldb/default.nix b/pkgs/development/libraries/ldb/default.nix
index a7583c8d062e..166444d1b3b0 100644
--- a/pkgs/development/libraries/ldb/default.nix
+++ b/pkgs/development/libraries/ldb/default.nix
@@ -6,10 +6,7 @@ stdenv.mkDerivation rec {
   name = "ldb-1.1.19";
 
   src = fetchurl {
-    urls = [
-      "http://samba.org/ftp/ldb/${name}.tar.gz"
-      "http://distfiles.exherbo.org/distfiles/${name}.tar.gz"
-    ];
+    url = "mirror://samba/ldb/${name}.tar.gz";
     sha256 = "1p2815z9sjack08pcdbv4xzp1fvr4lxcn30rj0wh3py4ly6ji1h0";
   };
 
diff --git a/pkgs/development/libraries/ntdb/default.nix b/pkgs/development/libraries/ntdb/default.nix
index 653f07bd716b..0d553f68885f 100644
--- a/pkgs/development/libraries/ntdb/default.nix
+++ b/pkgs/development/libraries/ntdb/default.nix
@@ -6,10 +6,7 @@ stdenv.mkDerivation rec {
   name = "ntdb-1.0";
 
   src = fetchurl {
-    urls = [
-      "http://samba.org/ftp/tdb/${name}.tar.gz"
-      "http://ftp.riken.jp/net/samba/tdb/${name}.tar.gz"
-    ];
+    url = "mirror://samba/tdb/${name}.tar.gz";
     sha256 = "0jdzgrz5sr25k83yrw7wqb3r0yj1v04z4s3lhsmnr5z6n5ifhyl1";
   };
 
diff --git a/pkgs/development/libraries/talloc/default.nix b/pkgs/development/libraries/talloc/default.nix
index 8c82d9470f3a..8a523593c4b3 100644
--- a/pkgs/development/libraries/talloc/default.nix
+++ b/pkgs/development/libraries/talloc/default.nix
@@ -6,7 +6,7 @@ stdenv.mkDerivation rec {
   name = "talloc-2.1.1";
 
   src = fetchurl {
-    url = "http://samba.org/ftp/talloc/${name}.tar.gz";
+    url = "mirror://samba/talloc/${name}.tar.gz";
     sha256 = "0x31id42b425dbxv5whrqlc6dj14ph7wzs3wsp1ggi537dncwa9y";
   };
 
diff --git a/pkgs/development/libraries/tdb/default.nix b/pkgs/development/libraries/tdb/default.nix
index 778cf8a8d7b7..81227f0829bc 100644
--- a/pkgs/development/libraries/tdb/default.nix
+++ b/pkgs/development/libraries/tdb/default.nix
@@ -6,10 +6,7 @@ stdenv.mkDerivation rec {
   name = "tdb-1.3.4";
 
   src = fetchurl {
-    urls = [
-      "http://samba.org/ftp/tdb/${name}.tar.gz"
-      "http://distfiles.exherbo.org/distfiles/${name}.tar.gz"
-    ];
+    url = "mirror://samba/tdb/${name}.tar.gz";
     sha256 = "0a8pa4ar7dxkbsgv1447av2rn35a1m6l1v2s9hgz3ccwni9wv1gm";
   };
 
diff --git a/pkgs/development/libraries/tevent/default.nix b/pkgs/development/libraries/tevent/default.nix
index 978d106e91e1..833fd69aa9c6 100644
--- a/pkgs/development/libraries/tevent/default.nix
+++ b/pkgs/development/libraries/tevent/default.nix
@@ -6,7 +6,7 @@ stdenv.mkDerivation rec {
   name = "tevent-0.9.22";
 
   src = fetchurl {
-    url = "http://samba.org/ftp/tevent/${name}.tar.gz";
+    url = "mirror://samba/tevent/${name}.tar.gz";
     sha256 = "0myyi3lwsi6f3f0a5qw8rjpm2d5yf18pw4vljdwyi885l411sksl";
   };
 
diff --git a/pkgs/development/tools/misc/ccache/default.nix b/pkgs/development/tools/misc/ccache/default.nix
index 65a92a05e0e3..305ccdb8dd06 100644
--- a/pkgs/development/tools/misc/ccache/default.nix
+++ b/pkgs/development/tools/misc/ccache/default.nix
@@ -5,7 +5,7 @@ let
 stdenv.mkDerivation {
   name = "ccache-3.2.1";
   src = fetchurl {
-    url = http://samba.org/ftp/ccache/ccache-3.2.1.tar.xz;
+    url = mirror://samba/ccache/ccache-3.2.1.tar.xz;
     sha256 = "17dxb0adha2bqzb2r8rcc3kl9mk7y6vrvlh181liivrc3m7g6al7";
   };
 
diff --git a/pkgs/os-specific/linux/cifs-utils/default.nix b/pkgs/os-specific/linux/cifs-utils/default.nix
index 5126a58e1a3b..46a927209a23 100644
--- a/pkgs/os-specific/linux/cifs-utils/default.nix
+++ b/pkgs/os-specific/linux/cifs-utils/default.nix
@@ -4,7 +4,7 @@ stdenv.mkDerivation rec {
   name = "cifs-utils-6.4";
 
   src = fetchurl {
-    url = "ftp://ftp.samba.org/pub/linux-cifs/cifs-utils/${name}.tar.bz2";
+    url = "mirror://samba/pub/linux-cifs/cifs-utils/${name}.tar.bz2";
     sha256 = "1qz6d2xg4z1if0hy7qwyzgcr59l0alkhci6gxgjdldglda967z1q";
   };
 
diff --git a/pkgs/servers/samba/3.x.nix b/pkgs/servers/samba/3.x.nix
index b0b1b152e9b7..ad8a6de6729b 100644
--- a/pkgs/servers/samba/3.x.nix
+++ b/pkgs/servers/samba/3.x.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   name = "samba-3.6.24";
 
   src = fetchurl {
-    url = "http://samba.org/samba/ftp/stable/${name}.tar.gz";
+    url = "mirror://samba/pub/samba/stable/${name}.tar.gz";
     sha256 = "19rln8m1k359bz6dhmlv39kzyjg7p296dz4y4mq1jwrlnw2bvl0i";
   };
 
diff --git a/pkgs/servers/samba/4.x.nix b/pkgs/servers/samba/4.x.nix
index 283951fa7180..c290f75cd0dc 100644
--- a/pkgs/servers/samba/4.x.nix
+++ b/pkgs/servers/samba/4.x.nix
@@ -34,10 +34,7 @@ stdenv.mkDerivation rec {
   name = "samba-4.1.16";
 
   src = fetchurl {
-    urls = [
-      "http://samba.org/samba/ftp/stable/${name}.tar.gz"
-      "http://distfiles.exherbo.org/distfiles/${name}.tar.gz"
-    ];
+    url = "mirror://samba/pub/samba/stable/${name}.tar.gz";
     sha256 = "0yx840qg5q6syq81439v3pbwawacm7nwnnvph85za9gsgcb9r80j";
   };
 
diff --git a/pkgs/tools/compression/rzip/default.nix b/pkgs/tools/compression/rzip/default.nix
index 4460ae6edf3e..733634da652f 100644
--- a/pkgs/tools/compression/rzip/default.nix
+++ b/pkgs/tools/compression/rzip/default.nix
@@ -3,7 +3,7 @@
 stdenv.mkDerivation {
   name = "rzip-2.1";
   src = fetchurl {
-    url = http://rzip.samba.org/ftp/rzip/rzip-2.1.tar.gz;
+    url = mirror://samba/rzip/rzip-2.1.tar.gz;
     sha256 = "4bb96f4d58ccf16749ed3f836957ce97dbcff3e3ee5fd50266229a48f89815b7";
   };
   buildInputs = [ bzip2 ];
diff --git a/pkgs/tools/misc/grub/2.0x.nix b/pkgs/tools/misc/grub/2.0x.nix
index 10346ca885b0..af43d5e83961 100644
--- a/pkgs/tools/misc/grub/2.0x.nix
+++ b/pkgs/tools/misc/grub/2.0x.nix
@@ -7,12 +7,18 @@
 
 with stdenv.lib;
 let
+  pcSystems = {
+    "i686-linux".target = "i386";
+    "x86_64-linux".target = "i386";
+  };
+
   efiSystems = {
     "i686-linux".target = "i386";
     "x86_64-linux".target = "x86_64";
   };
 
   canEfi = any (system: stdenv.system == system) (mapAttrsToList (name: _: name) efiSystems);
+  inPCSystems = any (system: stdenv.system == system) (mapAttrsToList (name: _: name) pcSystems);
 
   version = "2.02-git-1de3a4";
 
@@ -80,6 +86,13 @@ stdenv.mkDerivation rec {
   configureFlags = optional zfsSupport "--enable-libzfs"
     ++ optionals efiSupport [ "--with-platform=efi" "--target=${efiSystems.${stdenv.system}.target}" "--program-prefix=" ];
 
+  # save target that grub is compiled for
+  grubTarget = if efiSupport
+               then "${efiSystems.${stdenv.system}.target}-efi"
+               else if inPCSystems
+                    then "${pcSystems.${stdenv.system}.target}-pc"
+                    else "";
+
   doCheck = false;
   enableParallelBuilding = true;
 
diff --git a/pkgs/tools/networking/ppp/default.nix b/pkgs/tools/networking/ppp/default.nix
index ad69f5751a09..b7f42b019c43 100644
--- a/pkgs/tools/networking/ppp/default.nix
+++ b/pkgs/tools/networking/ppp/default.nix
@@ -5,7 +5,7 @@ stdenv.mkDerivation rec {
   name = "ppp-${version}";
 
   src = fetchurl {
-    url = "${meta.homepage}ftp/ppp/${name}.tar.gz";
+    url = "mirror://samba/ppp/${name}.tar.gz";
     sha256 = "019m00q85nrgdpjlhb9021a3iw3pr4a0913gp4h9k7r9r7z7lca3";
   };
 
diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix
index ea0fd0c59c6b..ffd052a81918 100644
--- a/pkgs/top-level/perl-packages.nix
+++ b/pkgs/top-level/perl-packages.nix
@@ -227,6 +227,14 @@ let self = _self // overrides; _self = with self; {
     };
   };
 
+  ListCompare = buildPerlPackage {
+    name = "List-Compare-1.18";
+    src = fetchurl {
+      url = mirror://cpan/authors/id/J/JK/JKEENAN/List-Compare-0.39.tar.gz;
+      sha256 = "1v4gn176faanzf1kr9axdp1220da7nkvz0d66mnk34nd0skjjxcl";
+    };
+  };
+
   ArchiveCpio = buildPerlPackage {
     name = "Archive-Cpio-0.09";
     src = fetchurl {