anchor.diff:          target = "exports";
         });
   
  +    /* We have to load this quite before running the daemons. Using
  +       "modprobe nfsd" when loading the daemons causes a race condition where
  +       nfsd can return 'authentication failed'/'Permission denied'.
  +
  +      I've not tried with nfsd alone. So I add what I tried, with nfs_acl too.
  +    */
  +    boot.kernelModules = mkIf cfg.server.enable [ "nfsd" "nfs_acl" ];
  +
       jobs =
         optionalAttrs cfg.server.enable
           { nfs_kernel_exports =
  
positive.code: 
              description = "Kernel NFS server";
  
              startOn = "started network-interfaces and started portmap";
  
              postStart =
                ''
  
negative.code: 
                  # Create a state directory required by NFSv4.
                  mkdir -p /var/lib/nfs/v4recovery
  
                  ${pkgs.sysvtools}/bin/mountpoint -q /proc/fs/nfsd \
                  || ${config.system.sbin.mount}/bin/mount -t nfsd none /proc/fs/nfsd
  