anchor.diff:        };
       };
   
  +    kubeconfig = mkOption {
  +      description = ''
  +        Path to kubeconfig to use for storing flannel config using the
  +        Kubernetes API
  +      '';
  +      type = types.nullOr types.path;
  +      default = null;
  +    };
  +
       network = mkOption {
         description = " IPv4 network in CIDR format to use for the entire flannel network.";
         type = types.str;
  +    };
  +
  +    storageBackend = mkOption {
  +      description = "Determines where flannel stores its configuration at runtime";
  +      type = types.enum ["etcd" "kubernetes"];
  +      default = "etcd";
       };
   
       subnetLen = mkOption {
  
positive.code:       serviceConfig.ExecStart = "${cfg.package}/bin/flannel";
      };
  
      services.etcd.enable = mkDefault (cfg.etcd.endpoints == ["http://127.0.0.1:2379"]);
    };
  }
  
negative.code:       after = [ "network.target" ];
        environment = {
          FLANNELD_PUBLIC_IP = cfg.publicIp;
          FLANNELD_IFACE = cfg.iface;
        } // optionalAttrs (cfg.storageBackend == "etcd") {
          FLANNELD_ETCD_ENDPOINTS = concatStringsSep "," cfg.etcd.endpoints;
          FLANNELD_ETCD_KEYFILE = cfg.etcd.keyFile;
          FLANNELD_ETCD_CERTFILE = cfg.etcd.certFile;
          FLANNELD_ETCD_CAFILE = cfg.etcd.caFile;
          ETCDCTL_CERT_FILE = cfg.etcd.certFile;
          ETCDCTL_KEY_FILE = cfg.etcd.keyFile;
          ETCDCTL_CA_FILE = cfg.etcd.caFile;
          ETCDCTL_PEERS = concatStringsSep "," cfg.etcd.endpoints;
        } // optionalAttrs (cfg.storageBackend == "kubernetes") {
          FLANNELD_KUBE_SUBNET_MGR = "true";
          FLANNELD_KUBECONFIG_FILE = cfg.kubeconfig;
        };
        preStart = mkIf (cfg.storageBackend == "etcd") ''
          echo "setting network configuration"
          until ${pkgs.etcdctl.bin}/bin/etcdctl set /coreos.com/network/config '${builtins.toJSON networkConfig}'
          do
  