NixOS Installation Guide/zh: Difference between revisions

Ardenet (talk | contribs)
Created page with "NixOS 通过 声明式配置 文件进行配置。要生成默认配置文件,请运行 Special:MyLanguage/nixos-generate-config:"
Ardenet (talk | contribs)
No edit summary
Line 139: Line 139:


<span id="Legacy_Boot_(MBR)"></span>
<span id="Legacy_Boot_(MBR)"></span>
<div class="mw-translate-fuzzy">
=== 传统启动(Legacy Boot, MBR)===
=== DOS ===
</div>


* o (dos硬盘标签)
* o (dos硬盘标签)
Line 177: Line 175:
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
以下示例使用 [[Special:MyLanguage/ext4|ext4]] 文件系统格式。如果您希望使用其他文件系统格式,例如 [[Special:MyLanguage/Btrfs|Btrfs]] [[Special:MyLanguage/ZFS|ZFS]]
The example below uses the [[ext4]] filesystem format. If you wish to use other filesystem formats such as [[Btrfs]] or [[ZFS]]:
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
* [[Special:MyLanguage/Bcachefs#NixOS installation on bcachefs|在 bcachefs 上安装 NixOS]]
* [[Bcachefs#NixOS installation on bcachefs]]
* [[Special:MyLanguage/Btrfs#Installation of NixOS on btrfs|在 btrfs 上安装 NixOS]]
* [[Btrfs#Installation of NixOS on btrfs]]
* [[Special:MyLanguage/LVM#Basic Setup|LVM 基础设置]]
* [[LVM#Basic Setup]]
* [[Special:MyLanguage/ZFS#Simple NixOS ZFS on root installation|Simple NixOS ZFS on root installation]]
* [[ZFS#Simple NixOS ZFS on root installation]]
</div>


<div class="mw-translate-fuzzy">
这对于有多个分区设置的情况很有用, 使分区更容易处理
这对于有多个分区设置的情况很有用, 使分区更容易处理<syntaxhighlight lang="console">
$ lsblk
$ sudo mkfs.fat -F 32 /dev/sdX1
$ sudo fatlabel /dev/sdX1 NIXBOOT
$ sudo mkfs.ext4 /dev/sdX2 -L NIXROOT
$ sudo mount /dev/disk/by-label/NIXROOT /mnt
$ sudo mkdir -p /mnt/boot
$ sudo mount /dev/disk/by-label/NIXBOOT /mnt/boot
</syntaxhighlight>
</div>


<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
Line 210: Line 194:


<span id="NixOS_configuration"></span>
<span id="NixOS_configuration"></span>
<div class="mw-translate-fuzzy">
== NixOS 配置 ==
== NixOS配置 ==
<syntaxhighlight lang="console">
$ sudo nixos-generate-config --root /mnt
$ cd /mnt/etc/nixos/
$ sudo vim configuration.nix
</syntaxhighlight>最重要的修改:
</div>


NixOS 通过 [[Special:MyLanguage/Overview of the NixOS Linux distribution#Declarative Configuration|声明式配置]] 文件进行配置。要生成默认配置文件,请运行 [[Special:MyLanguage/nixos-generate-config]]:
NixOS 通过 [[Special:MyLanguage/Overview of the NixOS Linux distribution#Declarative Configuration|声明式配置]] 文件进行配置。要生成默认配置文件,请运行 [[Special:MyLanguage/nixos-generate-config]]: