The quirks of installing NixOS on Lily.
1. Prerequisites
Default NixOS ISO image doesn't come with a driver for the Broadcom BCM43142 Wi-Fi adapter. Either install NixOS with a temporary wired ethernet connection to skip all the hassle, or build a custom NixOS ISO with the necessary drivers.
To build an ISO image with an additional driver in the installer, first install Nix on your machine. You may alternatively use a Docker container.
docker run -ti nixos/nix
Once you have Nix ready, first fetch nixpkgs.
$ git clone https://github.com/NixOS/nixpkgs.git --depth 1 $ cd nixpkgs/nixos
Create the following file at modules/installer/cd-dvd/installation-cd-minimal-wifi.nix:
{ config, ... }:
{
imports = [ ./installation-cd-minimal.nix ];
boot.kernelModules = [ "wl" ];
boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
networking.wireless.enable = false;
networking.networkmanager.enable = true;
}
Then build it.
$ export NIXPKGS_ALLOW_UNFREE=1 $ nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-minimal-wifi.nix default.nix
Once the ISO is ready, the command should output its location. If you're running Nix via Docker, get the container id with docker ps and copy the ISO from the container.
docker cp <CONTAINER_ID>:result/iso/*.iso .
2. Installing
The rest of the process is a pretty standard NixOS installation.
First of all, switch to superuser with sudo -i. If you're not on a wired ethernet connection at this point, use nmtui to connect to the Wi-Fi.
Lily should already be set to Legacy Boot in the BIOS. Create the MBR partition table and add the root and swap partitions. You can safely ignore parted's messages about needing to update /etc/fstab. It's also probably going to complain about the swap partition not being properly aligned for best performance.
# parted /dev/sda -- mklabel msdos # parted /dev/sda -- mkpart primary 1MiB -8GiB # parted /dev/sda -- set 1 boot on # parted /dev/sda -- mkpart primary linux-swap -8GiB 100%
Initialize the partitions. If there's already a file system there, just overwrite it.
# mkfs.ext4 -L nixos /dev/sda1 # mkswap -L swap /dev/sda2
Mount the target file system on which NixOS should be installed on /mnt.
mount /dev/disk/by-label/nixos /mnt
Activate swap devices.
swapon /dev/sda2
At this point the configuration may be copied to /mnt/etc/nixos/configuration.nix. Run nixos-install and, if everything went well, reboot. If rebooting complains about systemd, just press the power button.