summaryrefslogtreecommitdiff
path: root/modules/nixos/k3s.nix
blob: a6efd9f590589dce3f54f596b70f1e3403adb41d (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
{ 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 = "664";
    };
  };
}