Merge from trunk up through r28790

svn path=/nixpkgs/branches/stdenv-updates/; revision=28792
This commit is contained in:
Shea Levy
2011-08-24 19:16:43 +00:00
2168 changed files with 42927 additions and 19027 deletions
+1 -1
View File
@@ -89,7 +89,7 @@ rec {
};
*/
callPackageWith = autoArgs: fn: args:
let f = import fn; in
let f = if builtins.isFunction fn then fn else import fn; in
makeOverridable f ((builtins.intersectAttrs (builtins.functionArgs f) autoArgs) // args);
}
+6 -2
View File
@@ -1,7 +1,7 @@
# General list operations.
rec {
inherit (builtins) head tail isList;
inherit (builtins) head tail length isList;
# Create a list consisting of a single element. `singleton x' is
@@ -27,6 +27,10 @@ rec {
then nul
else foldl op (op nul (head list)) (tail list);
# map with index: `imap (i: v: "${v}-${toString i}") ["a" "b"] ==
# ["a-1" "b-2"]'
imap = f: list:
zipListsWith f (range 1 (length list)) list;
# Concatenate a list of lists.
concatLists = fold (x: y: x ++ y) [];
@@ -136,7 +140,7 @@ rec {
zipListsWith = f: fst: snd:
if fst != [] && snd != [] then
[ (f (head fst) (head snd)) ]
++ zipLists (tail fst) (tail snd)
++ zipListsWith f (tail fst) (tail snd)
else [];
zipLists = zipListsWith (fst: snd: { inherit fst snd; });
+5 -1
View File
@@ -5,10 +5,12 @@
alphabetically sorted. */
all = "Nix Committers <nix-commits@cs.uu.nl>";
andres = "Andres Loeh <andres@cs.uu.nl>";
andres = "Andres Loeh <ksnixos@andres-loeh.de>";
astsmtl = "Alexander Tsamutali <astsmtl@yandex.ru>";
bjg = "Brian Gough <bjg@gnu.org>";
chaoflow = "Florian Friesdorf <flo@chaoflow.net>";
eelco = "Eelco Dolstra <e.dolstra@tudelft.nl>";
goibhniu = "Cillian de Róiste <cillian.deroiste@gmail.com>";
guibert = "David Guibert <david.guibert@gmail.com>";
kkallio = "Karn Kallio <tierpluspluslists@gmail.com>";
ludo = "Ludovic Courtès <ludo@gnu.org>";
@@ -16,9 +18,11 @@
neznalek = "Vladimír Čunát <vcunat@gmail.com>";
phreedom = "Evgeny Egorochkin <phreedom.stdin@gmail.com>";
pierron = "Nicolas B. Pierron <nixos@nbp.name>";
qknight = "Joachim Schiele <js@lastlog.de>";
raskin = "Michael Raskin <7c6f434c@mail.ru>";
roconnor = "Russell O'Connor <roconnor@theorem.ca>";
sander = "Sander van der Burg <s.vanderburg@tudelft.nl>";
shlevy = "Shea Levy <shea@shealevy.com>";
simons = "Peter Simons <simons@cryp.to>";
thammers = "Tobias Hammerschmidt <jawr@gmx.de>";
urkud = "Yury G. Kudryashov <urkud+nix@ya.ru>";
+1 -1
View File
@@ -216,7 +216,7 @@ rec {
innerClosePropagation = ready: list: if list == [] then ready else
if ! isAttrs (head list) then
builtins.trace ("not an attrSet: ${lib.showVal (head list)}")
/* builtins.trace ("not an attrSet: ${lib.showVal (head list)}") */
innerClosePropagation ready (tail list)
else
innerClosePropagation
+14 -4
View File
@@ -80,19 +80,29 @@ rec {
moduleClosure = initModules: args:
let
moduleImport = m:
moduleImport = origin: index: m:
let m' = applyIfFunction (importIfPath m) args;
in (unifyModuleSyntax m') // {
# used by generic closure to avoid duplicated imports.
key = if isPath m then m else if m' ? key then m'.key else "<unknown location>";
key =
if isPath m then m
else if m' ? key then m'.key
else newModuleName origin index;
};
getImports = m: attrByPath ["imports"] [] m;
newModuleName = origin: index:
"${origin.key}:<import-${toString index}>";
topLevel = {
key = "<top-level>";
};
in
(lazyGenericClosure {
startSet = map moduleImport initModules;
operator = m: map moduleImport (getImports m);
startSet = imap (moduleImport topLevel) initModules;
operator = m: imap (moduleImport m) (getImports m);
});
selectDeclsAndDefs = modules:
+5
View File
@@ -223,6 +223,11 @@ rec {
content = mkNotdef;
};
mkAssert = assertion: message: content:
mkIf
(if assertion then true else throw "\nFailed assertion: ${message}")
content;
# Remove all "If" statement defined on a value.
rmIf = foldProperty (
foldFilter isIf
+5
View File
@@ -16,6 +16,7 @@ rec {
# Map a function over a list and concatenate the resulting strings.
concatMapStrings = f: list: concatStrings (map f list);
concatImapStrings = f: list: concatStrings (lib.imap f list);
# Place an element between each element of a list, e.g.,
@@ -45,6 +46,10 @@ rec {
makeLibraryPath = makeSearchPath "lib";
# Idem for Perl search paths.
makePerlPath = makeSearchPath "lib/perl5/site_perl";
# Dependening on the boolean `cond', return either the given string
# or the empty string.
optionalString = cond: string: if cond then string else "";
+43 -5
View File
@@ -6,6 +6,7 @@ let lib = import ./default.nix; in
with import ./lists.nix;
with import ./attrsets.nix;
with import ./options.nix;
with import ./trivial.nix;
rec {
@@ -16,7 +17,7 @@ rec {
_type = typeName;
};
# name (name of the type)
# check (boolean function)
# merge (default merge function)
@@ -43,7 +44,7 @@ rec {
inherit name check merge iter fold docPath hasOptions delayOnGlobalEval;
};
types = rec {
inferred = mkOptionType {
@@ -75,7 +76,7 @@ rec {
attrs = mkOptionType {
name = "attribute set";
check = lib.traceValIfNot builtins.isAttrs;
check = lib.traceValIfNot isAttrs;
merge = fold lib.mergeAttrs {};
};
@@ -101,8 +102,8 @@ rec {
};
attrsOf = elemType: mkOptionType {
name = "attribute set of ${elemType}s";
check = x: lib.traceValIfNot builtins.isAttrs x
name = "attribute set of ${elemType.name}s";
check = x: lib.traceValIfNot isAttrs x
&& fold (e: v: v && elemType.check e) true (lib.attrValues x);
merge = lib.zip (name: elemType.merge);
iter = f: path: set: lib.mapAttrs (name: elemType.iter f (path + "." + name)) set;
@@ -111,6 +112,43 @@ rec {
inherit (elemType) hasOptions delayOnGlobalEval;
};
# List or attribute set of ...
loaOf = elemType:
let
convertIfList = defIdx: def:
if isList def then
listToAttrs (
flip imap def (elemIdx: elem:
nameValuePair "unnamed-${toString defIdx}.${toString elemIdx}" elem))
else
def;
listOnly = listOf elemType;
attrOnly = attrsOf elemType;
in mkOptionType {
name = "list or attribute set of ${elemType.name}s";
check = x:
if isList x then listOnly.check x
else if isAttrs x then attrOnly.check x
else lib.traceValIfNot (x: false) x;
## The merge function returns an attribute set
merge = defs:
attrOnly.merge (imap convertIfList defs);
iter = f: path: def:
if isList def then listOnly.iter f path def
else if isAttrs def then attrOnly.iter f path def
else throw "Unexpected value";
fold = op: nul: def:
if isList def then listOnly.fold op nul def
else if isAttrs def then attrOnly.fold op nul def
else throw "Unexpected value";
docPath = path: elemType.docPath (path + ".<name?>");
inherit (elemType) hasOptions delayOnGlobalEval;
}
;
uniq = elemType: mkOptionType {
inherit (elemType) name check iter fold docPath hasOptions;
merge = list: