Creating a NixOS live CD: Difference between revisions
Make translatable Tags: Mobile edit Mobile web edit |
Marked this version for translation Tags: Mobile edit Mobile web edit |
||
| Line 1: | Line 1: | ||
<translate> | <translate> | ||
<!--T:1--> | |||
== Motivation == | == Motivation == | ||
Creating a modified NixOS LiveCD out of an existing working NixOS installation has a number of benefits: | Creating a modified NixOS LiveCD out of an existing working NixOS installation has a number of benefits: | ||
| Line 7: | Line 8: | ||
</translate> | </translate> | ||
<translate> | <translate> | ||
<!--T:2--> | |||
== Building == | == Building == | ||
Building minimal NixOS installation CD with the <code>nix-build</code> command by creating this <code>iso.nix</code>-file. In this example with [[Neovim]] preinstalled. | Building minimal NixOS installation CD with the <code>nix-build</code> command by creating this <code>iso.nix</code>-file. In this example with [[Neovim]] preinstalled. | ||
| Line 24: | Line 26: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<translate> | <translate> | ||
<!--T:3--> | |||
Build the image via: | Build the image via: | ||
</translate> | </translate> | ||
| Line 30: | Line 33: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<translate> | <translate> | ||
<!--T:4--> | |||
Alternatively, use Nix [[Flakes]] to generate a ISO installation image, using the <code>nixos-24.05</code> branch as nixpkgs source: | Alternatively, use Nix [[Flakes]] to generate a ISO installation image, using the <code>nixos-24.05</code> branch as nixpkgs source: | ||
</translate> | </translate> | ||
| Line 52: | Line 56: | ||
</nowiki>}} | </nowiki>}} | ||
<translate> | <translate> | ||
<!--T:5--> | |||
The following commands will generate the iso-image: | The following commands will generate the iso-image: | ||
</translate> | </translate> | ||
| Line 60: | Line 65: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<translate> | <translate> | ||
<!--T:6--> | |||
The resulting image can be found in <code>result</code>: | The resulting image can be found in <code>result</code>: | ||
</translate> | </translate> | ||
| Line 67: | Line 73: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<translate> | <translate> | ||
=== Testing the image === | === Testing the image === <!--T:7--> | ||
<!--T:8--> | |||
To inspect the contents of the ISO image: | To inspect the contents of the ISO image: | ||
</translate> | </translate> | ||
| Line 79: | Line 86: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<translate> | <translate> | ||
<!--T:9--> | |||
To boot the ISO image in an emulator: | To boot the ISO image in an emulator: | ||
</translate> | </translate> | ||
| Line 86: | Line 94: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<translate> | <translate> | ||
<!--T:10--> | |||
===SSH=== | ===SSH=== | ||
In your <tt>iso.nix</tt>: | In your <tt>iso.nix</tt>: | ||
| Line 101: | Line 110: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<translate> | <translate> | ||
===Static IP Address=== | ===Static IP Address=== <!--T:11--> | ||
<!--T:12--> | |||
Static IP addresses can be set in the image itself. This can be useful for VPS installation. | Static IP addresses can be set in the image itself. This can be useful for VPS installation. | ||
</translate> | </translate> | ||
| Line 121: | Line 131: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<translate> | <translate> | ||
<!--T:13--> | |||
=== Building faster === | === Building faster === | ||
The build process is slow because of compression. | The build process is slow because of compression. | ||
<!--T:14--> | |||
Here are some timings for <code>nix-build</code>: | Here are some timings for <code>nix-build</code>: | ||
</translate> | </translate> | ||
| Line 140: | Line 152: | ||
|} | |} | ||
<translate> | <translate> | ||
<!--T:15--> | |||
See also: [https://gist.github.com/baryluk/70a99b5f26df4671378dd05afef97fce mksquashfs benchmarks] | See also: [https://gist.github.com/baryluk/70a99b5f26df4671378dd05afef97fce mksquashfs benchmarks] | ||
<!--T:16--> | |||
If you don't care about file size, you can use a faster compression | If you don't care about file size, you can use a faster compression | ||
by adding this to your <code>iso.nix</code>: | by adding this to your <code>iso.nix</code>: | ||
| Line 151: | Line 165: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<translate> | <translate> | ||
<!--T:17--> | |||
==See also== | ==See also== | ||
* [https://nixos.org/manual/nixos/stable/index.html#sec-building-image NixOS Manual: Building a NixOS (Live) ISO]. | * [https://nixos.org/manual/nixos/stable/index.html#sec-building-image NixOS Manual: Building a NixOS (Live) ISO]. | ||
</translate> | </translate> | ||
<translate> | <translate> | ||
<!--T:18--> | |||
[[Category:NixOS]] | [[Category:NixOS]] | ||
[[Category:Deployment]] | [[Category:Deployment]] | ||
[[Category:Cookbook]] | [[Category:Cookbook]] | ||
</translate> | </translate> | ||