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.


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

I liked these articles about ZFS and Nixos:

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

Hi all, sorry for necroposting, this is my situation:

[14:06:45] zar_marco :: nixgram  ➜  ~ » zfs list
NAME                      USED  AVAIL  REFER  MOUNTPOINT
rpool                     258G   642G    96K  none
rpool/data                160G   642G    96K  none
rpool/data/arch-home     15.9G   642G  15.0G  legacy
rpool/data/condivise      122G   642G   122G  legacy
rpool/data/gentoo-home   2.50G   642G  1.89G  legacy
rpool/data/gentooD-home  9.64G   642G  8.92G  legacy
rpool/data/nixos-home     276M   642G   276M  legacy
rpool/data/void-home     9.64G   642G  8.33G  legacy
rpool/root               97.6G   642G    96K  none
rpool/root/arch          17.1G   642G  14.4G  /
rpool/root/gentoo        26.8G   642G  24.1G  /
rpool/root/gentooD       34.9G   642G  30.1G  /
rpool/root/nixos         7.05G   642G  7.05G  /
rpool/root/void          11.7G   642G  8.54G  /

I use zfsbootmenu for boot another distro and I use zrepl for snapshot. Can I use these on nixos?

Anyway on arch I use mkinitcpio instead dracut, with zfs and zfsbootmenu

I would like use nixos from zfsbootmenu installed on void

1 Like

About zfsbootmenu I can not tell, zrepl works fine and has a nice module for configuration, it’s my daily driver for snapshots.


sorry but I’m new. How can I setted zrepl on nixos?

With that option you can configure the config NixOS Search

I can also share my config (that’s my nas config which is the complexest I have)

I hope that helps

1 Like

Currently on my other distros I’m using zrepl for create snapshots locally. But I believe that this isn’t very useful on nixos, since it create grub entries for the various generations. I’m wrong? otherwise I can use zrepl for only home dataset. But now I’m studying your configuration

I am not sure what your exact use cases are and possibly it’s better to create a separate thread when you want to dig more into that for zrepl (as this was for zfsbootmenu).
I personally don’t take snapshots of / but use a tmpfs (or reset to a blank / on boot) similar to this setup

On some hosts I also just create snapshots for later recovery (when I do operations I regret later) and don’t sync them somewhere.

What make sense for your personal setup and what does not make sense is possibly something that just you can say :slight_smile: .

About the nixos generation sentence: it I personally would not say that a nixos generation is equivalent to a zfs snapshot, as the generation just covers what you declare in your config, there are also some other stuff that you might want to safe for later (ofc depending on your config), it could begin with more obvious things like /home and maybe /var/lib (there is some state dir in like for databases) but also some other things where you have impure processes that can’t be recovered from the nixos config.

1 Like