Home Explore Blog Models CI



nixpkgs

3rd chunk of `nixos/doc/manual/installation/installing.chapter.md`
f39ca0c7514abbf85c55f7790c6f896cefd4a7990c0ed91d0000000100000fb2
To install over a serial port connect with `115200n8` (e.g.
`picocom -b 115200 /dev/ttyUSB0`). When the bootloader lists boot
entries, select the serial console boot entry.

### Networking in the installer {#sec-installation-manual-networking}
[]{#sec-installation-booting-networking} <!-- legacy anchor -->

The boot process should have brought up networking (check `ip
a`). 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 networking manually using `ip`.

You can configure the network, Wi-Fi included, through NetworkManager.
Using the `nmtui` program, you can do so even in a non-graphical session.
 If you prefer to configure the network manually, disable NetworkManager with
`systemctl stop NetworkManager`.

If you would like to continue the installation from a different machine
you can use activated SSH daemon. You need to copy your ssh key to
either `/home/nixos/.ssh/authorized_keys` or
`/root/.ssh/authorized_keys` (Tip: For installers with a modifiable
filesystem such as the sd-card installer image a key can be manually
placed by mounting the image on a different machine). Alternatively you
must set a password for either `root` or `nixos` with `passwd` to be
able to login.

### Partitioning and formatting {#sec-installation-manual-partitioning}
[]{#sec-installation-partitioning} <!-- legacy anchor -->

The NixOS installer doesn't do any partitioning or formatting, so you
need to do that yourself.

The NixOS installer ships with multiple partitioning tools. The examples
below use `parted`, but also provides `fdisk`, `gdisk`, `cfdisk`, and
`cgdisk`.

Use the command 'lsblk' to find the name of your 'disk' device.

The recommended partition scheme differs depending if the computer uses
*Legacy Boot* or *UEFI*.

#### UEFI (GPT) {#sec-installation-manual-partitioning-UEFI}
[]{#sec-installation-partitioning-UEFI} <!-- legacy anchor -->

Here's an example partition scheme for UEFI, using `/dev/sda` as the
device.

::: {.note}
You can safely ignore `parted`'s informational message about needing to
update /etc/fstab.
:::

1.  Create a *GPT* partition table.

    ```ShellSession
    # parted /dev/sda -- mklabel gpt
    ```

2.  Add the *root* partition. This will fill the disk except for the end
    part, where the swap will live, and the space left in front (512MiB)
    which will be used by the boot partition.

    ```ShellSession
    # parted /dev/sda -- mkpart root ext4 512MB -8GB
    ```

3.  Next, add a *swap* partition. The size required will vary according
    to needs, here a 8GB one is created.

    ```ShellSession
    # parted /dev/sda -- mkpart swap linux-swap -8GB 100%
    ```

    ::: {.note}
    The swap partition size rules are no different than for other Linux
    distributions.
    :::

4.  Finally, the *boot* partition. NixOS by default uses the ESP (EFI
    system partition) as its */boot* partition. It uses the initially
    reserved 512MiB at the start of the disk.

    ```ShellSession
    # parted /dev/sda -- mkpart ESP fat32 1MB 512MB
    # parted /dev/sda -- set 3 esp on
    ```
    ::: {.note}
    In case you decided to not create a swap partition, replace `3` by `2`. To be sure of the id number of ESP, run `parted --list`.
    :::

Once complete, you can follow with
[](#sec-installation-manual-partitioning-formatting).

#### Legacy Boot (MBR) {#sec-installation-manual-partitioning-MBR}
[]{#sec-installation-partitioning-MBR} <!-- legacy anchor -->

Here's an example partition scheme for Legacy Boot, using `/dev/sda` as
the device.

::: {.note}
You can safely ignore `parted`'s informational message about needing to
update /etc/fstab.
:::

1.  Create a *MBR* partition table.

    ```ShellSession
    # parted /dev/sda -- mklabel msdos
    ```

2.  Add the *root* partition. This will fill the the disk except for the
    end part, where the swap will live.

    ```ShellSession

Title: NixOS Manual Installation: Networking and Disk Partitioning
Summary
This chunk details advanced aspects of NixOS manual installation, starting with instructions for connecting via a serial port. It then covers networking within the installer, emphasizing its necessity for downloading components, and explaining how to verify (`ip a`), configure (DHCP, `ip` command, `nmtui`), or disable NetworkManager. The text also outlines enabling SSH for remote installation by managing authorized keys or setting passwords. The bulk of the chunk focuses on manual disk partitioning and formatting, providing a list of available tools (`parted`, `fdisk`, `gdisk`, `cfdisk`, `cgdisk`) and instructing users to identify their disk with `lsblk`. It offers specific `parted` examples for UEFI (GPT) systems, detailing the creation of GPT, root, swap, and ESP partitions, and begins to outline the process for Legacy Boot (MBR) systems by demonstrating how to create an MBR partition table and a root partition.