Creating a NixOS live CD/zh: Difference between revisions

Covalode (talk | contribs)
No edit summary
Covalode (talk | contribs)
Created page with "压缩使得构建过程变得缓慢。"
 
(7 intermediate revisions by the same user not shown)
Line 94: Line 94:
===SSH===
===SSH===


在你的 <tt>iso.nix</tt> 中:
在你的 <tt>iso.nix</tt> 中添加


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
Line 111: Line 111:
=== 静态 IP 地址===
=== 静态 IP 地址===


<div lang="en" dir="ltr" class="mw-content-ltr">
你可以直接在镜像中设置好静态IP地址。这对于在VPS上进行安装可能会很有帮助。
Static IP addresses can be set in the image itself. This can be useful for VPS installation.
</div>


<syntaxhighlight lang="nix" line="1">
<syntaxhighlight lang="nix" line="1">
Line 134: Line 132:
=== 更快速的构建 ===
=== 更快速的构建 ===


<div lang="en" dir="ltr" class="mw-content-ltr">
构建过程缓慢的原因是压缩。
The build process is slow because of compression.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
以下是<code>nix-build</code>使用的一些压缩方式的用时测试结果:
Here are some timings for <code>nix-build</code>:
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
{| class="wikitable" style="margin:auto"
{| class="wikitable" style="margin:auto"
|+ Compression results
|+ 压缩测试结果
|-
|-
! squashfsCompression !! Time !! Size
! 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>


<div lang="en" dir="ltr" class="mw-content-ltr">
<div lang="en" dir="ltr" class="mw-content-ltr">
Line 162: Line 154:
</div>
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
如果你并不在意文件大小,可以在你的<code>iso.nix</code>中添加如下内容以使用更快的压缩方式:
If you don't care about file size, you can use a faster compression
by adding this to your <code>iso.nix</code>:
</div>


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
Line 176: Line 165:
== 另见 ==
== 另见 ==


<div lang="en" dir="ltr" class="mw-content-ltr">
* [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 Manual: Building a NixOS (Live) ISO].
</div>


[[Category:NixOS]]
[[Category:NixOS]]
[[Category:Deployment]]
[[Category:Deployment]]
[[Category:Cookbook]]
[[Category:Cookbook]]