Creating a NixOS live CD/zh: Difference between revisions

Covalode (talk | contribs)
Created page with "以下是<code>nix-build</code>使用的一些压缩方式的用时测试结果:"
Covalode (talk | contribs)
Created page with "压缩使得构建过程变得缓慢。"
 
(4 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 132: Line 132:
=== 更快速的构建 ===
=== 更快速的构建 ===


压缩使得构建过程变得缓慢。
构建过程缓慢的原因是压缩


以下是<code>nix-build</code>使用的一些压缩方式的用时测试结果:
以下是<code>nix-build</code>使用的一些压缩方式的用时测试结果:


<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 150: 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 156: 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 170: 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]]