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

2015-10-17 Thread Bas van Dijk
On 17 October 2015 at 20:21, wrote: > ./foo + "/${name}/bar" would also work I like that even better, thanks. ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev

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

2015-10-17 Thread Bas van Dijk
Thanks guys. I got it to work with the following (note that name is actually a string): readFile (./foo + ("/" + name) + /bar) I couldn't postfix ./foo with a slash because that gave a parse error on +. The parentheses around ("/" + name) were also essential. On 16 October 2015 at 16:54,

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

2015-10-17 Thread shea
./foo + "/${name}/bar" would also work On 2015-10-17 13:37, Bas van Dijk wrote: > Thanks guys. > > I got it to work with the following (note that name is actually a > string): > > readFile (./foo + ("/" + name) + /bar) > > I couldn't postfix ./foo with a slash because that gave a parse error >

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

2015-10-16 Thread Bas van Dijk
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

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

2015-10-16 Thread Thomas Hunger
Do you need toPath? lib.readFile "./foo/${name}/bar" seems to work for me. On 16 October 2015 at 11:10, Bas van Dijk wrote: > 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

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

2015-10-16 Thread Bryan Gardiner
Not on Nix right now but I believe this also works: readFile (./foo + name + /bar) - Bryan On Fri, 16 Oct 2015 11:36:22 +0100 Thomas Hunger wrote: > Do you need toPath? > > lib.readFile "./foo/${name}/bar" > > seems to work for me. > > On 16 October 2015 at 11:10,