anchor.diff:          echo "    \"\": \"\"" >> /etc/consul-addrs.json
           echo "}" >> /etc/consul-addrs.json
         '';
  +      postStart = ''
  +        # Issues joins to nodes which we statically connect to
  +        ${flip concatMapStrings cfg.joinNodes (addr: ''
  +          for i in {0..${toString cfg.joinRetries}}; do
  +            # Try to join the other nodes ${toString cfg.joinRetries} times before failing
  +            consul join "${addr}" && break
  +            sleep 1
  +          done &
  +        '')}
  +        wait
  +        exit 0
  +      '';
       };
   
     };
  
positive.code: 
    configOptions = {
      data_dir = dataDir;
      rejoin_after_leave = true;
    }
    // (if cfg.webUi then { ui_dir = "${pkgs.consul.ui}"; } else { })
    // cfg.extraConfig;
  
negative.code:       serviceConfig = {
          ExecStart = "@${pkgs.consul}/bin/consul consul agent"
            + concatMapStrings (n: " -config-file ${n}") configFiles;
          ExecReload = "${pkgs.consul}/bin/consul reload";
          PermissionsStartOnly = true;
          User = if cfg.dropPrivileges then "consul" else null;
        } // (optionalAttrs (cfg.leaveOnStop) {
          ExecStop = "${pkgs.consul}/bin/consul leave";
        });
  
        path = with pkgs; [ iproute gnugrep gawk consul ];
        preStart = ''
          mkdir -m 0700 -p ${dataDir}
          chown -R consul ${dataDir}
  