Merge remote-tracking branch 'origin/master' into stdenv-updates

This commit is contained in:
Eelco Dolstra
2013-02-15 13:36:34 +01:00
302 changed files with 14276 additions and 4226 deletions

View File

@@ -5,7 +5,7 @@ with {
inherit (import ./trivial.nix) or;
inherit (import ./default.nix) fold;
inherit (import ./strings.nix) concatStringsSep;
inherit (import ./lists.nix) concatMap concatLists all;
inherit (import ./lists.nix) concatMap concatLists all deepSeqList;
inherit (import ./misc.nix) maybeAttr;
};
@@ -314,4 +314,5 @@ rec {
overrideExisting = old: new:
old // listToAttrs (map (attr: nameValuePair attr (attrByPath [attr] (getAttr attr old) new)) (attrNames old));
deepSeqAttrs = x: y: deepSeqList (attrValues x) y;
}

View File

@@ -1,4 +1,7 @@
# General list operations.
with {
inherit (import ./trivial.nix) deepSeq;
};
rec {
inherit (builtins) head tail length isList add sub lessThan;
@@ -220,4 +223,5 @@ rec {
++ zipTwoLists (tail xs) (tail ys)
else [];
deepSeqList = xs: y: if any (x: deepSeq x false) xs then y else y;
}

View File

@@ -1,3 +1,8 @@
with {
inherit (import ./lists.nix) deepSeqList;
inherit (import ./attrsets.nix) deepSeqAttrs;
};
rec {
# Identity function.
@@ -22,4 +27,12 @@ rec {
# evaluation of its first argument.
seq = x: y: if x == null then y else y;
# Like `seq', but recurses into lists and attribute sets to force evaluation
# of all list elements/attributes.
deepSeq = x: y:
if builtins.isList x
then deepSeqList x y
else if builtins.isAttrs x
then deepSeqAttrs x y
else seq x y;
}

View File

@@ -68,6 +68,14 @@ rec {
merge = lib.concatStrings;
};
# Like string, but add newlines between every value. Useful for
# configuration file contents.
lines = mkOptionType {
name = "string";
check = lib.traceValIfNot builtins.isString;
merge = lib.concatStringsSep "\n";
};
envVar = mkOptionType {
name = "environment variable";
inherit (string) check;