@@ -437,6 +437,13 @@ rec {
437437 */
438438 fixedWidthNumber = width: n: fixedWidthString width "0" (toString n);
439439
440+ /* Check whether a value can be coerced to a string */
441+ isCoercibleToString = x:
442+ builtins.elem (builtins.typeOf x) [ "path" "string" "null" "int" "float" "bool" ] ||
443+ (builtins.isList x && lib.all isCoercibleToString x) ||
444+ x ? outPath ||
445+ x ? __toString;
446+
440447 /* Check whether a value is a store path.
441448
442449 Example:
@@ -450,7 +457,7 @@ rec {
450457 => false
451458 */
452459 isStorePath = x:
453− builtins.isString x
460+ isCoercibleToString x
454461 && builtins.substring 0 1 (toString x) == "/"
455462 && dirOf (builtins.toPath x) == builtins.storeDir;
456463