summary refs log tree commit diff
path: root/nixos/modules/virtualisation/amazon-options.nix
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2021-08-25 09:38:37 -0400
committerGraham Christensen <graham@grahamc.com>2021-08-25 10:42:35 -0400
commit076f6e2d948259e18ddac8e562c62b5b53de9fe6 (patch)
treec4d47ce76422559b64c8f3e096dc3cff63382d32 /nixos/modules/virtualisation/amazon-options.nix
parentf8737848af51ecfa6b959cd22fe61191577228e8 (diff)
downloadnixpkgs-076f6e2d948259e18ddac8e562c62b5b53de9fe6.tar
nixpkgs-076f6e2d948259e18ddac8e562c62b5b53de9fe6.tar.gz
nixpkgs-076f6e2d948259e18ddac8e562c62b5b53de9fe6.tar.bz2
nixpkgs-076f6e2d948259e18ddac8e562c62b5b53de9fe6.tar.lz
nixpkgs-076f6e2d948259e18ddac8e562c62b5b53de9fe6.tar.xz
nixpkgs-076f6e2d948259e18ddac8e562c62b5b53de9fe6.tar.zst
nixpkgs-076f6e2d948259e18ddac8e562c62b5b53de9fe6.zip
nixos/make-zfs-image: init
This is a private interface for internal NixOS  use. It is similar
to `make-disk-image` except it is much more opinionated about what
kind of disk image it'll make.

Specifically, it will always create *two* disks:

1. a `boot` disk formatted with FAT in a hybrid GPT mode.
2. a `root` disk which is completely owned by a single zpool.

The partitioning and FAT decisions should make the resulting images
bootable under EFI or BIOS, with systemd-boot or grub.

The root disk's zpools options are highly customizable, including
fully customizable datasets and their options.

Because the boot disk and partition are highly opinionated, it is
expected that the `boot` disk will be mounted at `/boot`. It is
always labeled ESP even on BIOS boot systems.

In order for the datasets to be mounted properly, the `datasets`
passed in to `make-zfs-image` are turned in to NixOS configuration
stored at /etc/nixos/configuration.nix inside the VM.
NOTE: The function accepts a system configuration in the `config`
argument. The *caller* must manually configure the system
in `config` to have each specified `dataset` be represented
by a corresponding `fileSystems` entry.

One way to test the resulting images is with qemu:

```sh
boot=$(find ./result/ -name '*.boot.*');
root=$(find ./result/ -name '*.root.*');

echo '`Ctrl-a h` to get help on the monitor';
echo '`Ctrl-a x` to exit';

qemu-kvm \
    -nographic \
    -cpu max \
    -m 16G \
    -drive file=$boot,snapshot=on,index=0,media=disk \
    -drive file=$root,snapshot=on,index=1,media=disk \
    -boot c \
    -net user \
    -net nic \
    -msg timestamp=on
```
Diffstat (limited to 'nixos/modules/virtualisation/amazon-options.nix')
0 files changed, 0 insertions, 0 deletions