[Nix-dev] Using string as path to eg. builtins.readFile

4levels 4levels at gmail.com
Tue Jun 21 09:19:00 CEST 2016


Hi Bas,

Out of curiosity I've been experimenting with different approaches but only
yours works and I have no clue why..  Is there anything I can learn / read
/ study to understand why?  Without having to study C++ (or python for that
matter as I can't even tell them apart ;-)
Is this basic lambda programming or very specific to Nix?

Works
builtins.readFile (./keys + "/${name}")

Doesn't work
builtins.readFile (./keys/ + "${name}") - unexpected +
builtins.readFile (./keys/ + name) - unexpected +
builtins.readFile (./keys + "/" + name") - no build errors, but doesn't
parse the / in the middle -> ./keysmancloud.amazon.iam.key_id -> not found

Kind regards and thanks again, my key deployment sections have become very
compact and maintainable now..

Erik

On Tue, Jun 21, 2016 at 1:56 AM 4levels <4levels at gmail.com> wrote:

> Hi Bas,
>
> Thank you so much! Exactly what I was looking for.
> It's these basic things that I keep not getting my head around.. You have
> no idea how many fruitless Google and GitHub searches I tried on this one
> ;-)
>
> Finally resolved and another lesson learned, amazing!
>
> Kind regards,
>
> Erik
>
> On Tue, Jun 21, 2016, 01:39 Bas van Dijk <v.dijk.bas at gmail.com> wrote:
>
>> On 19 June 2016 at 15:58, 4levels <4levels at gmail.com> wrote:
>> > builtins.readFile "./keys/${name}"
>>
>> Hi Erik, try this:
>>
>>   builtins.readFile (./keys + "/${name}")
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160621/3168646e/attachment.html>


More information about the nix-dev mailing list