nixpkgs/nixos/lib
Graham Christensen 076f6e2d94 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
```
2021-08-25 10:42:35 -04:00
..
make-options-doc nixosOptionsDoc: add markdown formatting 2021-04-13 10:10:40 -07:00
test-driver nixos/test: some test fixes in succession of #125992 2021-08-20 13:38:22 -05:00
build-vms.nix nixosTest: Force system.nixos.revision constant 2021-06-21 11:08:26 -05:00
eval-config.nix Merge pull request #51850 from roberth/nixos-pure 2020-08-24 04:29:37 +02:00
from-env.nix
make-channel.nix Remove incorrect sentence from make-channel comment 2018-11-04 20:45:49 +01:00
make-disk-image.nix make-disk-image: Reduce forking 2021-06-21 22:58:07 -04:00
make-ext4-fs.nix nixos/lib/make-ext4-fs: Fix: `resize2fs -M' can leave insufficient slack 2021-05-31 21:35:51 +02:00
make-iso9660-image.nix nixos: use nativeBuildInputs in make- iso9660-image and system-tarball 2020-11-18 14:05:30 +01:00
make-iso9660-image.sh make-iso9660-image: produce stable GPT disk GUID 2020-07-20 11:16:59 +02:00
make-squashfs.nix squashfs: use -no-hardlinks for reproducible squashfs images (#114454) 2021-02-28 18:03:50 +00:00
make-system-tarball.nix nixos: use nativeBuildInputs in make- iso9660-image and system-tarball 2020-11-18 14:05:30 +01:00
make-system-tarball.sh use closure-info for building system tarball 2018-11-07 12:52:53 +08:00
make-zfs-image.nix nixos/make-zfs-image: init 2021-08-25 10:42:35 -04:00
qemu-flags.nix nixos/qemu-flags: add ppc64 2021-03-05 01:57:54 -08:00
testing-python.nix nixos/tests/test-driver: better control test env symbols 2021-08-19 23:55:26 -05:00
utils.nix treewide: runCommandNoCC -> runCommand 2021-08-15 17:36:41 +02:00