diff options
author | Benno Fünfstück <benno.fuenfstueck@gmail.com> | 2015-08-15 13:16:00 +0200 |
---|---|---|
committer | Benno Fünfstück <benno.fuenfstueck@gmail.com> | 2015-08-15 13:16:00 +0200 |
commit | e6f1e1e5dbcf85b132dcd080d27e89b10b69f433 (patch) | |
tree | 8600f08d1031852ccf1b794ebf7daf604d59bbdc /lib/types.nix | |
parent | 77250457bc29cc8f21003ef2568daada539abd70 (diff) | |
parent | 691f683c8c3e5423bfe39e3c12f5a325130ec014 (diff) | |
download | nixlib-e6f1e1e5dbcf85b132dcd080d27e89b10b69f433.tar nixlib-e6f1e1e5dbcf85b132dcd080d27e89b10b69f433.tar.gz nixlib-e6f1e1e5dbcf85b132dcd080d27e89b10b69f433.tar.bz2 nixlib-e6f1e1e5dbcf85b132dcd080d27e89b10b69f433.tar.lz nixlib-e6f1e1e5dbcf85b132dcd080d27e89b10b69f433.tar.xz nixlib-e6f1e1e5dbcf85b132dcd080d27e89b10b69f433.tar.zst nixlib-e6f1e1e5dbcf85b132dcd080d27e89b10b69f433.zip |
Merge pull request #6272 from NixOS/types-path-better-error
types.nix: better error message for non-paths
Diffstat (limited to 'lib/types.nix')
-rw-r--r-- | lib/types.nix | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/types.nix b/lib/types.nix index a7f9bf1946e6..27b653ebb6c7 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -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; }; |