diff --git a/docs/other-usage-of-flakes/module-system.md b/docs/other-usage-of-flakes/module-system.md index 83b5fa1..41eeaee 100644 --- a/docs/other-usage-of-flakes/module-system.md +++ b/docs/other-usage-of-flakes/module-system.md @@ -80,6 +80,7 @@ The most typical usage is to, within the same Nixpkgs module, set values for oth It's easier to understand with a direct example: ```nix +# ./foo.nix { config, lib, pkgs, ... }: with lib; @@ -139,6 +140,7 @@ Then, in the `config` section, based on the values declared in these three varia This way, we can import this module in another Nix file and achieve custom configuration for `foo` by setting the `options` defined here. For example: ```nix +# ./bar.nix { config, lib, pkgs, ... }: { @@ -165,6 +167,7 @@ The module system takes full advantage of Nix's lazy evaluation feature, which i Let's start with a simple example: ```nix +# ./flake.nix { description = "NixOS Flake for Test"; diff --git a/docs/zh/other-usage-of-flakes/module-system.md b/docs/zh/other-usage-of-flakes/module-system.md index 866e5dd..f0dab30 100644 --- a/docs/zh/other-usage-of-flakes/module-system.md +++ b/docs/zh/other-usage-of-flakes/module-system.md @@ -87,6 +87,7 @@ Nixpkgs 中定义的模块,其基本结构如下: 直接看个例子更容易理解: ```nix +# ./foo.nix { config, lib, pkgs, ... }: with lib; @@ -146,6 +147,7 @@ in { 这样,我们就可以在另一个 nix 文件中导入这个模块,并通过设置这里定义的 `options` 来实现对 foo 的自定义配置了,示例: ```nix +# ./bar.nix { config, lib, pkgs, ... }: { @@ -172,6 +174,7 @@ in { 先看个简单的例子: ```nix +# ./flake.nix { description = "NixOS Flake for Test";