feat: comments

This commit is contained in:
Ryan Yin 2024-02-07 23:36:33 +08:00
parent 4095216445
commit 52ba377c29
2 changed files with 6 additions and 0 deletions

View File

@ -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: It's easier to understand with a direct example:
```nix ```nix
# ./foo.nix
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib; 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: 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 ```nix
# ./bar.nix
{ config, lib, pkgs, ... }: { 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: Let's start with a simple example:
```nix ```nix
# ./flake.nix
{ {
description = "NixOS Flake for Test"; description = "NixOS Flake for Test";

View File

@ -87,6 +87,7 @@ Nixpkgs 中定义的模块,其基本结构如下:
直接看个例子更容易理解: 直接看个例子更容易理解:
```nix ```nix
# ./foo.nix
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib; with lib;
@ -146,6 +147,7 @@ in {
这样,我们就可以在另一个 nix 文件中导入这个模块,并通过设置这里定义的 `options` 来实现对 foo 的自定义配置了,示例: 这样,我们就可以在另一个 nix 文件中导入这个模块,并通过设置这里定义的 `options` 来实现对 foo 的自定义配置了,示例:
```nix ```nix
# ./bar.nix
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
@ -172,6 +174,7 @@ in {
先看个简单的例子: 先看个简单的例子:
```nix ```nix
# ./flake.nix
{ {
description = "NixOS Flake for Test"; description = "NixOS Flake for Test";