Install
We follow the UEFI part of the official Installation Guide:
NixOS Installation Guide.
Prepare Disk
Partitioning
Partition the storage using sudo fdisk /dev/sdb. In the interactive prompt partition the storage those settings:
- 
g(gpt disk label)
- 
n
- 
1(partition number [1/128])
- 
2048first sector
- 
+500Mlast sector (boot sector size)
- 
t
- 
1(EFI System)
- 
n
- 
2
- default (fill up partition)
- default (fill up partition)
- 
w(write)
Delete all Files on partitions with:
dd if=/dev/zero of=/dev/sdb1 bs=4096 status=progress
dd if=/dev/zero of=/dev/sdb2 bs=4096 status=progress
Label partitions
Label the partitions using those commands:
sudo mkfs.fat -F 32 /dev/sda1
sudo fatlabel /dev/sda1 NIXBOOT
sudo mkfs.ext4 /dev/sda2 -L NIXROOT
Mount partitions
Mount the boot and root drives so we can access them and install NixOS:
sudo mount /dev/disk/by-label/NIXROOT /mnt
sudo mkdir -p /mnt/boot
sudo mount /dev/disk/by-label/NIXBOOT /mnt/boot
Create swap file
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
Install Nixos
Create NixOS config
Generate the config using sudo nixos-generate-config --root /mnt.
Then, edit the config using sudo vim /mnt/etc/nixos/configuration.nix.
Here are some sections of the configuration you should add:
  # Keyboard layout
  services.xserver.xkb.layout = "de";
  # Add a user!
  users.users.elias = {
    isNormalUser = true;
    extraGroups = [ "wheel" ]; # Sudo access
  };
  # Install an editor to edit the configuration
  environment.systemPackages = with pkgs; [ vim ]; # or vim!
To edit the hardware config, use sudo vim /mnt/etc/nixos/hardware-configuration.nix.
You can then update the file systems to use labels and add the swapfile.
  fileSystems."/" =
    { device = "/dev/disk/by-label/NIXROOT";
      # ...
    };
  fileSystems."/boot" =
    { device = "/dev/disk/by-label/NIXBOOT";
      # ...
    };
  swapDevices = [{
    device = "/.swapfile";
    size = 2048; # 2GB
  }];
Install
cd /mnt
sudo nixos-install
Change password with passwd to a password that works on de and en keyboard layout.
Reboot into the installed NixOs.
Add those lines to the configuration.nix file:
nix.settings.experimental-features = ["nix-command" "flakes" ];
networking.hostName = "eliasDesktop"; #or eiasLaptop for other configs
environment.systemPackages = with pkgs; [
  vim
  git
];
Rebuild the system with sudo nixos-rebuild switch and reboot to update the Hostname.
Copy the config repo with git clone https://github.com/4Lost/nixos-config and move it to /etc/nixos and rebuild with sudo nixos-rebuild switch.
Change github to ssh setting for pushing and pulling. Change the following lines in   to:
