FAQ/zh: Difference between revisions

Ardenet (talk | contribs)
Created page with "另见 Debug Symbols"
Ardenet (talk | contribs)
Created page with "要使用 -Og 和 -g 参数构建软件包,且不去除调试符号,请使用:"
 
(11 intermediate revisions by the same user not shown)
Line 43: Line 43:
}</syntaxhighlight>
}</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
请查阅“man configuration.nix”文件以了解这些选项。重新构建系统以使这些选项生效:
Check 'man configuration.nix' for these options. Rebuild for these options to take effect:
</div>


<syntaxhighlight lang="bash">nixos-rebuild switch</syntaxhighlight>
<syntaxhighlight lang="bash">nixos-rebuild switch</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
列出构成系统闭包的所有存储路径并实例化它们:
List all store paths that form the system closure and realise them:
</div>


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
Line 60: Line 56:
</syntaxhighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
对您的用户和其他配置文件重复该步骤:
Repeat for your user and further profiles:
</div>


<syntaxhighlight lang="bash">nix-store -qR ~/.nix-profile | xargs nix-store -r</syntaxhighlight>
<syntaxhighlight lang="bash">nix-store -qR ~/.nix-profile | xargs nix-store -r</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
对于列在 ''/nix/var/nix/profiles/'' 或其子目录中的配置文件,可以忽略此警告。
The warning can be ignored for profiles that are listed/linked in ''/nix/var/nix/profiles/'' or one of its subdirectories.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
有关更多信息,请参阅 nix-store nix-instantiate 的手册。
Consult man pages of nix-store and nix-instantiate for further information.
</div>


<span id="Why_-_instead_of_-?"></span>
<span id="Why_-_instead_of_-?"></span>
Line 83: Line 73:
此外,由于开头部分长度一致,查看一系列软件包列表时在视觉上也更容易解析。
此外,由于开头部分长度一致,查看一系列软件包列表时在视觉上也更容易解析。


<div lang="en" dir="ltr" class="mw-content-ltr">
如果你仍然想知道原因,请在 shell 中运行 <code>ls -1 /nix/store | sort -R -t - -k 2 | less</code> 命令。''(? 不清楚)''
If you still wonder why, run <code>ls -1 /nix/store | sort -R -t - -k 2 | less</code> in your shell. ''(? unclear)''
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
如果你不经常进行垃圾回收,或者正在测试编译变体,可能会发生这种情况:
This is what might happen if you don't garbage collect frequently, or if you are testing compilation variants:
</div>


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
Line 148: Line 134:
=== 即使不修改 nix 表达式,我如何强制从源代码重建?===
=== 即使不修改 nix 表达式,我如何强制从源代码重建?===


<div lang="en" dir="ltr" class="mw-content-ltr">
root 用户身份运行 nix-build 时,可以使用 --check 标志:
As root you can run nix-build with the --check flag:
</div>


<syntaxhighlight lang="bash">sudo nix-build --check -A ncdu</syntaxhighlight>
<syntaxhighlight lang="bash">sudo nix-build --check -A ncdu</syntaxhighlight>
Line 157: Line 141:
=== 我如何使用 nix-env 管理软件,就像使用 configuration.nix 一样?===
=== 我如何使用 nix-env 管理软件,就像使用 configuration.nix 一样?===


<div lang="en" dir="ltr" class="mw-content-ltr">
有很多方法,其中一种如下:
There are many ways, one is the following:
</div>


<ol style="list-style-type: decimal;">
<ol style="list-style-type: decimal;">
Line 407: Line 389:
</syntaxhighlight>
</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="There&#039;s_an_updated_version_for_$software_on_the_unstable_branch,_but_I_use_stable,_how_can_I_use_it?"></span>
=== There's an updated version for $software on the unstable branch, but I use stable, how can I use it? ===
=== 不稳定分支上有软件 $software 的更新版本,但我用的是稳定版,我该如何使用它? ===
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 431: Line 412:
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Using_channels"></span>
==== Using channels ====
==== 使用频道 ====
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 470: Line 450:
}</syntaxhighlight>
}</syntaxhighlight>


<div lang="en" dir="ltr" class="mw-content-ltr">
<span id="Using_flakes"></span>
==== Using flakes ====
==== 使用 Flakes ====
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">