How to install NixOS on a Dell Precision 5530

After many, many attempts to install NixOS, I finally succeeded. Here are the steps I took to install NixOS on my Dell Precision 5530 laptop.

Let me immediately qualify that by saying that I had no real experience with mkfs, gdisk, cryptsetup, or similar before trying to install NixOS. I had been blissfully ignorant of those kinds of things due to the beginner-friendly nature of the Ubuntu installation process. So when I say “many, many attempts”, please keep in mind that I messed up on the basic tools here and probably would’ve had to use just as many attempts to install Arch Linux.

My goal here was to install NixOS and have the disk encrypted so that I could use it at work. Let’s jump straight into it.

Create a bootable USB drive

  1. Download the NixOS graphical live CD from here. The version I installed was version 20.03.
  2. Format your USB drive as a GPT and UEFI drive and load the .iso onto it. I used the Windows program Rufus on my other laptop (you know, the designated Civilization 5 laptop) to do this.

Here’s what the settings in Rufus looked like:
Screenshot of the Rufus settings

Prepare the Dell laptop

  1. Boot into BIOS.
  2. Disable secure boot.
  3. Make sure that the boot mode is UEFI.

Boot into the NixOS installer

  1. Insert the USB drive with NixOS into the Dell laptop.
  2. Start the laptop and hit F12 to open the boot menu.
  3. Select UEFI BOOT and your USB drive. To me the option said “UEFI: SanDisk, Partition 1”.
  4. Select the first option in the list (“NixOS 20.03.1619.ab3adfe1c76 Installer”).

To me, step 4 looked like this:

Screenshot of the NixOS boot options

  1. The Plasma display manager should open. Go to WIFI settings and connect to your network.
  2. Open Konsole to get a terminal, and execute sudo su to get superpowers.
  3. Verify that we’re in UEFI by executing: [ -d /sys/firmware/efi/efivars ] && echo "UEFI" || echo "fail". This should print “UEFI”.
  4. Execute lsblk to see which disks you have on the laptop. In my case, the disk I wanted to use was named /dev/nvme0n1. Before proceeding with the next steps, you should be 100% sure which disk you wish to use for NixOS, as what follows will format your system.

Create our file system

Now it’s time to use gdisk to setup our partitions.

  1. The first command to run is: gdisk /dev/nvme0n1
  2. Press o to create a new GPT partition table
  3. Press n to create a partition
    partition number: 1
    first sector: (just hit enter)
    last sector: write “+512M” and hit enter
    hex code: EF00
  4. Press n to create a partition
    partition number: 2
    first sector: (just hit enter)
    last sector: (just hit enter)
    hex code: 8E00
  5. Press w to write the changes

After step 5, this is what lsblk told me:

Screenshot of lsblk after gdisk

Setup encryption

  1. Format the partition: cryptsetup luksFormat /dev/nvme0n1p2 and select a password.
  2. Open the formatted partition: cryptsetup luksOpen /dev/nvme0n1p2 nvme0n1p2-crypt and enter the password that you chose.

After step 2, this is what lsblk told me:

Screenshot of lsblk after cryptsetup

Setup LVM within the encrypted partition

  1. Initiate a physical volume to be used by LVM: pvcreate /dev/mapper/nvme0n1p2-crypt
  2. Create a volume group: vgcreate vgnixos /dev/mapper/nvme0n1p2-crypt
  3. Create a swap volume: lvcreate -C y -L 10G -n swap vgnixos
  4. Create a volume for the rest of the space: lvcreate -l 100%FREE -n nixos vgnixos

After step 4, this is what lsblk told me:

Screenshot of lsblk after LVM

Actually create the file systems

  1. mkfs.vfat -n BOOT /dev/nvme0n1p1 to format the boot partition, giving it a label of “BOOT.”
  2. Make vgnixos-nixos an ext4 filesystem: mkfs.ext4 /dev/vgnixos/nixos
  3. Make swap: mkswap -L swap /dev/vgnixos/swap
  4. mount /dev/vgnixos/nixos /mnt
  5. mkdir /mnt/boot
  6. mount /dev/nvme0n1p1 /mnt/boot
  7. swapon /dev/vgnixos/swap
  8. Check the UUID of the LVM: lsblk -f

This is what lsblk -f told me:

Screenshot of lsblk -f

Here it’s important that you note the UUID of the “crypto_LUKS” disk. You will need to tell NixOS to use that disk by specifying the UUID later.

Create your NixOS configuration

  1. Generate nix config: nixos-generate-config --root /mnt
  2. Open the config: vi /mnt/etc/nixos/configuration.nix and update to match:
  imports =
    [ # Include the results of the hardware scan.

    # Use the systemd-boot EFI boot loader.
    boot.loader.systemd-boot.enable = true;
    boot.loader.efi.canTouchEfiCariables = true;
    boot.initrd.luks.devices = [
        device="/dev/disk/by-uuid/fcd53ef1-31ef-485e-a3e4-cc5b345c14c3"; # This is where you enter the UUID of the crypto_LUKS disk.

    networking.useDHCP = false;
    networking.interfaces.enp0s3.useDHCP = true;

    i18n.defaultLocale = "en_US.UTF-8";
    console = {
      font = "Lat2-Terminus16";
      keyMap = "no";

    time.timeZone = "Europe/Oslo";

    environment.systemPackages = with pkgs; [

    # Enable the OpenSSH daemon.
    service.openssh.enable = true;

    # Enable sound.
    sound.enable = true;
    hardware.pulseaudio.enable = true;

    # Enable the X11 windowing system.
    services.xserver.enable = true;
    services.xserver.layout = "no";
    services.xserver.xkbOptions = "eurosign:e";

    # Enable touchpad support
    services.xserver.libinput.enable = true;

    # Enable the KDE Desktop Environment.
    services.xserver.displayManager.sddm.enable = true;
    services.xserver.desktopManager.plasma5.enable = true;

    # Define a user account. Don't forget to set a password with `passwd`.
    users.users.stian = {
      isNormalUser = true;
      extraGroups = [ "wheel" ];

    system.stateVersion = "20.03";
  1. Finally, install NixOS by executing: nixos-install. After running for a while, the nixos-install command should complete successfully.
  2. Set a password for the user you created (“stian” in the example configuration above) by executing passwd stian and entering a password.
  3. Shut down the laptop, remove the USB drive, turn on the computer, and log in with your user.

Where to get help


I learned a lot from the following two blog posts:

  1. Part 1 - Installing NixOs
  2. Installing NixOS


comments powered by Disqus