[Nix-dev] Dynamic substituteInPlace

stewart mackenzie setori88 at gmail.com
Mon Feb 15 18:15:55 CET 2016


Hello,

I've got an issue I don't fully know how to solve in the simplest way.

I have a file which contains something like this:

'text' -> input_port var_name_instance(a_dynamic_component_name)
output_port ... etc etc

a_dynamic_component_name could be a name of one of my components in a file
equivalent to all-packages.nix

How do I replace the name a_dynamic_component_name with
/nix/store/<hash>-a_dynamic_component_name/lib/libcomponent.so dynamically?

ie

'text' -> input_port var_name_instance(a_dynamic_component_name)
output_port ... etc etc

becomes

'text' -> input_port
var_name_instance(/nix/store/<hash>-a_dynamic_component_name/lib/libcomponent.so)
output_port ... etc etc

This file is now ready for execution by a vm.

I do not know the name ahead of time.

Would builtins.tryEval help at all? Seems the docs are sparse and whatever
is written on the subject lead me to believe it's a tryCatch.

/sjm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160216/2f7e1a51/attachment-0001.html 


More information about the nix-dev mailing list