NixOS/zh: Difference between revisions

Weijia (talk | contribs)
Created page with "NixOS 与其他 Linux 发行版的主要区别在于,NixOS 不遵循 [https://en.wikipedia.org/wiki/Linux_Standard_Base Linux 标准规范(LSB)] 的文件系统结构。在遵循 LSB 的系统中,软件通常存储在 <code>/{,usr}/{bin,lib,share}</code> 目录下,而配置文件通常存储在 <code>/etc</code>。如果程序的可执行文件被放置在 LSB 的某个 <code>/bin</code> 目录下,那么它就可以在用户环境中被访问。当一个程..."
Weijia (talk | contribs)
Created page with "然而,在 NixOS 中,<code>/lib</code> 和 <code>/usr/lib</code> 目录并不存在。相反,所有系统库文件、可执行文件、内核、固件和配置文件都存放在 Nix store 中。<code>/nix/store</code> 下的文件和目录均由构建数据的描述信息经哈希后命名。所有位于 Nix Store 的文件与目录均不可变。 <code>/bin</code> 和 <code>/usr/bin</code> 几乎不存在:它们分别只包..."
Tags: Mobile edit Mobile web edit
Line 100: Line 100:
NixOS 与其他 Linux 发行版的主要区别在于,NixOS 不遵循 [https://en.wikipedia.org/wiki/Linux_Standard_Base Linux 标准规范(LSB)] 的文件系统结构。在遵循 LSB 的系统中,软件通常存储在 <code>/{,usr}/{bin,lib,share}</code> 目录下,而配置文件通常存储在 <code>/etc</code>。如果程序的可执行文件被放置在 LSB 的某个 <code>/bin</code> 目录下,那么它就可以在用户环境中被访问。当一个程序引用动态链接库时,它将在 LSB 目录(<code>/lib</code>、<code>/usr/lib</code>)中搜索所需的库。
NixOS 与其他 Linux 发行版的主要区别在于,NixOS 不遵循 [https://en.wikipedia.org/wiki/Linux_Standard_Base Linux 标准规范(LSB)] 的文件系统结构。在遵循 LSB 的系统中,软件通常存储在 <code>/{,usr}/{bin,lib,share}</code> 目录下,而配置文件通常存储在 <code>/etc</code>。如果程序的可执行文件被放置在 LSB 的某个 <code>/bin</code> 目录下,那么它就可以在用户环境中被访问。当一个程序引用动态链接库时,它将在 LSB 目录(<code>/lib</code>、<code>/usr/lib</code>)中搜索所需的库。


<div lang="en" dir="ltr" class="mw-content-ltr">
然而,在 NixOS 中,<code>/lib</code> <code>/usr/lib</code> 目录并不存在。相反,所有系统库文件、可执行文件、内核、固件和配置文件都存放在 [[Special:MyLanguage/Nix#Nix store|Nix store]] 中。<code>/nix/store</code> 下的文件和目录均由构建数据的描述信息经哈希后命名。所有位于 Nix Store 的文件与目录均不可变。
In NixOS however <code>/lib</code> and <code>/usr/lib</code> do not exist. Instead all system libraries, binaries, kernels, firmware and configuration files are placed in the [[Special:MyLanguage/Nix#Nix store|Nix store]]. The files and directories in <code>/nix/store</code> are named by hashes of the information describing the built data. All of the files and directories placed in the Nix store are immutable. <code>/bin</code> and <code>/usr/bin</code> are almost absent: they contain only <code>/bin/sh</code> and <code>/usr/bin/env</code> respectively, to provide minimal compatibility with existing scripts using shebang lines. User-level environments are implemented using a large number of symbolic links to all required packages and auxiliary files. These environments are called [[Special:MyLanguage/Nix#Profiles|profiles]] and are stored in <code>/nix/var/nix/profiles</code>, each user having their own profiles. Structuring the system in this way is how NixOS obtains its key advantages over conventional Linux distributions, such as atomicity and rollback support.
<code>/bin</code> <code>/usr/bin</code> 几乎不存在:它们分别只包含 <code>/bin/sh</code> <code>/usr/bin/env</code>,以提供与使用 shebang 行的现有脚本的最低兼容性。用户级环境通过大量指向所需软件包和辅助文件的符号链接来实现。
</div>
这些环境被称作 [[Special:MyLanguage/Nix#Profiles|Profiles]],被存储于 <code>/nix/var/nix/profiles</code>,每个用户拥有其独有的 Profiles。
通过这种结构化的系统组织方式,NixOS 获得了优于传统 Linux 发行版的核心优势,例如原子化操作和回滚支持。


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