mirror of
https://github.com/ryan4yin/nixos-and-flakes-book.git
synced 2024-11-21 23:53:12 +01:00
feat: docs for _module.args
This commit is contained in:
parent
0091296234
commit
a15b7c738d
@ -280,8 +280,9 @@ The official documentation for these two parameters is buried deep and is vague
|
||||
1. `specialArgs`: There are scattered mentions related to it in the NixOS Manual and the Nixpkgs Manual.
|
||||
- Nixpkgs Manual: [Module System - Nixpkgs]
|
||||
- NixOS Manual: [nixpkgs/nixos-23.11/nixos/doc/manual/development/option-types.section.md#L237-L244]
|
||||
1. `_module.args`: Its only official documentation is in the source code below.
|
||||
- [nixpkgs/nixos-23.11/lib/modules.nix - _module.args]
|
||||
1. `_module.args`:
|
||||
- NixOS Manual: [Appendix A. Configuration Options](https://nixos.org/manual/nixos/stable/options#opt-_module.args)
|
||||
- Source Code: [nixpkgs/nixos-23.11/lib/modules.nix - _module.args]
|
||||
|
||||
In short, `specialArgs` and `_module.args` both require an attribute set as their value, and they serve the same purpose, passing all parameters in the attribute set to all submodules. The difference between them is:
|
||||
|
||||
|
@ -278,8 +278,9 @@ Nixpkgs 的模块系统提供了两种方式来传递非默认参数:
|
||||
1. `specialArgs`: NixOS Manual 跟 Nixpkgs Manual 中分别有与它有关的只言片语
|
||||
- Nixpkgs Manual: [Module System - Nixpkgs]
|
||||
- NixOS Manual: [nixpkgs/nixos-23.11/nixos/doc/manual/development/option-types.section.md#L237-L244]
|
||||
1. `_module.args`: 它唯一的官方文档在如下这份源码中
|
||||
- [nixpkgs/nixos-23.11/lib/modules.nix - _module.args]
|
||||
1. `_module.args`:
|
||||
- NixOS Manual: [Appendix A. Configuration Options](https://nixos.org/manual/nixos/stable/options#opt-_module.args)
|
||||
- Source Code: [nixpkgs/nixos-23.11/lib/modules.nix - _module.args]
|
||||
|
||||
总之,`specialArgs` 与 `_module.args` 需要的值都是一个 attribute set,它们的功能也相同,都是将其 attribute set 中的所有参数传递到所有子模块中。
|
||||
这两者的区别在于:
|
||||
|
Loading…
Reference in New Issue
Block a user