about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-09-26 14:51:51 -0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-09-26 14:51:51 -0400
commitd5758c99a315faac7e0631ae4e7bd707095be3c1 (patch)
tree9177bc0c57faffe2d7fcbc562f43171f67c337eb /pkgs/build-support
parent3aae4ccffa8bdaea0bcc136c39fdc33729e76af3 (diff)
parente710915ffc681b06a61ab2257e44c1cd8abbd0ef (diff)
downloadnixlib-d5758c99a315faac7e0631ae4e7bd707095be3c1.tar
nixlib-d5758c99a315faac7e0631ae4e7bd707095be3c1.tar.gz
nixlib-d5758c99a315faac7e0631ae4e7bd707095be3c1.tar.bz2
nixlib-d5758c99a315faac7e0631ae4e7bd707095be3c1.tar.lz
nixlib-d5758c99a315faac7e0631ae4e7bd707095be3c1.tar.xz
nixlib-d5758c99a315faac7e0631ae4e7bd707095be3c1.tar.zst
nixlib-d5758c99a315faac7e0631ae4e7bd707095be3c1.zip
Merge remote-tracking branch 'origin/master' into x-updates
Conflicts:
	pkgs/misc/maven/maven-1.0.nix
	pkgs/os-specific/linux/xf86-input-wacom/default.nix
Diffstat (limited to 'pkgs/build-support')
-rwxr-xr-xpkgs/build-support/buildenv/builder.pl4
-rw-r--r--pkgs/build-support/cabal/default.nix5
-rw-r--r--pkgs/build-support/fetchhg/default.nix2
-rw-r--r--pkgs/build-support/fetchurl/default.nix32
-rw-r--r--pkgs/build-support/fetchurl/mirrors.nix6
-rw-r--r--pkgs/build-support/gcc-wrapper/buildergo.sh194
-rw-r--r--pkgs/build-support/gcc-wrapper/default.nix11
-rw-r--r--pkgs/build-support/release/ant-build.nix13
-rw-r--r--pkgs/build-support/release/binary-tarball.nix8
-rw-r--r--pkgs/build-support/release/debian-build.nix15
-rw-r--r--pkgs/build-support/release/functions.sh14
-rw-r--r--pkgs/build-support/release/nix-build.nix8
-rw-r--r--pkgs/build-support/release/rpm-build.nix18
-rw-r--r--pkgs/build-support/source-from-head-fun.nix6
-rw-r--r--pkgs/build-support/vm/deb/deb-closure.pl13
-rw-r--r--pkgs/build-support/vm/default.nix287
16 files changed, 441 insertions, 195 deletions
diff --git a/pkgs/build-support/buildenv/builder.pl b/pkgs/build-support/buildenv/builder.pl
index 71502c9f6683..08331b178f4f 100755
--- a/pkgs/build-support/buildenv/builder.pl
+++ b/pkgs/build-support/buildenv/builder.pl
@@ -66,7 +66,7 @@ sub findFiles {
 
     unless (-d $target && ($oldTarget eq "" || -d $oldTarget)) {
         if ($ignoreCollisions) {
-            warn "collision between `$target' and `$oldTarget'";
+            warn "collision between `$target' and `$oldTarget'" if $ignoreCollisions == 1;
             return;
         } else {
             die "collision between `$target' and `$oldTarget'";
@@ -122,7 +122,7 @@ while (scalar(keys %postponed) > 0) {
     my @pkgDirs = keys %postponed;
     %postponed = ();
     foreach my $pkgDir (sort @pkgDirs) {
-        addPkg($pkgDir, 1);
+        addPkg($pkgDir, 2);
     }
 }
 
diff --git a/pkgs/build-support/cabal/default.nix b/pkgs/build-support/cabal/default.nix
index 8ae8c06d5132..42392aff60c4 100644
--- a/pkgs/build-support/cabal/default.nix
+++ b/pkgs/build-support/cabal/default.nix
@@ -1,6 +1,6 @@
 # generic builder for Cabal packages
 
-{stdenv, fetchurl, lib, pkgconfig, ghc, Cabal, enableLibraryProfiling ? false} :
+{ stdenv, fetchurl, lib, pkgconfig, ghc, Cabal, jailbreakCabal, enableLibraryProfiling ? false }:
 {
   mkDerivation =
     args : # arguments for the individual package, can modify the defaults
@@ -86,7 +86,8 @@
             configurePhase = ''
               eval "$preConfigure"
 
-              for i in Setup.hs Setup.lhs; do
+              ${lib.optionalString (lib.attrByPath ["jailbreak"] false self) "${jailbreakCabal}/bin/jailbreak-cabal ${self.pname}.cabal && "
+              }for i in Setup.hs Setup.lhs; do
                 test -f $i && ghc --make $i
               done
 
diff --git a/pkgs/build-support/fetchhg/default.nix b/pkgs/build-support/fetchhg/default.nix
index bc27516f46d5..537867f215ba 100644
--- a/pkgs/build-support/fetchhg/default.nix
+++ b/pkgs/build-support/fetchhg/default.nix
@@ -4,7 +4,7 @@
 stdenv.mkDerivation {
   name = "hg-archive" + (if (name != null) then "-${name}" else "");
   builder = ./builder.sh;
-  buildInputs = [mercurial nix];
+  buildInputs = [mercurial];
 
   # Nix <= 0.7 compatibility.
   id = md5;
diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix
index ec3d45e652e8..cc59dd7fab1e 100644
--- a/pkgs/build-support/fetchurl/default.nix
+++ b/pkgs/build-support/fetchurl/default.nix
@@ -22,6 +22,21 @@ let
     then builtins.attrNames mirrors
     else [] /* backwards compatibility */;
 
+  impureEnvVars = [
+    # We borrow these environment variables from the caller to allow
+    # easy proxy configuration.  This is impure, but a fixed-output
+    # derivation like fetchurl is allowed to do so since its result is
+    # by definition pure.
+    "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
+
+    # This variable allows the user to pass additional options to curl
+    "NIX_CURL_FLAGS"
+
+    # This variable allows the user to override hashedMirrors from the
+    # command-line.
+    "NIX_HASHED_MIRRORS"
+  ] ++ (map (site: "NIX_MIRRORS_${site}") sites);
+
 in
       
 { # URL to fetch.
@@ -83,23 +98,8 @@ stdenv.mkDerivation {
       if sha256 != "" then "sha256" else if sha1 != "" then "sha1" else "md5";
   outputHash = if outputHash != "" then outputHash else
       if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
-  
-  impureEnvVars = [
-    # We borrow these environment variables from the caller to allow
-    # easy proxy configuration.  This is impure, but a fixed-output
-    # derivation like fetchurl is allowed to do so since its result is
-    # by definition pure.
-    "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
-
-    # This variable allows the user to pass additional options to curl
-    "NIX_CURL_FLAGS"
-
-    # This variable allows the user to override hashedMirrors from the
-    # command-line.
-    "NIX_HASHED_MIRRORS"
-  ] ++ (map (site: "NIX_MIRRORS_${site}") sites);
 
-  inherit showURLs mirrorsFile;
+  inherit showURLs mirrorsFile impureEnvVars;
 
   # Doing the download on a remote machine just duplicates network
   # traffic, so don't do that.
diff --git a/pkgs/build-support/fetchurl/mirrors.nix b/pkgs/build-support/fetchurl/mirrors.nix
index 0491e4994b6d..dd81692b5f2d 100644
--- a/pkgs/build-support/fetchurl/mirrors.nix
+++ b/pkgs/build-support/fetchurl/mirrors.nix
@@ -24,9 +24,6 @@ rec {
 
   # GNU (http://www.gnu.org/prep/ftp.html).
   gnu = [
-    # This one is the master repository, and thus it's always up-to-date.
-    http://ftp.gnu.org/pub/gnu/
-
     # This one redirects to a (supposedly) nearby and (supposedly) up-to-date
     # mirror.
     http://ftpmirror.gnu.org/
@@ -37,6 +34,9 @@ rec {
     ftp://ftp.cs.tu-berlin.de/pub/gnu/
     ftp://ftp.chg.ru/pub/gnu/
     ftp://ftp.funet.fi/pub/mirrors/ftp.gnu.org/gnu/
+
+    # This one is the master repository, and thus it's always up-to-date.
+    http://ftp.gnu.org/pub/gnu/
   ];
 
   # GCC.
diff --git a/pkgs/build-support/gcc-wrapper/buildergo.sh b/pkgs/build-support/gcc-wrapper/buildergo.sh
new file mode 100644
index 000000000000..cb6bfd7f0517
--- /dev/null
+++ b/pkgs/build-support/gcc-wrapper/buildergo.sh
@@ -0,0 +1,194 @@
+source $stdenv/setup
+
+
+mkdir -p $out/bin
+mkdir -p $out/nix-support
+
+
+if test -z "$nativeLibc"; then
+    dynamicLinker="$libc/lib/$dynamicLinker"
+    echo $dynamicLinker > $out/nix-support/dynamic-linker
+
+    if test -e $libc/lib/32/ld-linux.so.2; then
+        echo $libc/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32
+    fi
+
+    # The "-B$libc/lib/" flag is a quick hack to force gcc to link
+    # against the crt1.o from our own glibc, rather than the one in
+    # /usr/lib.  (This is only an issue when using an `impure'
+    # compiler/linker, i.e., one that searches /usr/lib and so on.)
+    #
+    # Unfortunately, setting -B appears to override the default search
+    # path. Thus, the gcc-specific "../includes-fixed" directory is
+    # now longer searched and glibc's <limits.h> header fails to
+    # compile, because it uses "#include_next <limits.h>" to find the
+    # limits.h file in ../includes-fixed. To remedy the problem,
+    # another -idirafter is necessary to add that directory again.
+    echo "-B$libc/lib/ -idirafter $libc/include -idirafter $gcc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags
+
+    echo "-L$libc/lib" > $out/nix-support/libc-ldflags
+
+    # The dynamic linker is passed in `ldflagsBefore' to allow
+    # explicit overrides of the dynamic linker by callers to gcc/ld
+    # (the *last* value counts, so ours should come first).
+    echo "-dynamic-linker $dynamicLinker" > $out/nix-support/libc-ldflags-before
+fi
+
+if test -n "$nativeTools"; then
+    gccPath="$nativePrefix/bin"
+    ldPath="$nativePrefix/bin"
+else
+    if test -e "$gcc/lib64"; then
+        gccLDFlags="$gccLDFlags -L$gcc/lib64"
+    fi
+    gccLDFlags="$gccLDFlags -L$gcc/lib"
+    if [ -n "$langVhdl" ]; then
+        gccLDFlags="$gccLDFlags -L$zlib/lib"
+    fi
+    echo "$gccLDFlags" > $out/nix-support/gcc-ldflags
+
+    # GCC shows $gcc/lib in `gcc -print-search-dirs', but not
+    # $gcc/lib64 (even though it does actually search there...)..
+    # This confuses libtool.  So add it to the compiler tool search
+    # path explicitly.
+    if test -e "$gcc/lib64"; then
+        gccCFlags="$gccCFlags -B$gcc/lib64"
+    fi
+
+    # Find the gcc libraries path (may work only without multilib)
+    if [ -n "$langAda" ]; then
+        basePath=`echo $gcc/lib/*/*/*`
+        gccCFlags="$gccCFlags -B$basePath -I$basePath/adainclude"
+
+        gnatCFlags="-aI$basePath/adainclude -aO$basePath/adalib"
+        echo "$gnatCFlags" > $out/nix-support/gnat-cflags
+    fi
+    echo "$gccCFlags" > $out/nix-support/gcc-cflags
+    
+    gccPath="$gcc/bin"
+    ldPath="$binutils/bin"
+fi
+
+
+doSubstitute() {
+    local src=$1
+    local dst=$2
+    # Can't use substitute() here, because replace may not have been
+    # built yet (in the bootstrap).
+    sed \
+        -e "s^@out@^$out^g" \
+        -e "s^@shell@^$shell^g" \
+        -e "s^@gcc@^$gcc^g" \
+        -e "s^@gccProg@^$gccProg^g" \
+        -e "s^@gnatProg@^$gnatProg^g" \
+        -e "s^@gnatlinkProg@^$gnatlinkProg^g" \
+        -e "s^@binutils@^$binutils^g" \
+        -e "s^@coreutils@^$coreutils^g" \
+        -e "s^@libc@^$libc^g" \
+        -e "s^@ld@^$ldPath/ld^g" \
+        < "$src" > "$dst" 
+}
+
+
+# Make wrapper scripts around gcc, g++, and gfortran.  Also make symlinks
+# cc, c++, and f77.
+mkGccWrapper() {
+    local dst=$1
+    local src=$2
+
+    if ! test -f "$src"; then
+        echo "$src does not exist (skipping)"
+        return 1
+    fi
+
+    gccProg="$src"
+    doSubstitute "$gccWrapper" "$dst"
+    chmod +x "$dst"
+}
+
+mkGnatWrapper() {
+    local dst=$1
+    local src=$2
+
+    if ! test -f "$src"; then
+        echo "$src does not exist (skipping)"
+        return 1
+    fi
+
+    gnatProg="$src"
+    doSubstitute "$gnatWrapper" "$dst"
+    chmod +x "$dst"
+}
+
+mkGnatLinkWrapper() {
+    local dst=$1
+    local src=$2
+
+    if ! test -f "$src"; then
+        echo "$src does not exist (skipping)"
+        return 1
+    fi
+
+    gnatlinkProg="$src"
+    doSubstitute "$gnatlinkWrapper" "$dst"
+    chmod +x "$dst"
+}
+
+if mkGccWrapper $out/bin/gcc $gccPath/gcc
+then
+    ln -sv gcc $out/bin/cc
+fi
+
+if mkGccWrapper $out/bin/g++ $gccPath/g++
+then
+    ln -sv g++ $out/bin/c++
+fi
+
+if mkGccWrapper $out/bin/gfortran $gccPath/gfortran
+then
+    ln -sv gfortran $out/bin/g77
+    ln -sv gfortran $out/bin/f77
+fi
+
+mkGccWrapper $out/bin/gcj $gccPath/gcj || true
+
+mkGccWrapper $out/bin/gccgo $gccPath/gccgo || true
+
+mkGccWrapper $out/bin/gnatgcc $gccPath/gnatgcc || true
+mkGnatWrapper $out/bin/gnatmake $gccPath/gnatmake || true
+mkGnatWrapper $out/bin/gnatbind $gccPath/gnatbind || true
+mkGnatLinkWrapper $out/bin/gnatlink $gccPath/gnatlink || true
+
+if [ -f $gccPath/ghdl ]; then
+    ln -sf $gccPath/ghdl $out/bin/ghdl
+fi
+
+# Create a symlink to as (the assembler).  This is useful when a
+# gcc-wrapper is installed in a user environment, as it ensures that
+# the right assembler is called.
+ln -s $ldPath/as $out/bin/as
+
+
+# Make a wrapper around the linker.
+doSubstitute "$ldWrapper" "$out/bin/ld"
+chmod +x "$out/bin/ld"
+
+
+# Emit a setup hook.  Also store the path to the original GCC and
+# Glibc.
+test -n "$gcc" && echo $gcc > $out/nix-support/orig-gcc
+test -n "$libc" && echo $libc > $out/nix-support/orig-libc
+
+doSubstitute "$addFlags" "$out/nix-support/add-flags.sh"
+
+doSubstitute "$setupHook" "$out/nix-support/setup-hook"
+
+cp -p $utils $out/nix-support/utils.sh
+
+
+# Propagate the wrapped gcc so that if you install the wrapper, you get
+# tools like gcov, the manpages, etc. as well (including for binutils
+# and Glibc).
+if test -z "$nativeTools"; then
+    echo $gcc $binutils $libc > $out/nix-support/propagated-user-env-packages
+fi
diff --git a/pkgs/build-support/gcc-wrapper/default.nix b/pkgs/build-support/gcc-wrapper/default.nix
index d3fe5a0569f9..5e50a5c7dfb5 100644
--- a/pkgs/build-support/gcc-wrapper/default.nix
+++ b/pkgs/build-support/gcc-wrapper/default.nix
@@ -21,10 +21,11 @@ let
 
   gccVersion = (builtins.parseDrvName gcc.name).version;
   gccName = (builtins.parseDrvName gcc.name).name;
-  
+
+  langGo = if nativeTools then false else gcc ? langGo && gcc.langGo;
 in
 
-stdenv.mkDerivation {
+stdenv.mkDerivation ({
   name =
     (if name != "" then name else gccName + "-wrapper") +
     (if gcc != null && gccVersion != "" then "-" + gccVersion else "");
@@ -90,3 +91,9 @@ stdenv.mkDerivation {
        abort "don't know the name of the dynamic linker for this platform")
     else "";
 }
+#  This go wrapper should be reworked in stdenv-updates.
+// (if langGo then
+{
+  inherit langGo;
+  builder = ./buildergo.sh;
+} else {}))
diff --git a/pkgs/build-support/release/ant-build.nix b/pkgs/build-support/release/ant-build.nix
index fe15f93a8fe2..0cabdf2f7e79 100644
--- a/pkgs/build-support/release/ant-build.nix
+++ b/pkgs/build-support/release/ant-build.nix
@@ -8,8 +8,8 @@
 , antProperties ? []
 , antBuildInputs ? []
 , buildfile ? "build.xml"
-, ant ? pkgs.ant
-, jre ? pkgs.jre
+, ant ? pkgs.apacheAntOpenJDK
+, jre ? pkgs.openjdk
 , hydraAntLogger ? pkgs.hydraAntLogger
 , ... } @ args:
 
@@ -100,15 +100,10 @@ stdenv.mkDerivation (
     postHook = ''
       mkdir -p $out/nix-support
       echo "$system" > $out/nix-support/system
+      . ${./functions.sh}
 
-      # If `src' is the result of a call to `makeSourceTarball', then it
-      # has a subdirectory containing the actual tarball(s).  If there are
-      # multiple tarballs, just pick the first one.
       origSrc=$src
-      if test -d $src/tarballs; then
-          src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz | sort | head -1)
-      fi
-
+      src=$(findTarballs $src | head -1)
     ''; 
   }
 )
diff --git a/pkgs/build-support/release/binary-tarball.nix b/pkgs/build-support/release/binary-tarball.nix
index 6901c9f5555f..41fab231ee34 100644
--- a/pkgs/build-support/release/binary-tarball.nix
+++ b/pkgs/build-support/release/binary-tarball.nix
@@ -35,14 +35,10 @@ stdenv.mkDerivation (
     postHook = ''
       mkdir -p $out/nix-support
       echo "$system" > $out/nix-support/system
+      . ${./functions.sh}
 
-      # If `src' is the result of a call to `makeSourceTarball', then it
-      # has a subdirectory containing the actual tarball(s).  If there are
-      # multiple tarballs, just pick the first one.
       origSrc=$src
-      if test -d $src/tarballs; then
-          src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz | sort | head -1)
-      fi
+      src=$(findTarballs $src | head -1)
 
       if test -e $origSrc/nix-support/hydra-release-name; then
           releaseName=$(cat $origSrc/nix-support/hydra-release-name)
diff --git a/pkgs/build-support/release/debian-build.nix b/pkgs/build-support/release/debian-build.nix
index 0095a2ff8818..feb15267f592 100644
--- a/pkgs/build-support/release/debian-build.nix
+++ b/pkgs/build-support/release/debian-build.nix
@@ -30,17 +30,10 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
 
     # !!! cut&paste from rpm-build.nix
     postHook = ''
-      mkdir -p $out/nix-support
-      cat "$diskImage"/nix-support/full-name > $out/nix-support/full-name
-
-      # If `src' is the result of a call to `makeSourceTarball', then it
-      # has a subdirectory containing the actual tarball(s).  If there are
-      # multiple tarballs, just pick the first one.
-      echo $src
-      if test -d $src/tarballs; then
-          src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz | sort | head -1)
-      fi
-    ''; # */
+      . ${./functions.sh}
+      propagateImageName
+      src=$(findTarballs $src | head -1) # Find a tarball.
+    '';
 
     installExtraDebsPhase = ''
       for i in $extraDebs; do
diff --git a/pkgs/build-support/release/functions.sh b/pkgs/build-support/release/functions.sh
new file mode 100644
index 000000000000..9f2d03519c8c
--- /dev/null
+++ b/pkgs/build-support/release/functions.sh
@@ -0,0 +1,14 @@
+findTarballs() {
+    local suffix
+    test -d "$1/tarballs/" && {
+        for suffix in tar.gz tgz tar.bz2 tbz2 tar.xz tar.lzma; do
+            ls $1/tarballs/*.$suffix 2> /dev/null
+        done | sort
+    }
+    echo "$1"
+}
+
+propagateImageName() {
+    ensureDir $out/nix-support
+    cat "$diskImage"/nix-support/full-name > $out/nix-support/full-name
+}
diff --git a/pkgs/build-support/release/nix-build.nix b/pkgs/build-support/release/nix-build.nix
index 8abbca978750..336563ae285f 100644
--- a/pkgs/build-support/release/nix-build.nix
+++ b/pkgs/build-support/release/nix-build.nix
@@ -58,13 +58,9 @@ stdenv.mkDerivation (
     name = name + (if src ? version then "-" + src.version else "");
   
     postHook = ''
-      # If `src' is the result of a call to `makeSourceTarball', then it
-      # has a subdirectory containing the actual tarball(s).  If there are
-      # multiple tarballs, just pick the first one.
+      . ${./functions.sh}
       origSrc=$src
-      if test -d $src/tarballs; then
-          src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz $src/tarballs/*.tar.xz | sort | head -1)
-      fi
+      src=$(findTarballs $src | head -1)
 
       # Set GCC flags for coverage analysis, if desired.
       if test -n "${toString doCoverageAnalysis}"; then
diff --git a/pkgs/build-support/release/rpm-build.nix b/pkgs/build-support/release/rpm-build.nix
index 9ec9ace07573..708b62302d57 100644
--- a/pkgs/build-support/release/rpm-build.nix
+++ b/pkgs/build-support/release/rpm-build.nix
@@ -14,16 +14,10 @@ vmTools.buildRPM (
     name = name + "-" + diskImage.name + (if src ? version then "-" + src.version else "");
 
     preBuild = ''
-      mkdir -p $out/nix-support
-      cat "$diskImage"/nix-support/full-name > $out/nix-support/full-name
-
-      # If `src' is the result of a call to `makeSourceTarball', then it
-      # has a subdirectory containing the actual tarball(s).  If there are
-      # multiple tarballs, just pick the first one.
-      if test -d $src/tarballs; then
-          src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz | sort | head -1)
-      fi
-    ''; # */
+      . ${./functions.sh}
+      propagateImageName
+      src=$(findTarballs $src | head -1) # Pick the first tarball.
+    '';
 
     postInstall = ''
       declare -a rpms rpmNames
@@ -36,12 +30,12 @@ vmTools.buildRPM (
       done
 
       echo "installing ''${rpms[*]}..."
-      rpm -ip ''${rpms[*]} --excludepath /nix/store
+      rpm -Up ''${rpms[*]} --excludepath /nix/store
 
       eval "$postRPMInstall"
       
       echo "uninstalling ''${rpmNames[*]}..."
-      rpm -e ''${rpmNames[*]}
+      rpm -e ''${rpmNames[*]} --nodeps
 
       for i in $out/rpms/*/*.src.rpm; do
         echo "file srpm $i" >> $out/nix-support/hydra-build-products
diff --git a/pkgs/build-support/source-from-head-fun.nix b/pkgs/build-support/source-from-head-fun.nix
index 3281cec54440..c6d6cfcc95b6 100644
--- a/pkgs/build-support/source-from-head-fun.nix
+++ b/pkgs/build-support/source-from-head-fun.nix
@@ -9,8 +9,8 @@
    The documentation is availible at http://github.com/MarcWeber/nix-repository-manager/raw/master/README
 
 */
-{ getConfig }:
+{ config }:
   localTarName: publishedSrcSnapshot:
-  if getConfig ["sourceFromHead" "useLocalRepos"] false then
-    "${getConfig ["sourceFromHead" "managedRepoDir"] "/set/sourceFromHead.managedRepoDir/please"}/dist/${localTarName}"
+  if config.sourceFromHead.useLocalRepos or false then
+    "${config.sourceFromHead.managedRepoDir or "/set/sourceFromHead.managedRepoDir/please"}/dist/${localTarName}"
   else publishedSrcSnapshot
diff --git a/pkgs/build-support/vm/deb/deb-closure.pl b/pkgs/build-support/vm/deb/deb-closure.pl
index 5e4ea54c43f8..1d41f89218bd 100644
--- a/pkgs/build-support/vm/deb/deb-closure.pl
+++ b/pkgs/build-support/vm/deb/deb-closure.pl
@@ -53,6 +53,8 @@ foreach my $cdata (values %packages) {
     my @provides = getDeps(Dpkg::Deps::parse($cdata->{Provides}));
     foreach my $name (@provides) {
         #die "conflicting provide: $name\n" if defined $provides{$name};
+        #warn "provide by $cdata->{Package} conflicts with package with the same name: $name\n";
+        next if defined $packages{$name};
         $provides{$name} = $cdata->{Package};
     }
 }
@@ -67,7 +69,7 @@ sub closePackage {
     my $pkgName = shift;
     print STDERR ">>> $pkgName\n";
     my $cdata = $packages{$pkgName};
-    
+
     if (!defined $cdata) {
         die "unknown (virtual) package $pkgName"
             unless defined $provides{$pkgName};
@@ -75,7 +77,7 @@ sub closePackage {
         $pkgName = $provides{$pkgName};
         $cdata = $packages{$pkgName};
     }
-    
+
     die "unknown package $pkgName" unless defined $cdata;
     return if defined $donePkgs{$pkgName};
     $donePkgs{$pkgName} = 1;
@@ -85,9 +87,9 @@ sub closePackage {
             $provides{$name} = $cdata->{Package};
         }
     }
-    
+
     my @depNames = ();
-    
+
     if (defined $cdata->{Depends}) {
         print STDERR "    $pkgName: $cdata->{Depends}\n";
         my $deps = Dpkg::Deps::parse($cdata->{Depends});
@@ -141,7 +143,7 @@ foreach my $pkgName (@order) {
     my $origName = basename $cdata->{Filename};
     my $cleanedName = $origName;
     $cleanedName =~ s/~//g;
-    
+
     print "    (fetchurl {\n";
     print "      url = $urlPrefix/$cdata->{Filename};\n";
     print "      sha256 = \"$cdata->{SHA256}\";\n";
@@ -165,4 +167,3 @@ if ($newComponent != 1) {
     print STDERR "argh: ", keys %forward, "\n";
     exit 1;
 }
-    
diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix
index 6af4a5c05748..e8de915e7889 100644
--- a/pkgs/build-support/vm/default.nix
+++ b/pkgs/build-support/vm/default.nix
@@ -34,7 +34,7 @@ rec {
     ''
       mkdir -p $out/bin
       mkdir -p $out/lib
-      
+
       # Copy what we need from Glibc.
       cp -p ${pkgs.stdenv.glibc}/lib/ld-linux*.so.? $out/lib
       cp -p ${pkgs.stdenv.glibc}/lib/libc.so.* $out/lib
@@ -60,7 +60,7 @@ rec {
       cp ${module_init_tools}/sbin/insmod $out/bin/insmod
       cp ${nettools}/sbin/ifconfig $out/bin
       cp ${sysvinit}/sbin/halt $out/bin
-            
+
       # Run patchelf to make the programs refer to the copied libraries.
       for i in $out/bin/* $out/lib/*; do if ! test -L $i; then nuke-refs $i; fi; done
 
@@ -70,17 +70,19 @@ rec {
       done
     ''; # */
 
-    
+
   createDeviceNodes = dev:
     ''
-      mknod ${dev}/null c 1 3
-      mknod ${dev}/zero c 1 5
-      mknod ${dev}/tty  c 5 0
+      mknod ${dev}/null    c 1 3
+      mknod ${dev}/zero    c 1 5
+      mknod ${dev}/random  c 1 8
+      mknod ${dev}/urandom c 1 9
+      mknod ${dev}/tty     c 5 0
       . /sys/class/block/${hd}/uevent
       mknod ${dev}/${hd} b $MAJOR $MINOR
     '';
 
-  
+
   stage1Init = writeScript "vm-run-stage1" ''
     #! ${initrdUtils}/bin/bash -e
     echo START
@@ -122,7 +124,7 @@ rec {
 
     mount -t tmpfs none /dev
     ${createDeviceNodes "/dev"}
-    
+
     ifconfig eth0 up 10.0.2.15
 
     mkdir /fs
@@ -155,7 +157,7 @@ rec {
 
     mkdir -p /fs/etc
     ln -sf /proc/mounts /fs/etc/mtab
-    
+
     echo "Now running: $command"
     test -n "$command"
 
@@ -169,7 +171,7 @@ rec {
     halt -d -p -f
   '';
 
-  
+
   initrd = makeInitrd {
     contents = [
       { object = stage1Init;
@@ -178,11 +180,11 @@ rec {
     ];
   };
 
-  
+
   stage2Init = writeScript "vm-run-stage2" ''
     #! ${bash}/bin/sh
     source /tmp/xchg/saved-env
-    
+
     export NIX_STORE=/nix/store
     export NIX_BUILD_TOP=/tmp
     export TMPDIR=/tmp
@@ -250,6 +252,7 @@ rec {
         path = $TMPDIR/xchg
         read only = no
         guest ok = yes
+      $EXTRA_SAMBA_CONF
       SMB
 
       rm -f ./samba
@@ -285,12 +288,12 @@ rec {
 
     chmod +x ./run-vm
     source ./run-vm
-    
+
     if ! test -e xchg/in-vm-exit; then
       echo "Virtual machine didn't produce an exit code."
       exit 1
     fi
-    
+
     eval "$postVM"
 
     exit $(cat xchg/in-vm-exit)
@@ -342,7 +345,7 @@ rec {
      If the build fails and Nix is run with the `-K' option, a script
      `run-vm' will be left behind in the temporary build directory
      that allows you to boot into the VM and debug it interactively. */
-     
+
   runInLinuxVM = drv: lib.overrideDerivation drv (attrs: {
     requiredSystemFeatures = [ "kvm" ];
     builder = "${bash}/bin/sh";
@@ -352,7 +355,7 @@ rec {
     QEMU_OPTS = "-m ${toString (if attrs ? memSize then attrs.memSize else 256)}";
   });
 
-  
+
   extractFs = {file, fs ? null} :
     with pkgs; runInLinuxVM (
     stdenv.mkDerivation {
@@ -378,7 +381,7 @@ rec {
       '';
     });
 
-    
+
   extractMTDfs = {file, fs ? null} :
     with pkgs; runInLinuxVM (
     stdenv.mkDerivation {
@@ -405,7 +408,7 @@ rec {
       '';
     });
 
-    
+
   qemuCommandGeneric = ''
     PATH="${samba}/sbin:$PATH" \
     ${kvm}/bin/qemu-kvm \
@@ -414,7 +417,7 @@ rec {
       $QEMU_OPTS
   '';
 
-  
+
   /* Run a command in an x86 virtual machine image containing an
      arbitrary OS.  The VM should be configured to do the following:
 
@@ -459,7 +462,7 @@ rec {
      the Nix store, but using the tools provided by /bin, /usr/bin
      etc. from the specified filesystem image, which typically is a
      filesystem containing a non-NixOS Linux distribution. */
-     
+
   runInLinuxImage = attrs: runInLinuxVM (attrs // {
     mountDisk = true;
 
@@ -490,12 +493,12 @@ rec {
 
   /* Create a filesystem image of the specified size and fill it with
      a set of RPM packages. */
-    
+
   fillDiskWithRPMs =
     { size ? 4096, rpms, name, fullName, preInstall ? "", postInstall ? ""
     , runScripts ? true, createRootFS ? defaultCreateRootFS
     }:
-    
+
     runInLinuxVM (stdenv.mkDerivation {
       inherit name preInstall postInstall rpms;
       memSize = 512;
@@ -505,7 +508,7 @@ rec {
         ${createRootFS}
 
         chroot=$(type -tP chroot)
-        
+
         echo "unpacking RPMs..."
         for i in $rpms; do
             echo "$i..."
@@ -524,19 +527,19 @@ rec {
         mkdir -p /mnt/nix/store
         ${utillinux}/bin/mount -o bind /nix/store /mnt/nix/store
         ${utillinux}/bin/mount -o bind /tmp /mnt/tmp
-        
+
         echo "installing RPMs..."
         PATH=/usr/bin:/bin:/usr/sbin:/sbin $chroot /mnt \
           rpm -iv ${if runScripts then "" else "--noscripts"} $rpms
 
         echo "running post-install script..."
         eval "$postInstall"
-        
+
         rm /mnt/.debug
 
-        ${utillinux}/bin/umount /mnt/nix/store 
-        ${utillinux}/bin/umount /mnt/tmp 
-        ${utillinux}/bin/umount /mnt 
+        ${utillinux}/bin/umount /mnt/nix/store
+        ${utillinux}/bin/umount /mnt/tmp
+        ${utillinux}/bin/umount /mnt
       '';
 
       passthru = { inherit fullName; };
@@ -545,7 +548,7 @@ rec {
 
   /* Generate a script that can be used to run an interactive session
      in the given image. */
-     
+
   makeImageTestScript = image: writeScript "image-test" ''
     #! ${bash}/bin/sh
     if test -z "$1"; then
@@ -570,7 +573,7 @@ rec {
   /* Build RPM packages from the tarball `src' in the Linux
      distribution installed in the filesystem `diskImage'.  The
      tarball must contain an RPM specfile. */
-  
+
   buildRPM = attrs: runInLinuxImage (stdenv.mkDerivation ({
     phases = "prepareImagePhase sysInfoPhase buildPhase installPhase";
 
@@ -583,7 +586,7 @@ rec {
         done
       fi
     '';
-  
+
     sysInfoPhase = ''
       echo "System/kernel: $(uname -a)"
       if test -e /etc/fedora-release; then echo "Fedora release: $(cat /etc/fedora-release)"; fi
@@ -592,7 +595,7 @@ rec {
       rpm -qa --qf "%{Name}-%{Version}-%{Release} (%{Arch}; %{Distribution}; %{Vendor})\n"
       stopNest
     '';
-    
+
     buildPhase = ''
       eval "$preBuild"
 
@@ -609,7 +612,7 @@ rec {
       mkdir $rpmout $rpmout/SPECS $rpmout/BUILD $rpmout/RPMS $rpmout/SRPMS
 
       echo "%_topdir $rpmout" >> $HOME/.rpmmacros
-      
+
       rpmbuild -vv -ta "$srcName"
 
       eval "$postBuild"
@@ -639,7 +642,7 @@ rec {
 
   fillDiskWithDebs =
     { size ? 4096, debs, name, fullName, postInstall ? null, createRootFS ? defaultCreateRootFS }:
-    
+
     runInLinuxVM (stdenv.mkDerivation {
       inherit name postInstall;
 
@@ -655,7 +658,7 @@ rec {
         # Unpack the .debs.  We do this to prevent pre-install scripts
         # (which have lots of circular dependencies) from barfing.
         echo "unpacking Debs..."
-        
+
         for deb in $debs; do
           if test "$deb" != "|"; then
             echo "$deb..."
@@ -668,7 +671,7 @@ rec {
         ${utillinux}/bin/mount -o bind /nix/store /mnt/inst/nix/store
         ${utillinux}/bin/mount -o bind /proc /mnt/proc
         ${utillinux}/bin/mount -o bind /dev /mnt/dev
-        
+
         # Misc. files/directories assumed by various packages.
         echo "initialising Dpkg DB..."
         touch /mnt/etc/shells
@@ -682,7 +685,7 @@ rec {
         echo "installing Debs..."
 
         export DEBIAN_FRONTEND=noninteractive
-        
+
         oldIFS="$IFS"
         IFS="|"
         for component in $debs; do
@@ -697,13 +700,13 @@ rec {
           PATH=/usr/bin:/bin:/usr/sbin:/sbin $chroot /mnt \
             /usr/bin/dpkg --install --force-all $debs < /dev/null || true
         done
-        
+
         echo "running post-install script..."
         eval "$postInstall"
         ln -sf dash /mnt/bin/sh
 
         rm /mnt/.debug
-        
+
         ${utillinux}/bin/umount /mnt/inst/nix/store
         ${utillinux}/bin/umount /mnt/proc
         ${utillinux}/bin/umount /mnt/dev
@@ -717,10 +720,10 @@ rec {
   /* Generate a Nix expression containing fetchurl calls for the
      closure of a set of top-level RPM packages from the
      `primary.xml.gz' file of a Fedora or openSUSE distribution. */
-     
+
   rpmClosureGenerator =
     {name, packagesLists, urlPrefixes, packages, archs ? []}:
-    assert (builtins.length packagesLists) == (builtins.length urlPrefixes) ;
+    assert (builtins.length packagesLists) == (builtins.length urlPrefixes);
     runCommand "${name}.nix" {buildInputs = [perl perlPackages.XMLSimple]; inherit archs;} ''
       ${lib.concatImapStrings (i: pl: ''
         gunzip < ${pl} > ./packages_${toString i}.xml
@@ -734,7 +737,7 @@ rec {
   /* Helper function that combines rpmClosureGenerator and
      fillDiskWithRPMs to generate a disk image from a set of package
      names. */
-     
+
   makeImageFromRPMDist =
     { name, fullName, size ? 4096
     , urlPrefix ? "", urlPrefixes ? [urlPrefix]
@@ -756,10 +759,13 @@ rec {
      (i.e. generate a closure from a Packages.bz2 file). */
 
   debClosureGenerator =
-    {name, packagesList, urlPrefix, packages}:
-    
+    {name, packagesLists, urlPrefix, packages}:
+
     runCommand "${name}.nix" {} ''
-      bunzip2 < ${packagesList} > ./Packages
+      for i in ${toString packagesLists}; do
+        echo "adding $i..."
+        bunzip2 < $i >> ./Packages
+      done
 
       # Work around this bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=452279
       sed -i ./Packages -e s/x86_64-linux-gnu/x86-64-linux-gnu/g
@@ -767,19 +773,20 @@ rec {
       ${perl}/bin/perl -I${dpkg} -w ${deb/deb-closure.pl} \
         ./Packages ${urlPrefix} ${toString packages} > $out
     '';
-  
+
 
   /* Helper function that combines debClosureGenerator and
      fillDiskWithDebs to generate a disk image from a set of package
      names. */
-     
+
   makeImageFromDebDist =
-    { name, fullName, size ? 4096, urlPrefix, packagesList
+    { name, fullName, size ? 4096, urlPrefix
+    , packagesList ? "", packagesLists ? [packagesList]
     , packages, extraPackages ? [], postInstall ? "" }:
 
     let
       expr = debClosureGenerator {
-        inherit name packagesList urlPrefix;
+        inherit name packagesLists urlPrefix;
         packages = packages ++ extraPackages;
       };
     in
@@ -790,7 +797,7 @@ rec {
 
 
   /* The set of supported RPM-based distributions. */
-      
+
   rpmDistros = {
 
     fedora2i386 = {
@@ -817,7 +824,7 @@ rec {
       runScripts = false;
       packages = commonFedoraPackages;
     };
-    
+
     fedora5i386 = {
       name = "fedora-core-5-i386";
       fullName = "Fedora Core 5 (i386)";
@@ -828,7 +835,7 @@ rec {
       urlPrefix = mirror://fedora/linux/core/5/i386/os;
       packages = commonFedoraPackages ++ [ "util-linux" ];
     };
-    
+
     fedora7i386 = {
       name = "fedora-7-i386";
       fullName = "Fedora 7 (i386)";
@@ -839,7 +846,7 @@ rec {
       urlPrefix = mirror://fedora/linux/releases/7/Everything/i386/os;
       packages = commonFedoraPackages;
     };
-    
+
     fedora8i386 = {
       name = "fedora-8-i386";
       fullName = "Fedora 8 (i386)";
@@ -1057,9 +1064,9 @@ rec {
 
 
   /* The set of supported Dpkg-based distributions. */
-      
+
   debDistros = {
-  
+
     # Interestingly, the SHA-256 hashes provided by Ubuntu in
     # http://nl.archive.ubuntu.com/ubuntu/dists/{gutsy,hardy}/Release are
     # wrong, but the SHA-1 and MD5 hashes are correct.  Intrepid is fine.
@@ -1074,7 +1081,7 @@ rec {
       urlPrefix = mirror://ubuntu;
       packages = commonDebianPackages;
     };
-        
+
     ubuntu804i386 = {
       name = "ubuntu-8.04-hardy-i386";
       fullName = "Ubuntu 8.04 Hardy (i386)";
@@ -1085,7 +1092,7 @@ rec {
       urlPrefix = mirror://ubuntu;
       packages = commonDebianPackages;
     };
-         
+
     ubuntu804x86_64 = {
       name = "ubuntu-8.04-hardy-amd64";
       fullName = "Ubuntu 8.04 Hardy (amd64)";
@@ -1096,7 +1103,7 @@ rec {
       urlPrefix = mirror://ubuntu;
       packages = commonDebianPackages;
     };
-         
+
     ubuntu810i386 = {
       name = "ubuntu-8.10-intrepid-i386";
       fullName = "Ubuntu 8.10 Intrepid (i386)";
@@ -1107,7 +1114,7 @@ rec {
       urlPrefix = mirror://ubuntu;
       packages = commonDebianPackages;
     };
- 
+
     ubuntu810x86_64 = {
       name = "ubuntu-8.10-intrepid-amd64";
       fullName = "Ubuntu 8.10 Intrepid (amd64)";
@@ -1129,7 +1136,7 @@ rec {
       urlPrefix = mirror://ubuntu;
       packages = commonDebianPackages;
     };
- 
+
     ubuntu904x86_64 = {
       name = "ubuntu-9.04-jaunty-amd64";
       fullName = "Ubuntu 9.04 Jaunty (amd64)";
@@ -1151,11 +1158,11 @@ rec {
       urlPrefix = mirror://ubuntu;
       packages = commonDebPackages ++ [ "diff" "mktemp" ];
     };
- 
+
     ubuntu910x86_64 = {
       name = "ubuntu-9.10-karmic-amd64";
       fullName = "Ubuntu 9.10 Karmic (amd64)";
-      packagesList = fetchurl {
+     packagesList = fetchurl {
         url = mirror://ubuntu/dists/karmic/main/binary-amd64/Packages.bz2;
         sha256 = "3a604fcb0c135eeb8b95da3e90a8fd4cfeff519b858cd3c9e62ea808cb9fec40";
       };
@@ -1166,43 +1173,67 @@ rec {
     ubuntu1004i386 = {
       name = "ubuntu-10.04-lucid-i386";
       fullName = "Ubuntu 10.04 Lucid (i386)";
-      packagesList = fetchurl {
-        url = mirror://ubuntu/dists/lucid/main/binary-i386/Packages.bz2;
-        sha256 = "0e46596202a68caa754dfe0883f46047525309880c492cdd5e2d0970fcf626aa";
-      };
+      packagesList =
+        [ (fetchurl {
+            url = mirror://ubuntu/dists/lucid/main/binary-i386/Packages.bz2;
+            sha256 = "0e46596202a68caa754dfe0883f46047525309880c492cdd5e2d0970fcf626aa";
+          })
+          (fetchurl {
+            url = mirror://ubuntu/dists/lucid/universe/binary-i386/Packages.bz2;
+            sha256 = "13nvsb7na9igps2fdbbfpq4y8ihccmcs6x35pfyfp6rkhjgpzigy";
+          })
+        ];
       urlPrefix = mirror://ubuntu;
       packages = commonDebPackages ++ [ "diffutils" "mktemp" ];
     };
- 
+
     ubuntu1004x86_64 = {
       name = "ubuntu-10.04-lucid-amd64";
       fullName = "Ubuntu 10.04 Lucid (amd64)";
-      packagesList = fetchurl {
-        url = mirror://ubuntu/dists/lucid/main/binary-amd64/Packages.bz2;
-        sha256 = "74a8f3192b0eda397d65316e0fa6cd34d5358dced41639e07d9f1047971bfef0";
-      };
+      packagesList =
+        [ (fetchurl {
+            url = mirror://ubuntu/dists/lucid/main/binary-amd64/Packages.bz2;
+            sha256 = "74a8f3192b0eda397d65316e0fa6cd34d5358dced41639e07d9f1047971bfef0";
+          })
+          (fetchurl {
+            url = mirror://ubuntu/dists/lucid/universe/binary-amd64/Packages.bz2;
+            sha256 = "112lbnf8rcsbbh89aci4m6gwac0jy16838aij0av8n076zwkvlj9";
+          })
+        ];
       urlPrefix = mirror://ubuntu;
       packages = commonDebPackages ++ [ "diffutils" "mktemp" ];
     };
 
     ubuntu1010i386 = {
-      name = "ubuntu-10.04-maverick-i386";
-      fullName = "Ubuntu 10.04 Maverick (i386)";
-      packagesList = fetchurl {
-        url = mirror://ubuntu/dists/maverick/main/binary-i386/Packages.bz2;
-        sha256 = "1qjs4042y03bxbxwjs3pgrs99ba6vqvjaaz6zhaxxaqj1r12dwa0";
-      };
+      name = "ubuntu-10.10-maverick-i386";
+      fullName = "Ubuntu 10.10 Maverick (i386)";
+      packagesList =
+        [ (fetchurl {
+            url = mirror://ubuntu/dists/maverick/main/binary-i386/Packages.bz2;
+            sha256 = "1qjs4042y03bxbxwjs3pgrs99ba6vqvjaaz6zhaxxaqj1r12dwa0";
+          })
+          (fetchurl {
+            url = mirror://ubuntu/dists/maverick/universe/binary-i386/Packages.bz2;
+            sha256 = "1g5pnhx730wj32221ic8p2q6zcka23knpyg190mvq9x7kflcbfzy";
+          })
+        ];
       urlPrefix = mirror://ubuntu;
       packages = commonDebPackages ++ [ "diffutils" ];
     };
- 
+
     ubuntu1010x86_64 = {
-      name = "ubuntu-10.04-maverick-amd64";
-      fullName = "Ubuntu 10.04 Maverick (amd64)";
-      packagesList = fetchurl {
-        url = mirror://ubuntu/dists/maverick/main/binary-amd64/Packages.bz2;
-        sha256 = "1p0i4gp1bxd3zvckgnh1hx4vfc23rfgzd19dk5rmi61lzbzzqbgc";
-      };
+      name = "ubuntu-10.10-maverick-amd64";
+      fullName = "Ubuntu 10.10 Maverick (amd64)";
+      packagesList =
+        [ (fetchurl {
+            url = mirror://ubuntu/dists/maverick/main/binary-amd64/Packages.bz2;
+            sha256 = "1p0i4gp1bxd3zvckgnh1hx4vfc23rfgzd19dk5rmi61lzbzzqbgc";
+          })
+          (fetchurl {
+            url = mirror://ubuntu/dists/maverick/universe/binary-amd64/Packages.bz2;
+            sha256 = "0m26viwah29gh47p8m3jpnx6l84dhpwnms29m9bvqn1vwcrgjh0s";
+          })
+        ];
       urlPrefix = mirror://ubuntu;
       packages = commonDebPackages ++ [ "diffutils" ];
     };
@@ -1210,43 +1241,67 @@ rec {
     ubuntu1110i386 = {
       name = "ubuntu-11.10-oneiric-i386";
       fullName = "Ubuntu 11.10 Oneiric (i386)";
-      packagesList = fetchurl {
-        url = mirror://ubuntu/dists/oneiric/main/binary-i386/Packages.bz2;
-        sha256 = "11r1s76ppi7rwz08i20d7n4ndaj9lb9wsl9k8ww4s1c6agzpwv8a";
-      };
+      packagesList =
+        [ (fetchurl {
+            url = mirror://ubuntu/dists/oneiric/main/binary-i386/Packages.bz2;
+            sha256 = "11r1s76ppi7rwz08i20d7n4ndaj9lb9wsl9k8ww4s1c6agzpwv8a";
+          })
+          (fetchurl {
+            url = mirror://ubuntu/dists/oneiric/universe/binary-i386/Packages.bz2;
+            sha256 = "1dr59j8pjdhk07fpc0x73afcd9630kkdsbabx3bj92q71104yigz";
+          })
+        ];
       urlPrefix = mirror://ubuntu;
       packages = commonDebPackages ++ [ "diffutils" ];
     };
- 
+
     ubuntu1110x86_64 = {
       name = "ubuntu-11.10-oneiric-amd64";
       fullName = "Ubuntu 11.10 Oneiric (amd64)";
-      packagesList = fetchurl {
-        url = mirror://ubuntu/dists/oneiric/main/binary-amd64/Packages.bz2;
-        sha256 = "07k784gxwaqmyggmzczy9hjkgfp6p6dcs8rhkxw5hfzn0jaf8l2s";
-      };
+      packagesLists =
+        [ (fetchurl {
+            url = mirror://ubuntu/dists/oneiric/main/binary-amd64/Packages.bz2;
+            sha256 = "07k784gxwaqmyggmzczy9hjkgfp6p6dcs8rhkxw5hfzn0jaf8l2s";
+          })
+          (fetchurl {
+            url = mirror://ubuntu/dists/oneiric/universe/binary-amd64/Packages.bz2;
+            sha256 = "1v3ldxn5jnnfgs863ryd6wl3fsb3glainr1ma2zn2l5vpzhpi2h1";
+          })
+        ];
       urlPrefix = mirror://ubuntu;
       packages = commonDebPackages ++ [ "diffutils" ];
     };
 
     ubuntu1204i386 = {
-      name = "ubuntu-12.04-oneiric-i386";
+      name = "ubuntu-12.04-precise-i386";
       fullName = "Ubuntu 12.04 Precise (i386)";
-      packagesList = fetchurl {
-        url = mirror://ubuntu/dists/precise/main/binary-i386/Packages.bz2;
-        sha256 = "18ns9h4qhvjfcip9z55grzi371racxavgqkp6b5kfkdq2wwwax2d";
-      };
+      packagesLists =
+        [ (fetchurl {
+            url = mirror://ubuntu/dists/precise/main/binary-i386/Packages.bz2;
+            sha256 = "18ns9h4qhvjfcip9z55grzi371racxavgqkp6b5kfkdq2wwwax2d";
+          })
+          (fetchurl {
+            url = mirror://ubuntu/dists/precise/universe/binary-i386/Packages.bz2;
+            sha256 = "085lkzbnzkc74kfdmwdc32sfqyfz8dr0rbiifk8kx9jih3xjw2jk";
+          })
+        ];
       urlPrefix = mirror://ubuntu;
       packages = commonDebPackages ++ [ "diffutils" ];
     };
- 
+
     ubuntu1204x86_64 = {
-      name = "ubuntu-12.04-oneiric-amd64";
+      name = "ubuntu-12.04-precise-amd64";
       fullName = "Ubuntu 12.04 Precise (amd64)";
-      packagesList = fetchurl {
-        url = mirror://ubuntu/dists/precise/main/binary-amd64/Packages.bz2;
-        sha256 = "1aabpn0hdih6cbabyn87yvhccqj44q9k03mqmjsb920iqlckl3fc";
-      };
+      packagesList =
+        [ (fetchurl {
+            url = mirror://ubuntu/dists/precise/main/binary-amd64/Packages.bz2;
+            sha256 = "1aabpn0hdih6cbabyn87yvhccqj44q9k03mqmjsb920iqlckl3fc";
+          })
+          (fetchurl {
+            url = mirror://ubuntu/dists/precise/universe/binary-amd64/Packages.bz2;
+            sha256 = "0x4hz5aplximgb7gnpvrhkw8m7a40s80rkm5b8hil0afblwlg4vr";
+          })
+        ];
       urlPrefix = mirror://ubuntu;
       packages = commonDebPackages ++ [ "diffutils" ];
     };
@@ -1261,7 +1316,7 @@ rec {
       urlPrefix = mirror://debian;
       packages = commonDebianPackages;
     };
-        
+
     debian40x86_64 = {
       name = "debian-4.0r9-etch-amd64";
       fullName = "Debian 4.0r9 Etch (amd64)";
@@ -1305,7 +1360,7 @@ rec {
       urlPrefix = mirror://debian;
       packages = commonDebianPackages;
     };
-        
+
     debian60x86_64 = {
       name = "debian-6.0.4-squeeze-amd64";
       fullName = "Debian 6.0.4 Squeeze (amd64)";
@@ -1343,7 +1398,7 @@ rec {
     "unzip"
   ];
 
-  
+
   /* Common packages for openSUSE images. */
   commonOpenSUSEPackages = [
     "aaa_base"
@@ -1387,7 +1442,7 @@ rec {
     "patch"
     "locales"
     # Needed by checkinstall:
-    "util-linux" 
+    "util-linux"
     "file"
     "dpkg-dev"
     "pkg-config"
@@ -1397,7 +1452,7 @@ rec {
   ];
 
   commonDebianPackages = commonDebPackages ++ [ "sysvinit" "diff" "mktemp" ];
-  
+
 
   /* A set of functions that build the Linux distributions specified
      in `rpmDistros' and `debDistros'.  For instance,
@@ -1411,29 +1466,29 @@ rec {
      `diskImageFuns.ubuntu1004x86_64 { extraPackages = ["firefox"];
      size = 8192; }' builds an 8 GiB image containing Firefox in
      addition to the default packages. */
-  diskImageFuns = 
+  diskImageFuns =
     (lib.mapAttrs (name: as: as2: makeImageFromRPMDist (as // as2)) rpmDistros) //
     (lib.mapAttrs (name: as: as2: makeImageFromDebDist (as // as2)) debDistros);
 
-    
+
   /* Shorthand for `diskImageFuns.<attr> { extraPackages = ... }'. */
   diskImageExtraFuns =
     lib.mapAttrs (name: f: extraPackages: f { inherit extraPackages; }) diskImageFuns;
 
-    
+
   /* Default disk images generated from the `rpmDistros' and
      `debDistros' sets (along with Red Hat 9 and SuSE 9.0 images). */
 
   diskImages =
     lib.mapAttrs (name: f: f {}) diskImageFuns //
-    
+
     { redhat9i386 = fillDiskWithRPMs {
         name = "redhat-9-i386";
         fullName = "Red Hat Linux 9 (i386)";
         size = 1024;
         rpms = import ./rpm/redhat-9-i386.nix {inherit fetchurl;};
       };
-    
+
       suse90i386 = fillDiskWithRPMs {
         name = "suse-9.0-i386";
         fullName = "SUSE Linux 9.0 (i386)";
@@ -1453,7 +1508,7 @@ rec {
           echo 'video:x:33:' >> /mnt/etc/group
         '';
       };
-      
+
     };
-    
+
 }