|
|
(6 intermediate revisions by the same user not shown) |
Line 54: |
Line 54: |
| 为了搭建一致的用户或系统环境,Nix将Nix存储的条目符号链接到''配置文件''。这是Nix允许回滚功能的前端:由于存储不可变,先前版本的配置文件被保留,恢复到更早的状态只需要改变符号链接到先前的配置文件。更精确地说,Nix将二进制文件符号链接到Nix存储中表示用户环境的条目。然后这些用户环境被符号链接到<code>/nix/var/nix/profiles</code>里被标记的配置文件,后者又被符号链接到该用户的<code>~/.nix-profile</code>。 | | 为了搭建一致的用户或系统环境,Nix将Nix存储的条目符号链接到''配置文件''。这是Nix允许回滚功能的前端:由于存储不可变,先前版本的配置文件被保留,恢复到更早的状态只需要改变符号链接到先前的配置文件。更精确地说,Nix将二进制文件符号链接到Nix存储中表示用户环境的条目。然后这些用户环境被符号链接到<code>/nix/var/nix/profiles</code>里被标记的配置文件,后者又被符号链接到该用户的<code>~/.nix-profile</code>。 |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr"> | | <span id="Sandboxing"></span> |
| === Sandboxing === | | === 沙盒化 === |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 当启用沙盒构建时,Nix会为每个构建过程设置一个隔离的环境。它用于移除构建环境中额外的隐藏依赖,以提高可复现性。这包括在构建过程中禁止<code>fetch*</code>函数之外对网络的访问,和Nix存储之外对文件的访问。根据操作系统的不同,对其他资源的访问也会被阻止(例如,进程间通信在Linux上被隔离);详细信息见Nix手册里的[https://nixos.org/nix/manual/#sec-conf-file nix.conf部分] |
| When sandbox builds are enabled, Nix will setup an isolated environment for each build process. It is used to remove further hidden dependencies set by the build environment to improve reproducibility. This includes access to the network during the build outside of <code>fetch*</code> functions and files outside the Nix store. Depending on the operating system access to other resources are blocked as well (ex. inter process communication is isolated on Linux); see [https://nixos.org/nix/manual/#sec-conf-file nix.conf section] in the Nix manual for details.
| |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 沙盒化在Linux上默认启用,在macOS上默认禁用。 |
| Sandboxing is enabled by default on Linux, and disabled by default on macOS.
| | Nixpkgs的拉取请求(pull requests)中,要求在沙盒化启用条件下测试构建(见拉取请求模板中的<code>Tested using sandboxing</code>),因为在[https://nixos.org/hydra/ 官方Hydra构建]中使用了沙盒化。 |
| In pull requests for [https://github.com/NixOS/nixpkgs/ Nixpkgs] people are asked to test builds with sandboxing enabled (see <code>Tested using sandboxing</code> in the pull request template) because in [https://nixos.org/hydra/ official Hydra builds] sandboxing is also used.
| |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 为Nix配置沙盒化,在<code>/etc/nix/nix.conf</code>里设置<code>sandbox = true</code>。为NixOS配置沙盒化,在<code>configuration.nix</code>里设置<code>nix.useSandbox = true;</code>。从NixOS 17.09开始,<code>nix.useSandbox</code>选项默认为<code>true</code> |
| To configure Nix for sandboxing, set <code>sandbox = true</code> in <code>/etc/nix/nix.conf</code>; to configure NixOS for sandboxing set <code>nix.useSandbox = true;</code> in <code>configuration.nix</code>. The <code>nix.useSandbox</code> option is <code>true</code> by default since NixOS 17.09.
| |
| </div> | |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr"> | | <span id="Alternative_Interpreters"></span> |
| === Alternative Interpreters === | | === 可选的解释器 === |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 一项用Rust从零开始重新实现Nix的工作正在进行。 |
| There is an ongoing effort to reimplement Nix, from the ground up, in Rust.
| |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr"> | | <div lang="en" dir="ltr" class="mw-content-ltr"> |
Line 83: |
Line 73: |
| </div> | | </div> |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | Nix 2.18有一个名叫Lix的社区领导分支,专注于正确性、易用性和成长性。尽管它也将一些Nix组件移植到Rust,它不是Tvix那样从零开始的重写版本。 |
| There is also a community-led fork of Nix 2.18 named Lix, focused on correctness, usability, and growth. While it has also ported some components of Nix to Rust, it is not a ground-up rewrite like Tvix.
| |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr"> | | <div lang="en" dir="ltr" class="mw-content-ltr"> |
Line 91: |
Line 79: |
| </div> | | </div> |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 更早的尝试可在riir-nix找到 |
| Earlier attempts can be found on [https://riir-nix.github.io/ riir-nix]
| |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | == 备注 == |
| ==Notes==
| |
| <references /> | | <references /> |
| </div>
| |
|
| |
|
|
| |
|