|
|
| (28 intermediate revisions by 2 users 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 18: |
Line 16: |
| </div> | | </div> |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 关于如何管理配置,请参阅 {{NixOS Manual|name=NixOS 官方手册|anchor=#ch-configuration}}。 |
| The process for managing your configuration is documented in the {{NixOS Manual|name=NixOS official manual|anchor=#ch-configuration}}.
| |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr"> | | <span id="System_Configuration"></span> |
| === System Configuration === | | === 系统配置 === |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | {{main|NixOS 系统配置}} |
| {{main|NixOS system configuration}} | |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | <code>/etc/nixos/configuration.nix</code>是主配置文件,用于定义系统级设置。其中包括启用服务、管理系统用户、配置硬件选项以及指定安装的软件包。 |
| The primary configuration file, <code>/etc/nixos/configuration.nix</code>, defines system-wide settings. This includes options like enabling services, managing system users, setting hardware options, and specifying installed packages. Changes are applied with:
| | 若要使更改生效,请运行: |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| |
| <syntaxhighlight lang="console"> | | <syntaxhighlight lang="console"> |
| # nixos-rebuild switch | | # nixos-rebuild switch |
| </syntaxhighlight> | | </syntaxhighlight> |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr"> | | <span id="User_configuration_with_Home_Manager"></span> |
| === User configuration with Home Manager === | | === 使用 Home Manager 管理用户配置 === |
| </div>
| | |
| | 针对应用程序偏好设置、命令行工具以及 dotfiles 等用户级配置的管理,[[Home Manager]] 提供了一种便捷的声明式方案。 |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 它允许用户自行定义需要安装的程序及其具体配置方式,而无需将这些设置写入系统级的 [https://nixos.org/manual/nixos/stable/#sec-changing-config configuration.nix] 中。 |
| 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 [https://nixos.org/manual/nixos/stable/#sec-changing-config configuration.nix].
| |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | Home Manager 可以独立于系统配置使用,既支持传统设置,也支持基于 [[Flakes]] 的新式配置。 |
| Home Manager can be used independently of the system configuration and works with both traditional setups and newer [[Flakes]]-based configurations. | |
| </div>
| |
|
| |
|
| <span id="With_Flakes"></span> | | <span id="With_Flakes"></span> |
| Line 59: |
Line 46: |
| </div> | | </div> |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 关于如何开始的详细信息,请参考 [[NixOS system configuration#Defining NixOS as a flake]]。 |
| Refer to [[NixOS system configuration#Defining NixOS as a flake]] for details on getting started.
| |
| </div>
| |
|
| |
|
| <span id="Beyond_initial_setup"></span> | | <span id="Beyond_initial_setup"></span> |
| Line 70: |
Line 55: |
| </div> | | </div> |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 常见配置项包含: |
| Common configuration areas include:
| |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr"> | | <span id="Desktop_Environments"></span> |
| ==== Desktop Environments ==== | | ==== 桌面环境 ==== |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 安装并配置功能完备的桌面环境,如 [[GNOME]]、[[KDE Plasma]] 或 [[Xfce]]。 |
| Install and configure full-featured environments such as [[GNOME]], [[KDE Plasma]], or [[Xfce]].
| |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 完整列表请参阅 [[:Category:Desktop environment]]。 |
| See [[:Category:Desktop environment]] for a full list.
| |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr"> | | <span id="Window_Managers"></span> |
| ==== Window Managers ==== | | ==== 窗口管理器 ==== |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 设置 [[i3]]、[[Sway]]、[[Hyprland]] 或 [[xmonad]] 等轻量级或平铺式窗口管理器。 |
| Set up lightweight or tiling window managers like [[i3]], [[Sway]], [[Hyprland]], or [[xmonad]].
| |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 完整列表请参阅 [[:Category:Window managers]]。 |
| See [[:Category:Window managers]] for a full list.
| |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr"> | | <span id="Display_Managers_(Login_Managers)"></span> |
| ==== Display Managers (Login Managers) ==== | | ==== 显示管理器(登录管理器) ==== |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 配置图形会话管理器,例如 [[Gnome|GDM]]、[[KDE|SDDM]] 或 [[LightDM]]。 |
| Configure graphical session managers such as [[Gnome|GDM]], [[KDE|SDDM]], or [[LightDM]].
| |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr"> | | <span id="Audio_Setup"></span> |
| ==== Audio Setup ==== | | ==== 音频配置 ==== |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 启用并配置 [[:Category:Audio|音频]] 系统,例如 [[PipeWire]]、[[PulseAudio]] 或 [[ALSA]]。 |
| Enable and configure [[:Category:Audio|audio]] systems like [[PipeWire]], [[PulseAudio]], or [[ALSA]].
| |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr"> | | <span id="Network_Management"></span> |
| ==== Network Management ==== | | ==== 网络管理 ==== |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 使用诸如 [[NetworkManager]] 或 [[systemd-networkd]] 的工具来管理 [[Networking|网络]] 连接。 |
| Use tools such as [[NetworkManager]] or [[systemd-networkd]] for managing [[Networking|network]] connections.
| |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr"> | | <span id="Bluetooth_Support"></span> |
| ==== Bluetooth Support ==== | | ==== 蓝牙支持 ==== |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 使用 blueman 或其他工具配置与管理[[Bluetooth|蓝牙]]。 |
| Set up [[Bluetooth]] with blueman or other management tools.
| |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr"> | | <span id="Power_Management"></span> |
| ==== Power Management ==== | | ==== 电源管理 ==== |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 使用诸如 [[Laptop#tlp|tlp]] 或 [[systemd]] 服务等工具配置 [[laptop|笔记本]] 的 [[Power Management|电池管理]]、挂起与休眠。 |
| Configure [[laptop]] [[Power Management|battery management]], suspend, and hibernation with tools like [[Laptop#tlp|tlp]] or [[systemd]] services.
| |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr"> | | <div lang="en" dir="ltr" class="mw-content-ltr"> |
| Line 142: |
Line 100: |
| </div> | | </div> |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | 启用 [[Cups]] 以支持打印机,并使用诸如 Sane 的工具来支持 [[Scanners|扫描]] 设备。 |
| Enable [[Cups]] for printer support and tools like Sane for [[Scanners|scanning]] devices.
| |
| </div>
| |
|
| |
|
| <span id="Tips_and_tricks"></span> | | <span id="Tips_and_tricks"></span> |
| <div class="mw-translate-fuzzy">
| | == 提示和技巧 == |
| == 模块化你的配置 == | |
| </div>
| |
|
| |
|
| <span id="Modularizing_your_configuration_with_modules"></span> | | <span id="Modularizing_your_configuration_with_modules"></span> |
| <div class="mw-translate-fuzzy">
| | === 通过 NixOS 模块机制模块化你的配置 === |
| === 通过NixOS模块 === | |
| </div>
| |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| |
| {{main|NixOS system configuration#Modularizing your configuration with modules}} | | {{main|NixOS system configuration#Modularizing your configuration with modules}} |
| </div>
| |
|
| |
|
| <span id="See_also"></span> | | <span id="See_also"></span> |
| Line 167: |
Line 117: |
| </div> | | </div> |
|
| |
|
| <div lang="en" dir="ltr" class="mw-content-ltr">
| | [[Category:Desktop|分类:桌面]] |
| [[Category:Desktop]] | | [[Category:Guide|分类:指南]] |
| [[Category:Guide]] | | [[Category:NixOS|分类:NixOS]] |
| [[Category:NixOS]] | |
| </div>
| |