Home Explore Blog CI



nixpkgs

8th chunk of `nixos/doc/manual/installation/installing.chapter.md`
b616aaf204de8f85399b8e3d41da5bd939ad56c8e3a570440000000100000d1a
7.  You should now be able to boot into the installed NixOS. The GRUB
    boot menu shows a list of *available configurations* (initially just
    one). Every time you change the NixOS configuration (see [Changing
    Configuration](#sec-changing-config)), a new item is added to the
    menu. This allows you to easily roll back to a previous
    configuration if something goes wrong.

    Use your declared user account to log in.
    If you didn’t declare one, you should still be able to log in using the `root` user.

    ::: {.note}
    Some graphical display managers such as SDDM do not allow `root` login by default, so you might need to switch to TTY.
    Refer to [](#sec-user-management) for details on declaring user accounts.
    :::

    You may also want to install some software. This will be covered in
    [](#sec-package-management).

### Installation summary {#sec-installation-manual-summary}
[]{#sec-installation-summary} <!-- legacy anchor -->

To summarise, [Example: Commands for Installing NixOS on `/dev/sda`](#ex-install-sequence)
shows a typical sequence of commands for installing NixOS on an empty hard
drive (here `/dev/sda`). [Example: NixOS Configuration](#ex-config) shows a
corresponding configuration Nix expression.

::: {#ex-partition-scheme-MBR .example}
### Example partition schemes for NixOS on `/dev/sda` (MBR)
```ShellSession
# parted /dev/sda -- mklabel msdos
# parted /dev/sda -- mkpart primary 1MB -8GB
# parted /dev/sda -- mkpart primary linux-swap -8GB 100%
```
:::

::: {#ex-partition-scheme-UEFI .example}
### Example partition schemes for NixOS on `/dev/sda` (UEFI)
```ShellSession
# parted /dev/sda -- mklabel gpt
# parted /dev/sda -- mkpart root ext4 512MB -8GB
# parted /dev/sda -- mkpart swap linux-swap -8GB 100%
# parted /dev/sda -- mkpart ESP fat32 1MB 512MB
# parted /dev/sda -- set 3 esp on
```
:::

::: {#ex-install-sequence .example}
### Commands for Installing NixOS on `/dev/sda`

With a partitioned disk.

```ShellSession
# mkfs.ext4 -L nixos /dev/sda1
# mkswap -L swap /dev/sda2
# swapon /dev/sda2
# mkfs.fat -F 32 -n boot /dev/sda3        # (for UEFI systems only)
# mount /dev/disk/by-label/nixos /mnt
# mkdir -p /mnt/boot                      # (for UEFI systems only)
# mount -o umask=077 /dev/disk/by-label/boot /mnt/boot # (for UEFI systems only)
# nixos-generate-config --root /mnt
# nano /mnt/etc/nixos/configuration.nix
# nixos-install
# reboot
```
:::

::: {#ex-config .example}
### Example: NixOS Configuration
```ShellSession
{ config, pkgs, ... }: {
  imports = [
    # Include the results of the hardware scan.
    ./hardware-configuration.nix
  ];

  boot.loader.grub.device = "/dev/sda";   # (for BIOS systems only)
  boot.loader.systemd-boot.enable = true; # (for UEFI systems only)

  # Note: setting fileSystems is generally not
  # necessary, since nixos-generate-config figures them out
  # automatically in hardware-configuration.nix.
  #fileSystems."/".device = "/dev/disk/by-label/nixos";

  # Enable the OpenSSH server.
  services.sshd.enable = true;
}
```
:::

## Additional installation notes {#sec-installation-additional-notes}

```{=include=} sections
installing-usb.section.md
installing-pxe.section.md
installing-kexec.section.md
installing-virtualbox-guest.section.md
installing-from-other-distro.section.md
installing-behind-a-proxy.section.md
```

Title: Installation Summary, Example Partition Schemes, and Additional Installation Notes
Summary
This section summarizes the NixOS installation process and presents example partition schemes for MBR and UEFI systems on `/dev/sda`, along with example commands for installing NixOS and a corresponding configuration. It also lists additional notes covering topics such as installing from USB, PXE, kexec, as a VirtualBox guest, from another distro, and behind a proxy.