Merge pull request #6272 from NixOS/types-path-better-error

types.nix: better error message for non-paths
This commit is contained in:
Benno Fünfstück
2015-08-15 13:16:00 +02:00
2 changed files with 3 additions and 2 deletions

View File

@@ -103,7 +103,8 @@ rec {
path = mkOptionType {
name = "path";
# Hacky: there is no isPath primop.
check = x: builtins.substring 0 1 (toString x) == "/";
# need to check isString first because otherwise toString throws an error.
check = x: builtins.isString x && builtins.substring 0 1 (toString x) == "/";
merge = mergeOneOption;
};