mirror of
https://github.com/ryan4yin/nixos-and-flakes-book.git
synced 2024-11-25 01:23:08 +01:00
feat: comments
This commit is contained in:
parent
4095216445
commit
52ba377c29
@ -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";
|
||||
|
||||
|
@ -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";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user