[Nix-dev] Using string as path to eg. builtins.readFile
4levels
4levels at gmail.com
Sun Jun 19 15:58:23 CEST 2016
Hi Nix-devs,
I'm currently looking for a way to do a readFile with a path coming from a
list of values.
In the list I defined the path as a string, relative to the current
directory. When I try to use this value in a function, I keep getting the
error that the path is not absolute
"string ‘./keys/mancloud.amazon.iam.access_key’ doesn't represent an
absolute path"
Is there another way to have the readFile function accept strings as local
paths? Or am I overlooking something obvious here?
This is the function I'm using:
serverKeys = keys:
lib.genAttrs keys (name:
{ text = lib.removeSuffix "\n" (builtins.readFile "./keys/${name}"); }
//
{
group = "keys";
permissions = "0640";
}
)
;
And I'm calling it as follows:
deployment.keys = serverKeys ([
"mancloud.amazon.iam.key_id"
"mancloud.amazon.iam.access_key"
"mancloud.amazon.iam.passphrase"
]);
Kind regards,
Erik
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160619/57ace946/attachment.html>
More information about the nix-dev
mailing list