diff options
author | Azat Bahawi <azat@bahawi.net> | 2023-03-11 12:51:58 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2023-03-11 12:51:58 +0300 |
commit | 0ef23d4501592a192ba020a2ac34abb1a3d8fc5e (patch) | |
tree | 17f0377d71f7c645acf8502c769a0ade76cbc901 /modules/nixos/k3s.nix | |
parent | 2023-02-20 (diff) |
2023-03-11
Diffstat (limited to '')
-rw-r--r-- | modules/nixos/k3s.nix | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/modules/nixos/k3s.nix b/modules/nixos/k3s.nix new file mode 100644 index 0000000..dcbd052 --- /dev/null +++ b/modules/nixos/k3s.nix @@ -0,0 +1,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"; + }; + }; +} |