How would I use ZFSBootMenu with NixOS?

ZFSBootMenu is a ZFS-compatible bootloader (GitHub - zbm-dev/zfsbootmenu: ZFS Bootloader for root-on-ZFS systems with support for snapshots and native full disk encryption). In the words of Ina Garten, how bad can that be? Yes, it’s a cool little gem that does away with the hell that is GRUB compatibility with ZFS, and it’s lovely with rEFInd. Unlike systemd-boot and GRUB without compat, it doesn’t need to copy kernels because it can read from the ZFS pool.

That said, I’m not an expert and would love to know the best path toward using it on Nix. Is the answer ultimately a flake with options for its configuration? Presently, only Void Linux and Debian users are using this.

2 Likes

I see no dracut package here on Nixos, so if this is a dracut module…

https://search.nixos.org/packages?channel=21.11&from=0&size=50&sort=relevance&type=packages&query=dracut

I liked these articles about ZFS and Nixos:

https://grahamc.com/blog/erase-your-darlings

https://setkeh.com/posts/nixos-zfs-install-guide/

Oh yeah, you’re totally right. It’s probably a tool used by non-systemd platforms. It’s a real shame since the bpool with special grub compatibility is not ideal and will become even worse when zpool create <full disk> gets a flag to create an EFI partition as well, since the optimizations will not be available to anyone using boot environments.

Well dracut is just a tool for creating initrd. It doesn’t care if your OS uses systemd or not, and even has available hooks to use systemd in initrd.

I tried to get dracut working for nixos before, and honestly it’s just a pain because of all the FHS hard coded paths, plus it’s a horrible amalgamation of bash bits that’s just really annoying to work with.

1 Like