[Nix-dev] eval or in-place expression execution
Sergey Mironov
grrwlf at gmail.com
Fri Jul 11 09:46:47 CEST 2014
Hi. I need to do non-trivial string calculations (encrypt the password
with openssl) which AFAIK can't be written in Nix at the moment.
That's why I think about Nix `eval` equivalent. I wonder if it goes
against Nix concepts or not? My implementation looks like the
following:
encryptPassword = salt: pass : let
p = runCommand "encryptPassword" {} ''
printf '"%s"\n' `${openssl}/bin/openssl passwd -1 -salt ${salt}
${pass}` > $out
'';
in
import p; # <=== (1)
It works but note the `import' expression. I tried builtins.readFile
instead of it in previous attempt but failed: Nix issued [error:
string `... (1)' cannot refer to other paths] error. What is the
reason of such a difference between readFile and import?
Regards,
Sergey
More information about the nix-dev
mailing list