I have a dune rule that needs to be conditionally enabled based on the value of an opam package variable. I’ve tried the following setup, but it results in a dependency cycle:
This seems fine. Just a detail: (system ...) invokes the command through the system shell; in your case you can just do (run opam var conf-ios:arch) instead to avoid the indirection.
I would assume that if there was a more direct way to read the package variable without using an intermediate file there would be no dependency cycle. I haven’t found such a way though.
Shouldn’t you have to use %{read:../conf-ios-arch.txt} instead of %{read:conf-ios-arch.txt}, since the stanza is evaluated in the subdirectory rather than the parent directory?