query
On this page

toPath

builtins.toPath

Primop
Docs pulled from | This Revision | about 6 hours ago


Nix manual

Takes 1 arguments

s

DEPRECATED. Use /. + "/path" to convert a string into an absolute path. For relative paths, use ./. + "/path".

Noogle detected

Detected Type
toPath :: String -> Path

Implementation

This function is implemented in c++ and is part of the native nix runtime.

src/libexpr/primops.cc:1909

static void prim_toPath(EvalState & state, const PosIdx pos, Value ** args, Value & v)
{
    NixStringContext context;
    auto path =
        state.coerceToPath(pos, *args[0], context, "while evaluating the first argument passed to builtins.toPath");
    v.mkString(path.path.abs(), context, state.mem);
}