summaryrefslogtreecommitdiff
path: root/modules/nixos/k3s.nix
blob: dcbd052cf49f996406e97e579c4d393b51c11844 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
  config,
  lib,
  ...
}:
with lib; let
  cfg = config.nixfiles.modules.k3s;
in {
  options.nixfiles.modules.k3s = {
    enable = mkEnableOption "K3s";
  };

  config = mkIf cfg.enable {
    ark.directories = [
      "/etc/rancher/k3s"
      "/var/lib/rancher/k3s"
    ];

    services.k3s = {
      enable = true;
      role = "server";
    };

    systemd.services.k3s.environment = {
      K3S_KUBECONFIG_OUTPUT = "/etc/rancher/k3s/k3s.yaml";
      K3S_KUBECONFIG_MODE = "600";
    };
  };
}