FAQ: Difference between revisions
Add FAQ entry about infinite recursion and imports |
|||
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 | 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.) |