summaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-05-25 17:19:07 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-05-25 17:19:07 +0000
commit040cf06388b1d5d94c0087c0243fd8fcf2502dce (patch)
tree7408ca887c0bf0b8656c71547c748a7351419238 /pkgs
parent89af9f3f4c95c3dcca5c4f33b830201ab20b75bf (diff)
* Add a type "path".
svn path=/nixpkgs/trunk/; revision=34247
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/lib/types.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkgs/lib/types.nix b/pkgs/lib/types.nix
index c1d7240f6931..2c85ee0077a4 100644
--- a/pkgs/lib/types.nix
+++ b/pkgs/lib/types.nix
@@ -64,7 +64,7 @@ rec {
string = mkOptionType {
name = "string";
- check = lib.traceValIfNot (x: builtins ? isString -> builtins.isString x);
+ check = lib.traceValIfNot builtins.isString;
merge = lib.concatStrings;
};
@@ -86,6 +86,12 @@ rec {
check = lib.traceValIfNot isDerivation;
};
+ path = mkOptionType {
+ name = "path";
+ # Hacky: there is no ‘isPath’ primop.
+ check = lib.traceValIfNot (x: builtins.substring 0 1 (toString x) == "/");
+ };
+
listOf = types.list;
list = elemType: mkOptionType {
name = "list of ${elemType.name}s";