[Nix-dev] readFile applied to a path with a variable

Bas van Dijk v.dijk.bas at gmail.com
Fri Oct 16 12:10:38 CEST 2015


Hello,

In a Nix expression I would like to read a file where the file path is
based on a variable. So I would like to do something like this:

  with builtins;
  readFile (toPath ("./foo/" + name + "/bar"))

Unfortunately this doesn't work since toPath expects a string which
represents an absolute path.

Is there any other way to do this?

Cheers,

Bas


More information about the nix-dev mailing list