{
  config,
  lib,
  pkgs,
  ...
}:

{
  imports = [ ];

  options.me = {
    kubernetes.enable = lib.mkOption {
      type = lib.types.bool;
      default = false;
      example = true;
      description = "Whether we want to install kubernetes.";
    };
  };

  config = lib.mkIf config.me.kubernetes.enable {
    environment.systemPackages = with pkgs; [
      kubernetes
    ];

    systemd.targets.kubernetes = {
      description = "Kubernetes";
      wantedBy = [ "multi-user.target" ];
    };

    users.users.kubernetes = {
      uid = 10024;
      description = "Kubernetes";
      group = "kubernetes";
      home = "/var/lib/kubernetes";
      createHome = true;
      homeMode = "755";
      isSystemUser = true;
    };
    users.groups.kubernetes.gid = 10024;

    environment.persistence."/persist" = lib.mkIf (config.me.mountPersistence) {
      hideMounts = true;
      directories = [
        {
          directory = "/var/lib/kubernetes";
          user = "kubernetes";
          group = "kubernetes";
          mode = "0755";
        }
      ];
    };
  };
}
