3.1 KiB
Installing
- Set up
- Partition the disk
- Format the partitions
- Mount the filesystems
- Create the host nix configuration
- Install nixos!
- Copy the ssh deploy key (again)
- Set up the user
Set up
If new host, follow Setting up a new host
Open a nix-shell with dependencies
nix-shell -p git
Obtain the flake
- Via git clone
git clone https://git.samfelag.xyz/marc/samfelag.git
- Via scp (in this case, from local to remote)
scp samfelag marc@remotehost:samfelag
Copy the host ssh key
Obtain the host ssh private key. You can decrypt it using gpg:
gpg -d secrets/ssh-keys/id_<host>.gpg > /etc/ssh/id_<host>
Copy the ssh keys to `/etc/ssh`
Partition the disk
We'll partition the disk in the follwing way:
- 512MB at the beginning for the boot partition
- 8GB at the end for swap
- The rest (at the middle) for the filesystem (/)
Locate the disk
lsblk
UEFI Boot
-
Create a GPT partition table
sudo parted /dev/nvme0n1 -- mklabel gpt -
Create the root partition
sudo parted /dev/nvme0n1 -- mkpart primary 512MB -8GB -
Create the swap partition
sudo parted /dev/nvme0n1 -- mkpart primary linux-swap -8GB 100% -
Create the boot partition
sudo parted /dev/nvme0n1 -- mkpart ESP fat32 1MB 512MB sudo parted /dev/nvme0n1 -- set 3 esp on
MBR boot
-
Create a MBR partition table
sudo parted /dev/vda -- mklabel msdos -
Create the root partition
sudo parted /dev/vda -- mkpart primary 1MiB -8GiB -
Create the swap partition
sudo parted /dev/vda -- mkpart primary linux-swap -8GiB 100%
Format the partitions
-
Root partition
sudo mkfs.ext4 -L nixos /dev/nvme0n1p1 -
Swap partition
sudo mkswap -L swap /dev/nvme0n1p2 -
Boot partition (if UEFI boot)
sudo mkfs.fat -F 32 -n BOOT /dev/nvme0n1p3
Mount the filesystems
-
Root partition
sudo mount /dev/disk/by-label/nixos /mnt -
Boot partition (if UEFI boot)
sudo mkdir -p /mnt/boot sudo mount /dev/disk/by-label/BOOT /mnt/boot -
Swap partition (if needed)
sudo swapon /dev/disk/by-label/swap
Create the host nix configuration
If the host is not present under system/hosts, create a new folder for the host. Check Setting up a new host for further documentation. Generate the hardware configuration file, you can use nixos-generate-config as a base:
nixos-generate-config --dir <<host directory>> --no-filesystems
Install nixos!
sudo nixos-install --impure --root /mnt --flake '.#reykjavik'
Copy the ssh deploy key (again)
cp ~/.ssh/id_<hostname> /mnt/home/marc/.ssh/id_<hostname>
Set up the user
You'll set the root password during the installation. You can then reboot and use the installed OS. First thing you'll have to do is log in as root and set the password for your user:
passwd marc