NixOS Installation Guide: Difference between revisions
mNo edit summary |
Add blocks for console commands |
||
Line 138: | Line 138: | ||
== Label partitions == | == Label partitions == | ||
This is useful for having multiple setups and makes partitions easier to handle | This is useful for having multiple setups and makes partitions easier to handle<syntaxhighlight lang="console"> | ||
$ lsblk | |||
$ sudo mkfs.fat -F 32 /dev/sdX1 | |||
$ sudo fatlabel /dev/sdX1 NIXBOOT | |||
$ sudo mkfs.ext4 /dev/sdX2 -L NIXROOT | |||
$ sudo mount /dev/disk/by-label/NIXROOT /mnt | |||
$ sudo mkdir -p /mnt/boot | |||
$ sudo mount /dev/disk/by-label/NIXBOOT /mnt/boot | |||
</syntaxhighlight> | |||
== Swap file == | == Swap file == | ||
<syntaxhighlight lang="console"> | |||
$ sudo dd if=/dev/zero of=/mnt/.swapfile bs=1024 count=2097152 (2GB size) | |||
$ sudo chmod 600 /mnt/.swapfile | |||
$ sudo mkswap /mnt/.swapfile | |||
$ sudo swapon /mnt/.swapfile | |||
</syntaxhighlight> | |||
== NixOS config == | == NixOS config == | ||
<syntaxhighlight lang="console"> | |||
$ sudo nixos-generate-config --root /mnt | |||
$ cd /mnt/etc/nixos/ | |||
Most essential changes: | $ sudo vim configuration.nix | ||
</syntaxhighlight>Most essential changes: | |||
* keyboard layout, ie <code>services.xserver.layout</code> | * keyboard layout, ie <code>[[Keyboard Layout Customization|services.xserver.xkb.layout]]</code> | ||
* <code>users.users.user</code> with adding entry <code>initialPassword = "pw123";</code> | * <code>users.users.user</code> with adding entry <code>initialPassword = "pw123";</code> | ||
* [[networking]] (wifi), see below for fix if it breaks | * [[networking]] (wifi), see below for fix if it breaks | ||
Line 169: | Line 173: | ||
== NixOS installation == | == NixOS installation == | ||
<syntaxhighlight lang="console"> | |||
$ cd /mnt | |||
$ sudo nixos-install | |||
</syntaxhighlight>after installation: Run <code>passwd</code> to change user password. | |||
if internet broke/breaks, try one of the following:<syntaxhighlight lang="console"> | |||
$ nixos-rebuild switch --option substitute false # no downloads | |||
$ nixos-rebuild switch --option binary-caches "" # no downloads | |||
</syntaxhighlight> | |||
if internet broke/breaks, try one of the following: | |||
* wpa_supplicant flags to connect to wifi | * wpa_supplicant flags to connect to wifi | ||
Line 187: | Line 191: | ||
* Blog post how to install NixOS on a [http://grahamc.com/blog/nixos-on-dell-9560 Dell 9560] | * Blog post how to install NixOS on a [http://grahamc.com/blog/nixos-on-dell-9560 Dell 9560] | ||
* Brand servers may require extra kernel modules be included into initrd (boot.initrd.extraKernelModules in configuration.nix) For example HP Proliant needs "hpsa" module to see the disk drive. | * Brand servers may require extra kernel modules be included into initrd (<code>boot.initrd.extraKernelModules</code> in configuration.nix) For example HP Proliant needs "hpsa" module to see the disk drive. | ||
[[Category:Guide]][[Category:Deployment]] | [[Category:Guide]][[Category:Deployment]] |