Installation
+
+
+
+
+Obtaining NixOS
+
+NixOS ISO images can be downloaded from the NixOS
+homepage. These can be burned onto a CD. It is also possible
+to copy them onto a USB stick and install NixOS from there. For
+details, see the NixOS
+Wiki.
+
+
+
+
@@ -21,8 +38,8 @@
ifconfig). Networking is necessary for the
installer, since it will download lots of stuff (such as source
tarballs or Nixpkgs channel binaries). It’s best if you have a DHCP
- server on your network. Otherwise configure
- manually.
+ server on your network. Otherwise configure networking manually
+ using ifconfig.
The NixOS manual is available on virtual console 8
(press Alt+F8 to access).
@@ -30,6 +47,9 @@
Login as root, empty
password.
+ If you downloaded the graphical ISO image, you can
+ run start xserver to start KDE.
+
The NixOS installer doesn’t do any partitioning or
formatting yet, so you need to that yourself. Use the following
commands:
@@ -39,12 +59,9 @@
For partitioning:
fdisk.
- For initialising Ext2/Ext3 partitions:
- mke2fs. Ext3 is recommended; use the
- to create a journalled file system. For
- faster access to the Nix store, you may also want to use the
- . It is also recommended that you
- assign a unique symbolic label to the file system using the option
+ For initialising Ext4 partitions:
+ mkfs.ext4. It is recommended that you assign a
+ unique symbolic label to the file system using the option
. This will
make the file system configuration independent from device
changes.
@@ -62,43 +79,42 @@ $ vgcreate MyVolGroup /dev/sda1 /dev/sdb1
$ lvcreate --size 2G --name bigdisk MyVolGroup
$ lvcreate --size 1G --name smalldisk MyVolGroup
- Possibly you’ll need to do initctl start
- lvm after this (TODO: check whether this is
- needed).
+
- For creating software RAID devices:
+ For creating software RAID devices, use
mdadm.
- Mount the target file system on
- /mnt on which NixOS would be installed.
-
+ Mount the target file system on which NixOS should
+ be installed on /mnt.
- Generate a template configuration for the target system:
-
- The command nixos-option can
- generate an initial configuration file for you, i.e.,
+ You now need to create a file
+ /mnt/etc/nixos/configuration.nix that
+ specifies the intended configuration of the system. This is
+ because NixOS has a declarative configuration
+ model: you create or edit a description of the configuration that
+ you want to be built and activated, and then NixOS takes care of
+ realising that configuration. The command
+ nixos-option can generate an initial
+ configuration file for you:
$ nixos-option --install
- It tries to figure out the modules necessary for mounting the root
- device, as well as various other hardware characteristics.
- However, it doesn’t try to figure out the
+ It tries to figure out the kernel modules necessary for mounting
+ the root device, as well as various other hardware
+ characteristics. However, it doesn’t try to figure out the
option yet.
- Edit /mnt/etc/nixos/configuration.nix to
- configure your system. The installation is declarative; you need to
- write a description of the configuration that you want to be built and
- activated. The configuration is specified in a Nix expression and must
- be stored on the target file system. The text
- editors nano and vim are
- available.
+ You should edit
+ /mnt/etc/nixos/configuration.nix to suit your
+ needs. The text editors nano and
+ vim are available.You need to specify a root file system in
and the target device for the Grub boot
@@ -110,26 +126,26 @@ $ nixos-option --install
all kernel modules that
are necessary for mounting the root file system, otherwise the
installed system will not be able to boot. (If this happens, boot
- from CD again, mount the target file system on
+ from the CD again, mount the target file system on
/mnt, fix
/mnt/etc/nixos/configuration.nix and rerun
- nixos-install.)
- nixos-hardware-scan should figure out the
- required modules in most cases.
+ nixos-install.) In most cases,
+ nixos-option --install will figure out the
+ required modules.
- Examples are available in
- /etc/nixos/nixos/doc/config-examples and some
- actual NixOS configuration can be found at Examples of real-world NixOS configuration files can be
+ found at .
-
+
If your machine has a limited amount of memory, you
may want to activate swap devices now (swapon
device). The installer (or
rather, the build actions that it may spawn) may need quite a bit of
RAM, depending on your configuration.
+
Do the installation:
@@ -145,7 +162,7 @@ $ nixos-install
Cross fingers.
- If everything went well:
+ If everything went well:
$ reboot
@@ -159,7 +176,7 @@ $ reboot
configurations (initially just one). Every time you
change the NixOS configuration (see ), a new item appears in the menu.
- This allows you to go back easily to another configuration if
+ This allows you to easily roll back to another configuration if
something goes wrong.You should log in and change the root
@@ -192,10 +209,8 @@ $ nix-env -i w3m
shows a typical sequence
of commands for installing NixOS on an empty hard drive (here
-/dev/sda). shows a
-corresponding configuration Nix expression.
-
-
+/dev/sda). shows a
+corresponding configuration Nix expression.Commands for installing NixOS on /dev/sda