NixOS Installation Guide: Difference between revisions

Pigeon (talk | contribs)
m fix typo in #Custom_configuration
Ardenet (talk | contribs)
adjust translate tag's placement
Tags: Mobile edit Mobile web edit
Line 132: Line 132:
<!--T:45-->
<!--T:45-->
To partition the persistent storage run <code>sudo fdisk /dev/diskX</code> and follow instructions for MBR or (U)EFI. To determine which mode you are booted into, run:
To partition the persistent storage run <code>sudo fdisk /dev/diskX</code> and follow instructions for MBR or (U)EFI. To determine which mode you are booted into, run:
</translate>


<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
Line 137: Line 138:
</syntaxhighlight>
</syntaxhighlight>


 
<translate>
A very simple example setup is given here.
A very simple example setup is given here.


Line 175: Line 176:
=== Format partitions === <!--T:50-->
=== Format partitions === <!--T:50-->


<!--T:51-->
The example below uses the [[ext4]] filesystem format. If you wish to use other filesystem formats such as [[Btrfs]] or [[ZFS]]:  
The example below uses the [[ext4]] filesystem format. If you wish to use other filesystem formats such as [[Btrfs]] or [[ZFS]]:  


Line 183: Line 183:
* [[ZFS#Simple NixOS ZFS on root installation]]
* [[ZFS#Simple NixOS ZFS on root installation]]


This is useful for having multiple setups and makes partitions easier to handle<syntaxhighlight lang="console">
<!--T:51-->
This is useful for having multiple setups and makes partitions easier to handle
</translate>
 
<syntaxhighlight lang="console">
$ lsblk # lists current system block devices
$ lsblk # lists current system block devices
# mkfs.fat -F 32 -n boot /dev/sdX1
# mkfs.fat -F 32 -n boot /dev/sdX1
Line 192: Line 196:
</syntaxhighlight>
</syntaxhighlight>


<!--T:53-->
<translate>
== NixOS configuration ==
== NixOS configuration == <!--T:53-->


NixOS is configured through a [[Overview of the NixOS Linux distribution#Declarative Configuration|declarative configuration]] file. To generate a default config file, run [[nixos-generate-config]]:
NixOS is configured through a [[Overview of the NixOS Linux distribution#Declarative Configuration|declarative configuration]] file. To generate a default config file, run [[nixos-generate-config]]:
</translate>


<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
Line 202: Line 207:
</syntaxhighlight>
</syntaxhighlight>


<translate>
For information on working with a system configuration, see [[NixOS system configuration]]. For desktop-specific configurations, see [[NixOS as a desktop]].
For information on working with a system configuration, see [[NixOS system configuration]]. For desktop-specific configurations, see [[NixOS as a desktop]].


Line 214: Line 220:
The self-documenting NixOS options can be searched with [https://search.nixos.org/options NixOS options search].
The self-documenting NixOS options can be searched with [https://search.nixos.org/options NixOS options search].


<!--T:52-->
=== Swap file === <!--T:52-->
=== Swap file ===


For additional methods of configuring swap, see [[Swap]]. The following example demonstrates how to create and enable a [[Swap#Swap file|swap file]]:
For additional methods of configuring swap, see [[Swap]]. The following example demonstrates how to create and enable a [[Swap#Swap file|swap file]]:
</translate>


{{file|/mnt/etc/nixos/configuration.nix|nix|
{{file|/mnt/etc/nixos/configuration.nix|nix|
Line 228: Line 234:
}}
}}


<translate>
=== Bootloader ===
=== Bootloader ===


Line 233: Line 240:


Systemd-boot is the recommended bootloader. The following example demonstrates how to enable systemd-boot in your configuration:
Systemd-boot is the recommended bootloader. The following example demonstrates how to enable systemd-boot in your configuration:
</translate>


{{file|/mnt/etc/nixos/configuration.nix|nix|
{{file|/mnt/etc/nixos/configuration.nix|nix|
Line 240: Line 248:
}}
}}


<translate>
You may also wish to configure [[Secure Boot]].
You may also wish to configure [[Secure Boot]].


Line 245: Line 254:


For information on creating and managing users, see [[User management]] and the {{NixOS Manual|name=NixOS Manual: Chapter - Package Management|anchor=#sec-user-management}}. See an example below:
For information on creating and managing users, see [[User management]] and the {{NixOS Manual|name=NixOS Manual: Chapter - Package Management|anchor=#sec-user-management}}. See an example below:
</translate>


{{file|/mnt/etc/nixos/configuration.nix|nix|
{{file|/mnt/etc/nixos/configuration.nix|nix|
Line 255: Line 265:
}}
}}


== NixOS installation ==
<translate>
== NixOS installation == <!--T:56-->
</translate>
 
<syntaxhighlight lang="console">
<syntaxhighlight lang="console">
# cd /mnt
# cd /mnt
# nixos-install
# nixos-install
</syntaxhighlight>after installation: Run <code>passwd</code> to change user password.
</syntaxhighlight>
 
<translate>
after installation: Run <code>passwd</code> to change user password.


<!--T:57-->
<!--T:57-->
if internet broke/breaks, try one of the following:<syntaxhighlight lang="console">
if internet broke/breaks, try one of the following:
</translate>
 
<syntaxhighlight lang="console">
# nixos-rebuild switch --option substitute false # no downloads
# nixos-rebuild switch --option substitute false # no downloads
# nixos-rebuild switch --option binary-caches "" # no downloads
# nixos-rebuild switch --option binary-caches "" # no downloads
</syntaxhighlight>
</syntaxhighlight>
<translate>
<!--T:58-->
* wpa_supplicant flags to connect to wifi
* wpa_supplicant flags to connect to wifi
</translate>


<!--T:58-->
<hr />
<hr />


<translate>
== Additional notes for specific hardware == <!--T:59-->
== Additional notes for specific hardware == <!--T:59-->