I’m trying to make a way for mpv scripts to add fonts to mpv.
My idea is that mpv scripts will have passthru.fonts = ["my-font.ttf"]; (like passthru.scriptName) and the home-manager module will create a symlink for each font to ~/.config/mpv/fonts/.
For example: ~/.config/mpv/fonts/my-font.ttf will be a symlink to ${script}/share/mpv/fonts/my-font.ttf
This is a fairly common failure mode. You did your computing too close to the root of the option tree. You could have set ANY option from that mkMerge, so it has to compute at least some of the expression before it knows the values of ANY options, and since the expression depends on other options, infinite recursion.
What if you had set programs.mpv.scripts inside the mkMerge? Nix can’t tell the difference at that stage of execution, so it’s stuck.
Basically you want to do { xdg.configFile = mkMerge ...; } instead.
Thank you so much! this solved the issue.
I still can’t understand why it resulted in infinite recursion and how the code is different now than how it was before.
By moving the mkMerge down the tree, you narrow down what options that big hunk of computation could possibly affect (only things under xdg.configFile), and in particular, rule out the possibility of it affecting programs.mpv.scripts, which is used to create it.