about summary refs log tree commit diff
path: root/modules/nixos/k3s.nix
blob: 016eb50acd7cd7fa5a94324a948f4a9673cd30ec (plain) (blame)
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 = "664";
    };
  };
}

Consider giving Nix/NixOS a try! <3