Znapzend SSH and Mbuffer Errors

I am working towards periodic backups of my ZFS file systems/volumes. Starting small, I added the following to my configuration.nix to backup dpool/src on nixbox to zroot/backups/nixbox/src on freebsdbox (aka where the zroot pool already exists):

services.znapzend = {
      enable = false;
      autoCreation = true;
      pure = true;
      zetup = {
        "nixbox/src" = rec {
          enable = true;
          recursive = true;
          mbuffer.enable = true;
          dataset = "dpool/src";
          plan = "15min=>5min,1h=>15min,1d=>1h,1w=>1d,1m=>1w";
          destinations = {
            freebsdbox = {
              dataset = "zroot/backups/nixbox/src";
              plan = plan + ",1y=>1m,10y=>1y";
              host = "root@";

Unfortunately, I am having several problems:

  1. I don’t know how to tell znapzend which SSH key to use and thereby get “root@ Permission denied (publickey,keyboard-interactive).” when running znapzendzetup list or via systemd. (Note: I created a new ssh key and added it to freebsdbox:.ssh/authorized_keys then tested that I could login without a password so that isn’t the problem. I just don’t know how to tell it which key to use.)

  2. The location of the mbuffer command is different between NixOS and FreeBSD: “*** WARNING: executable ‘/nix/store/r1khrjyfyqympjcfz4n993x0vp5b3gw6-mbuffer-20180318/bin/mbuffer’ does not exist on root@”. I need to specify the DST mbuffer command different from the SRC command. (Note: I think this would be a problem even for NixOS with two different versions of mbuffer since the full path is being used. An alternative is for the znapzend option to use the bare command without the path which should be sufficient.)

  3. Even if this config were working, I would like to be able to abstract it into a function “doBackup” so that I could specify "doBackup “nixbox/src” “dpool/src” and have it generate the above of the config, including synthesizing the destination dataset as “zroot/backups/” + , in this example “nixbox/src”. That way I could easily specify "doBackup “nixbox/home” “dpool/home”, etc., using a map over a list of attributes, one for each dataset to be backed up. Can someone with sufficient Nix-foo point me in the right direction?

Any help is appreciated.