From d41370c05b61f7df64d7c2fe3056bbc057a5e6fd Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Wed, 4 Oct 2023 14:40:55 +0800 Subject: [PATCH] feat: callpackage --- docs/nixpkgs/callpackage.md | 2 +- docs/zh/nixpkgs/callpackage.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/nixpkgs/callpackage.md b/docs/nixpkgs/callpackage.md index 0a0534d..4822e52 100644 --- a/docs/nixpkgs/callpackage.md +++ b/docs/nixpkgs/callpackage.md @@ -65,7 +65,7 @@ In essence, `pkgs.callPackage` is used as `pkgs.callPackage fn args`, where `fn` 3. Then, `pkgs.callPackge fn args` extracts the parameters of the `fn` function from the merged attribute set and uses them to execute the function. 4. The result of the function execution is a Derivation, which is a Nix package. -What can a Nix file or function, used as an argument to `pkgs.callPackge`, look like? You can examine examples we've used before: `hello.nix`, `fcitx5-rime.nix`, `vscode/with-extensions.nix`, and `firefox/common.nix`. All of them can be imported using `pkgs.callPackage`. +What can a Nix file or function, used as an argument to `pkgs.callPackge`, look like? You can examine examples we've used before in [Nixpkgs's Advanced Usage - Introduction](./intro.md): `hello.nix`, `fcitx5-rime.nix`, `vscode/with-extensions.nix`, and `firefox/common.nix`. All of them can be imported using `pkgs.callPackage`. For instance, if you've defined a custom NixOS kernel configuration in `kernel.nix` and made the development branch name and kernel source code configurable: diff --git a/docs/zh/nixpkgs/callpackage.md b/docs/zh/nixpkgs/callpackage.md index 4b6be4f..593d21c 100644 --- a/docs/zh/nixpkgs/callpackage.md +++ b/docs/zh/nixpkgs/callpackage.md @@ -102,7 +102,7 @@ nix-repl> import ./hello.nix pkgs 3. 再之后,`pkgs.callPackge fn args` 会从上一步得到的 attribute set 中提取出 `fn` 函数的参数,并使用它们来执行 `fn` 函数。 4. 函数执行结果是一个 Derivation,也就是一个 Nix 包。 -那可以作为 `pkgs.callPackge` 参数的 nix 文件具体长啥样呢,可以去看看我们前面举例过的 `hello.nix` `fcitx5-rime.nix` `vscode/with-extensions.nix` `firefox/common.nix`,它们都可以被 `pkgs.callPackage` 导入。 +那可以作为 `pkgs.callPackge` 参数的 nix 文件具体长啥样呢,可以去看看我们前面在 [Nixpkgs 高级用法 - 简介](./intro.md) 中举例过的 `hello.nix` `fcitx5-rime.nix` `vscode/with-extensions.nix` `firefox/common.nix`,它们都可以被 `pkgs.callPackage` 导入。 比如说我们自定义了一个 NixOS 内核配置 `kernel.nix`,并且将开发版名称与内核源码作为了可变更参数: