mirror of
https://github.com/ryan4yin/nixos-and-flakes-book.git
synced 2025-02-16 18:30:55 +01:00
chore: polish
This commit is contained in:
parent
a0ebe2a81a
commit
2df64919e0
@ -86,10 +86,13 @@ Note that the copied template cannot be used directly. You need to modify it to
|
|||||||
};
|
};
|
||||||
|
|
||||||
# `outputs` are all the build result of the flake.
|
# `outputs` are all the build result of the flake.
|
||||||
|
#
|
||||||
# A flake can have many use cases and different types of outputs.
|
# A flake can have many use cases and different types of outputs.
|
||||||
# parameters in `outputs` are defined in `inputs` and
|
#
|
||||||
|
# parameters in function `outputs` are defined in `inputs` and
|
||||||
# can be referenced by their names. However, `self` is an exception,
|
# can be referenced by their names. However, `self` is an exception,
|
||||||
# this special parameter points to the `outputs` itself(self-reference)
|
# this special parameter points to the `outputs` itself(self-reference)
|
||||||
|
#
|
||||||
# The `@` syntax here is used to alias the attribute set of the
|
# The `@` syntax here is used to alias the attribute set of the
|
||||||
# inputs's parameter, making it convenient to use inside the function.
|
# inputs's parameter, making it convenient to use inside the function.
|
||||||
outputs = { self, nixpkgs, ... }@inputs: {
|
outputs = { self, nixpkgs, ... }@inputs: {
|
||||||
|
@ -83,7 +83,8 @@ cat flake.nix
|
|||||||
# outputs 即 flake 的所有输出,其中的 nixosConfigurations 即 NixOS 系统配置
|
# outputs 即 flake 的所有输出,其中的 nixosConfigurations 即 NixOS 系统配置
|
||||||
# flake 有很多用途,也可以有很多不同的 outputs,nixosConfigurations 只是其中一种
|
# flake 有很多用途,也可以有很多不同的 outputs,nixosConfigurations 只是其中一种
|
||||||
#
|
#
|
||||||
# outputs 的参数都是 inputs 中定义的依赖项,可以通过它们的名称来引用。
|
# outputs 是一个函数,它的参数都在 inputs 中定义,可以通过 inputs 中定义的名称来引用。
|
||||||
|
# 比如这里的输入参数 `nixpkgs`,就是上面 inputs 中的 `nixpkgs`
|
||||||
# 不过 self 是个例外,这个特殊参数指向 outputs 自身(自引用),以及 flake 根目录
|
# 不过 self 是个例外,这个特殊参数指向 outputs 自身(自引用),以及 flake 根目录
|
||||||
# 这里的 @ 语法将函数的参数 attribute set 取了个别名,方便在内部使用
|
# 这里的 @ 语法将函数的参数 attribute set 取了个别名,方便在内部使用
|
||||||
outputs = { self, nixpkgs, ... }@inputs: {
|
outputs = { self, nixpkgs, ... }@inputs: {
|
||||||
|
Loading…
Reference in New Issue
Block a user