Creating a NixOS live CD/zh: Difference between revisions
Created page with "在模拟器中启动镜像:" |
Created page with "压缩使得构建过程变得缓慢。" |
||
| (8 intermediate revisions by the same user not shown) | |||
| Line 94: | Line 94: | ||
===SSH=== | ===SSH=== | ||
在 | 在你的 <tt>iso.nix</tt> 中添加: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
| Line 111: | Line 111: | ||
=== 静态 IP 地址=== | === 静态 IP 地址=== | ||
你可以直接在镜像中设置好静态IP地址。这对于在VPS上进行安装可能会很有帮助。 | |||
<syntaxhighlight lang="nix" line="1"> | <syntaxhighlight lang="nix" line="1"> | ||
| Line 134: | Line 132: | ||
=== 更快速的构建 === | === 更快速的构建 === | ||
构建过程缓慢的原因是压缩。 | |||
以下是<code>nix-build</code>使用的一些压缩方式的用时测试结果: | |||
{| class="wikitable" style="margin:auto" | {| class="wikitable" style="margin:auto" | ||
|+ | |+ 压缩测试结果 | ||
|- | |- | ||
! squashfsCompression !! | ! squashfsCompression !! 用时 !! 大小 | ||
|- | |- | ||
| <code>lz4</code> || 100s || 59% | | <code>lz4</code> || 100s || 59% | ||
| Line 156: | Line 149: | ||
| <code>xz -Xdict-size 100%</code> (default) || 450s || 43% | | <code>xz -Xdict-size 100%</code> (default) || 450s || 43% | ||
|} | |} | ||
<div lang="en" dir="ltr" class="mw-content-ltr"> | <div lang="en" dir="ltr" class="mw-content-ltr"> | ||
| Line 162: | Line 154: | ||
</div> | </div> | ||
如果你并不在意文件大小,可以在你的<code>iso.nix</code>中添加如下内容以使用更快的压缩方式: | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
| Line 176: | Line 165: | ||
== 另见 == | == 另见 == | ||
* [https://nixos.org/manual/nixos/stable/index.html#sec-building-image NixOS 手册: 构建一个 NixOS (Live) ISO]. | |||
* [https://nixos.org/manual/nixos/stable/index.html#sec-building-image NixOS | |||
[[Category:NixOS]] | [[Category:NixOS]] | ||
[[Category:Deployment]] | [[Category:Deployment]] | ||
[[Category:Cookbook]] | [[Category:Cookbook]] | ||