Author: eelco
Date: Fri May 25 17:19:07 2012
New Revision: 34247
URL: https://nixos.org/websvn/nix/?rev=34247&sc=1

Log:
* Add a type "path".

Modified:
   nixpkgs/trunk/pkgs/lib/types.nix

Modified: nixpkgs/trunk/pkgs/lib/types.nix
==============================================================================
--- nixpkgs/trunk/pkgs/lib/types.nix    Fri May 25 17:01:58 2012        (r34246)
+++ nixpkgs/trunk/pkgs/lib/types.nix    Fri May 25 17:19:07 2012        (r34247)
@@ -64,7 +64,7 @@
 
     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 @@
       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";
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to