NixOS Installation¶
Pre-Installation Guide
This guide assumes that you have followed the pre-installation guide.
-
Partition your disk using
cfdisk
or the tool of your preference, initialize the partitions with themkfs
command of the filesystem you want (mkswap
is for swap) and mount them under/mnt
.Note: You might want to leave a little part of your disk as a FAT32 partition to be able to transfer files easily between MacOS and Linux.
-
To connect to internet, you should load the firmware with these commands first:
sudo mkdir -p /lib/firmware/brcm sudo cp /mnt/boot/firmware/* /lib/firmware/brcm sudo modprobe -r brcmfmac && sudo modprobe brcmfmac
Then run
systemctl start wpa_supplicant
and then connect to internet usingwpa_cli
. When running the commands, don't forget to change/mnt/boot
to the place you mounted your ESP at (for example/mnt/boot/efi
). -
Generate your configuration using
sudo nixos-generate-config --root /mnt
. -
Edit
/mnt/etc/nixos/configuration.nix
:- Add
"${builtins.fetchGit { url = "https://github.com/kekrby/nixos-hardware.git"; }}/apple/t2"
toimports
. -
Copy the WiFi/Bluetooth firmware to
/mnt/etc/nixos/firmware/brcm
and add this snippet to yourconfiguration.nix
:hardware.firmware = [ (pkgs.stdenvNoCC.mkDerivation { name = "brcm-firmware"; buildCommand = '' dir="$out/lib/firmware" mkdir -p "$dir" cp -r ${./files/firmware}/* "$dir" ''; }) ];
-
Add a bootloader,
systemd-boot
works quite well. If you want to useGRUB
, don't forget to setboot.grub.efiInstallAsRemovable
,boot.grub.efiSupport
totrue
andboot.grub.device
to"nodev"
. - Run
sudo nixos-install
.
- Add
And the installation is complete! Note that you should probably transition to a more structured configuration using flakes, that is omitted here for brevity.