dotfiles/nixos/k3s.nix

47 lines
1.3 KiB
Nix
Raw Normal View History

{ config, lib, ... }:
with lib;
let cfg = config.myModules.railbird-k3s;
in {
options = {
2024-09-30 16:42:58 -06:00
myModules.railbird-k3s = {
enable = mkEnableOption "railbird k3s";
serverAddr = mkOption {
type = lib.types.str;
default = "";
};
};
};
2024-09-30 16:42:58 -06:00
config = mkIf cfg.enable {
age.secrets."1896Folsom-k3s-token.age".file = ./secrets/1896Folsom-k3s-token.age;
services.dockerRegistry = {
enable = true;
listenAddress = "0.0.0.0";
port = 5279;
enableDelete = true;
enableGarbageCollect = true;
};
services.k3s = {
enable = true;
role = "server";
clusterInit = cfg.serverAddr == "";
serverAddr = cfg.serverAddr;
tokenFile = config.age.secrets."1896Folsom-k3s-token.age".path;
containerdConfigTemplate = ''
{{ template "base" . }}
2024-09-30 00:05:50 -06:00
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.nvidia]
privileged_without_host_devices = false
runtime_engine = ""
runtime_root = ""
runtime_type = "io.containerd.runc.v2"
2024-09-30 00:05:50 -06:00
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.nvidia.options]
BinaryName = "/run/current-system/sw/bin/nvidia-container-runtime"
'';
gracefulNodeShutdown = {
enable = true;
};
2024-09-30 00:05:50 -06:00
};
};
}