FAQ: Difference between revisions

Rhendric (talk | contribs)
Add FAQ entry about infinite recursion and imports
Rhendric (talk | contribs)
Line 440: Line 440:
You should not try to conditionally import other modules based on other values. Make your imports unconditional, and make the modules that you're importing have conditional ''behavior'' based on the values of options.
You should not try to conditionally import other modules based on other values. Make your imports unconditional, and make the modules that you're importing have conditional ''behavior'' based on the values of options.


If it helps, think of <code>imports</code> as akin to an `#include` directive in C.
If it helps, think of <code>imports</code> as akin to an <code>#include</code> directive in C.


(Note that none of this applies to the [https://nix.dev/manual/nix/stable/language/builtins#builtins-import <code>import</code> built-in Nix language function], which is its own thing.)
(Note that none of this applies to the [https://nix.dev/manual/nix/stable/language/builtins#builtins-import <code>import</code> built-in Nix language function], which is its own thing.)