|
|
Line 27: |
Line 27: |
| == 内部细节 == | | == 内部细节 == |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr"> | | <span id="Nix_store"></span> |
| === Nix store === | | === Nix存储(Nix store) === |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | {{Split|reason=Nix存储在概念上足够独立,有必要单独成文。}} |
| {{Split|reason=The nix store is conceptually separate enough that it warrants a separate article.}} | |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | Nix构建得到的包放在只读的''Nix存储'',正常情况下在<code>/nix/store</code>。每个包被赋予唯一地址,该地址由加密哈希值后跟包名称和版本指定,比如<code>/nix/store/nawl092prjblbhvv16kxxbk6j9gkgcqm-git-2.14.1</code>。前缀哈希值来自对构建过程中所有输入的哈希,包括源文件、整个依赖树、编译器标志等。这让Nix能同时安装同一个包的不同版本,甚至同一版本的不同构建,比如不同编译器构建的变体。在添加、移除或更新包时,不会从存储中移除任何包,而是在''配置文件''(profiles)里添加、移除或修改指向这些包的符号链接。 |
| Packages built by Nix are placed in the read-only ''Nix store'', normally found in <code>/nix/store</code>. Each package is given a unique address specified by a cryptographic hash followed by the package name and version, for example <code>/nix/store/nawl092prjblbhvv16kxxbk6j9gkgcqm-git-2.14.1</code>. These prefixes hash all the inputs to the build process, including the source files, the full dependency tree, compiler flags, etc. This allows Nix to simultaneously install different versions of the same package, and even different builds of the same version, for example variants built with different compilers. When adding, removing or updating a package, nothing is removed from the store; instead, symlinks to these packages are added, removed or changed in ''profiles''.
| |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr"> | | <span id="Cleaning_the_Nix_store"></span> |
| ==== Cleaning the Nix store ==== | | === 清理Nix存储 === |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 有关清理Nix存储的信息,参考{{NixOS Manual|name=NixOS手册:章节 - 清理Nix存储|anchor=#sec-nix-gc}}。 |
| For information relating to cleaning the Nix store, refer to {{NixOS Manual|name=NixOS Manual: Chapter - Cleaning the Nix Store|anchor=#sec-nix-gc}}.
| |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr"> | | <span id="Nix_store_corruption"></span> |
| ==== Nix store corruption ==== | | ==== Nix存储损坏 ==== |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr"> | | <div lang="en" dir="ltr" class="mw-content-ltr"> |