content: Add note for installing NixOS on Btrfs
Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
parent
e6864e2ef8
commit
5d36524561
79
content/nixos-btrfs.md
Normal file
79
content/nixos-btrfs.md
Normal file
|
@ -0,0 +1,79 @@
|
|||
---
|
||||
title: nixos btrfs install guide
|
||||
date: 2023-10-14T00:15:29+02:00
|
||||
---
|
||||
|
||||
## BIOS, single partition (for VMs)
|
||||
|
||||
### first, create a new MBR partition table and a single partition
|
||||
|
||||
```shell {lineanchors=list}
|
||||
$ fdisk /dev/vdX
|
||||
fdisk> o
|
||||
fdisk> n
|
||||
# enter, enter, enter, enter
|
||||
# primary partition, number 1, from sector 2048 to end
|
||||
fdisk> w
|
||||
```
|
||||
|
||||
### create a new Btrfs on the new partition
|
||||
|
||||
```shell {lineanchors=list}
|
||||
$ mkfs.btrfs -L nixos /dev/vdX1
|
||||
```
|
||||
|
||||
### create all the subvolumes
|
||||
|
||||
```shell {lineanchors=list}
|
||||
$ mount /dev/vdX1 /mnt
|
||||
$ btrfs subvolume create /mnt/@
|
||||
$ btrfs subv cr /mnt/@boot
|
||||
$ btrfs subv cr /mnt/@home
|
||||
$ btrfs subv cr /mnt/@nix
|
||||
$ btrfs subv cr /mnt/@log
|
||||
$ umount /mnt
|
||||
```
|
||||
|
||||
### Mount the Btrfs again, now properly with the subvolumes
|
||||
|
||||
```shell {lineanchors=list}
|
||||
$ mount -o noatime,subvol=@ /dev/disk/by-uuid/<uuid> /mnt
|
||||
$ mkdir -p /mnt/{boot,home,nix,var/log}
|
||||
$ mount -o noatime,subvol=@boot /dev/disk/by-uuid/<uuid> /mnt/boot
|
||||
$ mount -o subvol=@home /dev/disk/by-uuid/<uuid> /mnt/home
|
||||
$ mount -o noatime,compress=zstd,subvol=@nix /dev/disk/by-uuid/<uuid> /mnt/nix
|
||||
$ mount -o noatime,compress=zstd,subvol=@log /dev/disk/by-uuid/<uuid> /mnt/var/log
|
||||
```
|
||||
|
||||
## rest of the installation
|
||||
|
||||
### generate the initial NixOS system config
|
||||
|
||||
```shell {lineanchors=list}
|
||||
$ nixos-generate-config --root /mnt
|
||||
```
|
||||
|
||||
### review & modify system config
|
||||
|
||||
Here one should set the root password and enable SSH access, at least.
|
||||
Other things can be changed as necessary.
|
||||
|
||||
Don't forget to set `services.openssh.settings.PermitRootLogin = "yes";`!
|
||||
|
||||
```shell {lineanchors=list}
|
||||
$ vim /mnt/etc/nixos/configuration.nix
|
||||
$ vim /mnt/etc/nixos/hardware-configuration.nix
|
||||
```
|
||||
|
||||
### complete the installation
|
||||
|
||||
```shell {lineanchors=list}
|
||||
$ cd /mnt
|
||||
$ nixos-install
|
||||
```
|
||||
|
||||
### perform the first deployment after the install using morph
|
||||
|
||||
```shell {lineanchors=list}
|
||||
$ SSH_USER=root morph deploy --passwd --on <host> ./default.nix switch
|
||||
```
|
Loading…
Reference in a new issue