mirror of
https://github.com/ryan4yin/nixos-and-flakes-book.git
synced 2024-11-24 17:13:12 +01:00
fix: specialArgs & _module.args
This commit is contained in:
parent
889d848005
commit
d8914059f9
@ -95,8 +95,7 @@ submodules. The difference between them is:
|
||||
passed through `_module.args` in `imports = [ ... ];`, it will result in an
|
||||
`infinite recursion` error**. In this case, you must use `specialArgs` instead.
|
||||
|
||||
The NixOS community generally recommends prioritizing the use of the `_module.args` option
|
||||
and resorting to `specialArgs` only when `_module.args` cannot be used.
|
||||
I personally prefer `specialArgs` because it is more straightforward and easier to use.
|
||||
|
||||
Suppose you want to pass a certain dependency to a submodule for use. You can use the
|
||||
`specialArgs` parameter to pass the `inputs` to all submodules:
|
||||
|
@ -87,6 +87,8 @@ Nixpkgs 的模块系统提供了两种方式来传递非默认参数:
|
||||
NixOS 社区比较推荐优先使用 `_module.args` 这个 options,仅在无法使用 `_module.args` 时才改
|
||||
用 `specialArgs`。
|
||||
|
||||
我个人更喜欢 `specialArgs`,因为它更简单直接,用起来顺手些。
|
||||
|
||||
假设你想将某个依赖项传递到子模块中使用,可以使用 `specialArgs` 参数将 `inputs` 传递到所有
|
||||
子模块中:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user