My NixOS configuration using home-manager and flakes
Inspired by https://github.com/librephoenix/nixos-config/
-
Download the minimal NixOS ISO image from https://nixos.org/download.html/nixos-iso
-
Boot into the NixOS installer
-
Run
sudo -i
to obtain root privileges -
If necessary, change the keyboard layout (e.g.
loadkeys de
) -
Now connect your machine with the internet
We are implementing following example parition layout:
Device | Size | Filesystem | Label |
---|---|---|---|
/dev/sda1 | 457G (free space left) | ext4 | nixos |
/dev/sda2 | 8G (size of your RAM) | swap | swap |
/dev/sda3 | 512M | fat32 | boot |
Create new gpt partition table
parted /dev/sda -- mklabel gpt
Create new root partition
parted /dev/sda -- mkpart root ext4 512MB -8GB
Create new swap partition
parted /dev/sda -- mkpart swap linux-swap -8GB 100%
Create new boot partition
parted /dev/sda -- mkpart ESP fat32 1MB 512MB
parted /dev/sda -- set 3 esp on
mkfs.ext4 -L nixos /dev/sda1
mkswap -L swap /dev/sda2
mkfs.fat -F 32 -n boot /dev/sda3
mount /dev/disk/by-label/nixos /mnt
mkdir -p /mnt/boot
mount /dev/disk/by-label/boot /mnt/boot
swapon /dev/disk/by-label/swap
Enable flakes on the live system and install git
mkdir -p ~/.config/nix/
echo experimental-features = nix-command flakes > ~/.config/nix/nix.conf
nix profile install nixpkgs#git
mkdir -p /mnt/home/user/
cd /mnt/home/user
Clone repository
git clone "https://github.com/MacKenzie779/nixos-config.git"
cd nixos-config
nano flake.nix
Generate hardware config for new system
nixos-generate-config --root /mnt --show-hardware-config > profiles/nixdesk/hardware-configuration.nix
git add .
Install base system
nixos-install --flake .#system
reboot
Login as root and set user password
passwd user
Exit as root and login as user in order to install the home-manager configuration
nix run home-manager/master --extra-experimental-features nix-command --extra-experimental-fetaures flakes -- switch --flake ./nixos-config#user
reboot