Jump to content

NixOS as a desktop/zh: Difference between revisions

From NixOS Wiki
Ardenet (talk | contribs)
No edit summary
Tags: Mobile edit Mobile web edit
Ardenet (talk | contribs)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<languages/>
<languages/>
<div class="mw-translate-fuzzy">
[[Special:MyLanguage/NixOS|NixOS]] 是一款功能多样的操作系统,适用于各种用例。本文面向希望将 NixOS 主要桌面环境(无论是物理硬件还是虚拟机中)的户。此外,计划[[NixOS friendly hosters|云端]] 环境专用服务器基础架构部署 NixOS 的用户,可能会发现从这里介绍的念和实践开始会很有帮助,因为它们为在更广泛的 [[Special:MyLanguage/Nix ecosystem|Nix 生态系统]] 中工作奠定了基础。
NixOS可以用于许多目的. 如果你想把它用你的日常主要桌面操作系统(实体机上或者作为副虚拟机), 那么你应该看看这个页面. 即使你是想把NixOS用在云端或者是经过特殊配置的服务器上, 你也可能会从这里概述的课程开始, 以便从整体上对Nix生态有更好了解.
</div>


<span id="Installation"></span>
<span id="Installation"></span>
Line 161: Line 159:
</div>
</div>


[[Category:Desktop/zh|分类:桌面]]
[[Category:Desktop|分类:桌面]]
[[Category:Guide/zh|分类:指南]]
[[Category:Guide|分类:指南]]
[[Category:NixOS/zh|分类:NixOS]]
[[Category:NixOS|分类:NixOS]]

Latest revision as of 14:53, 10 October 2025

NixOS 是一款功能多样的操作系统,适用于各种用例。本文面向希望将 NixOS 作为主要桌面环境(无论是在物理硬件还是虚拟机中)的用户。此外,计划在 云端 环境或专用服务器基础架构上部署 NixOS 的用户,可能会发现从这里介绍的概念和实践开始会很有帮助,因为它们为在更广泛的 Nix 生态系统 中工作奠定了有益的基础。

安装

如果你倾向于阅读, 请从NixOS安装指南开始. 如果你想选择一个精良的视频教程, 请见下一条. 请记住, 为了安装一个桌面, 你需要确定一开始有至少30GiB的可用硬盘空间来容纳桌面环境(比如说, GNOME, KDE, 或者是XFCE), 浏览器(比如Firefox), 以及其他带有图形界面的典型日用软件(如VSCode). 对于相对简陋的配置, 15GiB可能够用.

管理你的配置

你可以使用NixOS官方手册中记录的方式来管理你的所有配置. 然而, 大部分在桌面上使用NixOS的社区成员更喜欢使用Home Manager来管理他们的配置(比如"点文件")(citation needed). Home Manager是一个面向用户的工具, 用于声明你想安装什么, 以及你想如何配置它. 对于大部分设置, 如果你不使用Home Manager的话, 你就要把它们放入configuration.nix, 或者使用nix-env.

The process for managing your configuration is documented in the NixOS official manual.

System Configuration

The primary configuration file, /etc/nixos/configuration.nix, defines system-wide settings. This includes options like enabling services, managing system users, setting hardware options, and specifying installed packages. Changes are applied with:

# nixos-rebuild switch

User configuration with Home Manager

For managing per-user configurations such as application preferences, command-line tools, and dotfiles, Home Manager provides a convenient, declarative approach. It allows users to define which programs should be installed and how they should be configured, without needing to include those settings in the system-wide configuration.nix.

Home Manager can be used independently of the system configuration and works with both traditional setups and newer Flakes-based configurations.

通过Flakes

如果你想要可组合性[citation needed]更强的NixOS配置设定, 仍在实验阶段的Flakes特性正在使社区感到十分兴奋. 管理flakes需要对Nix生态有良好的基本理解和一些已有的实践经验.

Refer to NixOS system configuration#Defining NixOS as a flake for details on getting started.

在初始设置之外

在你熟悉了Nix生态并安装了一个功能性的NixOS桌面后, 你可能会想了解定制化和更细化的设置.

Common configuration areas include:

Desktop Environments

Install and configure full-featured environments such as GNOME, KDE Plasma, or Xfce.

See Category:Desktop environment for a full list.

Window Managers

Set up lightweight or tiling window managers like i3, Sway, Hyprland, or xmonad.

See Category:Window managers for a full list.

Display Managers (Login Managers)

Configure graphical session managers such as GDM, SDDM, or LightDM.

Audio Setup

Enable and configure audio systems like PipeWire, PulseAudio, or ALSA.

Network Management

Use tools such as NetworkManager or systemd-networkd for managing network connections.

Bluetooth Support

Set up Bluetooth with blueman or other management tools.

Power Management

Configure laptop battery management, suspend, and hibernation with tools like tlp or systemd services.

Printing and Scanning

Enable Cups for printer support and tools like Sane for scanning devices.

提示和技巧

通过 NixOS 模块机制模块化你的配置

Main article: NixOS system configuration#Modularizing your configuration with modules

另见

对NixOS设置的比较中可查看一个对常见选择进行比较的表格.