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
_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to