nixos-config/modules
2020-12-11 10:24:07 +01:00
..
default Basic configuration for new servers and start modularizing config 2020-12-01 19:23:28 +01:00
nix Rework common profile into module system 2020-12-05 13:44:29 +01:00
ssh Basic configuration for new servers and start modularizing config 2020-12-01 19:23:28 +01:00
sshd 🔒 Secret 🔒 2020-12-02 10:12:55 +01:00
tmux Rework common profile into module system 2020-12-05 13:44:29 +01:00
bluetooth.nix Rework common profile into module system 2020-12-05 13:44:29 +01:00
default.nix Rework common profile into module system 2020-12-05 13:44:29 +01:00
docker.nix Basic configuration for new servers and start modularizing config 2020-12-01 19:23:28 +01:00
eid.nix Rework common profile into module system 2020-12-05 13:44:29 +01:00
git.nix Basic configuration for new servers and start modularizing config 2020-12-01 19:23:28 +01:00
global-mailer.nix Rework common profile into module system 2020-12-05 13:44:29 +01:00
neovim.nix Rework common profile into module system 2020-12-05 13:44:29 +01:00
nginx.nix Basic configuration for new servers and start modularizing config 2020-12-01 19:23:28 +01:00
nix.nix Use recursiveUpdate instead of // 2020-12-05 21:37:11 +01:00
ovh.nix Basic configuration for new servers and start modularizing config 2020-12-01 19:23:28 +01:00
README.md Add some instructions on how to set-up ZFS for use with the custom module 2020-05-23 10:46:18 +02:00
smartd.nix Rework common profile into module system 2020-12-05 13:44:29 +01:00
ssh.nix Basic configuration for new servers and start modularizing config 2020-12-01 19:23:28 +01:00
sshd.nix Basic configuration for new servers and start modularizing config 2020-12-01 19:23:28 +01:00
syncthing-server.nix Basic configuration for new servers and start modularizing config 2020-12-01 19:23:28 +01:00
tmux.nix Rework common profile into module system 2020-12-05 13:44:29 +01:00
zfs.nix Fix rolling back to blank root snapshot on servers 2020-12-11 10:24:07 +01:00
zsh.nix Rework common profile into module system 2020-12-05 13:44:29 +01:00

Setting up ZFS

  1. Create three partitions:

    • Boot
    • Swap
    • ZFS

    For example:

    sgdisk -n 0:0:+512MiB -t 0:EF00 -c 0:boot $DISK
    sgdisk -n 0:0:+32GiB -t 0:8200 -c 0:swap $DISK
    sgdisk -n 0:0:0 -t 0:BF01 -c 0:ZFS $DISK
    
  2. Configure swap and boot as usual.

  3. Create ZPool:

    zpool create -O mountpoint=none -O encryption=aes-256-gcm -O keyformat=passphrase rpool $ZFS_PART
    

    Leave out -O encryption=aes-256-gcm -O keyformat=passphrase if you don't want to fully encrypt the ZFS partition.

  4. Create datasets:

    zfs create -o mountpoint=legacy rpool/local/root
    zfs snapshot rpool/local/root@blank
    zfs create -o mountpoint=legacy rpool/local/nix
    zfs set compression=lz4 rpool/local/nix
    zfs create -o mountpoint=legacy rpool/local/cache
    zfs set compression=lz4 rpool/local/cache
    zfs create -o mountpoint=legacy rpool/safe/data
    zfs set compression=lz4 rpool/local/data
    
  5. Mount datasets:

    mount -t zfs rpool/local/root /mnt
    mkdir /mnt/nix
    mount -t zfs rpool/local/nix /mnt/nix
    mkdir /mnt/boot
    mount $BOOT_PART /mnt/boot
    mkdir /mnt/cache
    mount -t zfs rpool/local/cache /mnt/cache
    mkdir /mnt/data
    mount -t zfs rpool/safe/data /mnt/data
    
  6. Configure Host ID

    Set networking.hostid in the nixos config to head -c 8 /etc/machine-id.