Nix 生态系统

Revision as of 19:47, 28 August 2025 by Weijia (talk | contribs) (Created page with "{| style="max-width: 36rem; margin: auto;" |+'''Nix 核心生态系统技术栈''' |style="text-align: center; border: 1px solid #ddd; background: #fafafa; padding: 1.6rem" width="2%"| <div style="font-size: 1.3em; font-weight: bold">NixOS</div> 一个用 Nixpkgs 构建的 Linux 发行版和配置系统 ! |- |style="text-align: center; border: 1px solid #ddd; background: #fafafa; padding: 1.6rem" width="2%"| <div style="font-size: 1.3em; font-weight: bold">Nixpkgs</div>...")

Nix 核心生态系统是一组技术的集合,旨在以可复现的方式构建、声明性地配置和管理软件包、系统及其依赖项。它通过将函数式编程范式从程序领域扩展到系统领域来实现这一目标,并使用一种动态的、函数式的、惰性求值的领域特定语言(DSL),即 Nix 语言,来指定可复现的构建过程。

此外,还有许多由 Nix 社区开发的应用程序Nix 扩展生态系统)利用并支持了这些核心技术。

官方生态系统

Nix 生态系统核心组件
组件 手册(Manual) 描述 用途 协议
NixOS NixOS 手册 一个由 Nix 构建所有组件的 Linux 发行版,因此支持可重现的、声明式的全系统配置管理以及原子升级和回滚。 声明式配置桌面、服务器和集群。 MIT
Nixpkgs Nixpkgs 手册 最大的社区维护的 Nix 软件包和 NixOS 模块仓库,NixOS 的标准版本也托管在这里。 分享 Nix 软件包和 NixOS 模块 MIT
Hydra Hydra 手册 基于 Nix 的持续构建系统 持续构建集群 GPL-3.0
Nix Nix 手册 一款软件包管理器,能解析指定可重现构建的 Nix 表达式,并将结果与依赖关系树的哈希值一起放入存储地址,从而避免依赖关系地狱,并支持多版本安装和回滚。 Linux 和 Darwin 中的可重现构建和软件包管理 LGPL-2.1
Nix 核心生态系统技术栈
NixOS

一个用 Nixpkgs 构建的 Linux 发行版和配置系统

Nixpkgs

一个巨大的,社区维护的软件仓库

Hydra

一个基于 Nix 的持续构建系统

Nix

一个纯函数式的构建系统

Usage of NixOS

Users install the NixOS distribution on their computers just as any other Linux distribution. They read about packages to install and configuration options in Nixpgs via https://search.nixos.org and this wiki. They use the Nix language to declaratively describe in a text file what software packages should be installed and how the system should be configured. They run 2 command line programs in a terminal to transform the system into the described system. They use the system as any other Linux system.

Development of NixOS

Developers of NixOS mainly work on Nixpkgs to describe in text files in Nix language how software packages should be build. After peer review these changes are integrated in Nixpkgs. Some of these packages are pre built on Hydra to reduce the update time for NixOS users.