diff --git a/docs/nixpkgs/overriding.md b/docs/nixpkgs/overriding.md index c3fde4d..4498d0f 100644 --- a/docs/nixpkgs/overriding.md +++ b/docs/nixpkgs/overriding.md @@ -11,7 +11,7 @@ In the above example, we override the `rimeDataPkgs` parameter of the `fcitx5-ri To find out which parameters of a specific package can be overridden, there are a couple of approaches you can follow: 1. Check the source code of the package in the Nixpkgs repository on GitHub, such as [`fcitx5-rime.nix`](https://github.com/NixOS/nixpkgs/blob/e4246ae1e7f78b7087dce9c9da10d28d3725025f/pkgs/tools/inputmethods/fcitx5/fcitx5-rime.nix). Make sure to select the appropriate branch, such as `nixos-unstable`, if you are using that branch. -2. Use the `nix repl ''` command to open a Nix REPL and then enter `:e pkgs.fcitx5-rime`. This opens the source code of the package in your default editor, where you can see all the parameters of the package. To learn the basic usage of `nix repl`, you can type `:?` to see the help information. +2. Use the `nix repl -f ''` command to open a Nix REPL and then enter `:e pkgs.fcitx5-rime`. This opens the source code of the package in your default editor, where you can see all the parameters of the package. To learn the basic usage of `nix repl`, you can type `:?` to see the help information. By using these methods, you can discover the input parameters of a package and determine which ones can be modified using `override`. @@ -62,6 +62,6 @@ helloWithDebug = pkgs.hello.overrideAttrs (finalAttrs: previousAttrs: { In this case, we override the `separateDebugInfo` attribute, which is defined in `stdenv.mkDerivation`, rather than in the source code of `hello`. -To see all the attributes defined in `stdenv.mkDerivation`, you can check its source code by using `nix repl ''` and entering `:e stdenv.mkDerivation`. +To see all the attributes defined in `stdenv.mkDerivation`, you can check its source code by using `nix repl -f ''` and entering `:e stdenv.mkDerivation`. This will open the source code in your default editor. If you're new to using `nix repl`, you can type `:?` to see the help information. diff --git a/docs/zh/nixpkgs/overriding.md b/docs/zh/nixpkgs/overriding.md index 79a2b3d..44719f6 100644 --- a/docs/zh/nixpkgs/overriding.md +++ b/docs/zh/nixpkgs/overriding.md @@ -14,7 +14,7 @@ pkgs.fcitx5-rime.override {rimeDataPkgs = [ 1. 直接在 GitHub 的 nixpkgs 源码中找:[fcitx5-rime.nix](https://github.com/NixOS/nixpkgs/blob/e4246ae1e7f78b7087dce9c9da10d28d3725025f/pkgs/tools/inputmethods/fcitx5/fcitx5-rime.nix) 1. 注意要选择正确的分支,加入你用的是 nixos-unstable 分支,那就要在 nixos-unstable 分支中找。 -2. 通过 `nix repl` 交互式查看:`nix repl ''`,然后输入 `:e pkgs.fcitx5-rime`,会通过编辑器打开这个包的源码,然后就可以看到这个包的所有参数了。 +2. 通过 `nix repl` 交互式查看:`nix repl -f ''`,然后输入 `:e pkgs.fcitx5-rime`,会通过编辑器打开这个包的源码,然后就可以看到这个包的所有参数了。 通过上述两种方法,都可以看到 `fcitx5-rime` 这个包拥有如下输入参数,它们都是可以通过 `override` 修改的: @@ -83,7 +83,7 @@ helloWithDebug = pkgs.hello.overrideAttrs (finalAttrs: previousAttrs: { }); ``` -具体的内部参数可以通过 `nix repl ''` 然后输入 `:e stdenv.mkDerivation` 来查看其源码。 +具体的内部参数可以通过 `nix repl -f ''` 然后输入 `:e stdenv.mkDerivation` 来查看其源码。 ## 参考