disko
disko copied to clipboard
Bind mounts in make-disk-image
Currently make-disk-image only mounts the filesystems specified in disko's config. However, there might be other mounts specified in a nixosConfiguration that need to be mounted in order to build a valid VM image.
For my use case (XBOOTLDR partition), I need the following bind mounts to be available before nixos-install
installs the bootloader/kernel.
Mount commands
mkdir -p /mnt/efi/EFI/{Linux,nixos,shell}
mkdir -p /mnt/boot/EFI/{Linux,nixos,shell}
mkdir -p /mnt/{efi,boot}/loader/entries
mount --bind /mnt/boot/EFI/Linux /mnt/efi/EFI/Linux
mount --bind /mnt/boot/EFI/nixos /mnt/efi/EFI/nixos
mount --bind /mnt/boot/EFI/shell /mnt/efi/EFI/shell
mount --bind /mnt/boot/loader/entries /mnt/efi/loader/entries
I solved the issue by hardcoding these commands in make-disk-image's installer
but would prefer a more maintainable solution.
Ideally one would try to mount the remaining filesystems specified in the nixosConfiguration. However, that would require running or emulating parts of the stage1 script (mountFS
) which is probably too complex.
Would you be open for a PR that adds some pre-install commands configurable by the user? Or is there maybe a better solution?