K3s
This commit is contained in:
1 parent
3d540c6952
commit
73a084fccd
5 files changed
+66
-40
No files matched your search
@@ -10,6 +10,14 @@ in
|
||||
skyg.networkDrives = {
|
||||
enable = lib.mkEnableOption
|
||||
"Network Drives";
|
||||
tnasHost = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "tnas1.lab.internal";
|
||||
};
|
||||
terraHost = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "terra1.lab.internal";
|
||||
};
|
||||
options = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ "defaults" ];
|
||||
@@ -18,25 +26,25 @@ in
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
fileSystems."/torrents" = {
|
||||
device = "tnas1.lab.internal:/mnt/EightTerra/DownloadedTorrents";
|
||||
device = "${cfg.tnasHost}:/mnt/EightTerra/DownloadedTorrents";
|
||||
fsType = "nfs";
|
||||
options = cfg.options;
|
||||
};
|
||||
|
||||
fileSystems."/mnt/EightTerra/k3s-cluster" = {
|
||||
device = "tnas1.lab.internal:/mnt/EightTerra/k3s-cluster";
|
||||
device = "${cfg.tnasHost}:/mnt/EightTerra/k3s-cluster";
|
||||
fsType = "nfs";
|
||||
options = cfg.options;
|
||||
};
|
||||
|
||||
fileSystems."/mnt/EightTerra/NVR" = {
|
||||
device = "tnas1.lab.internal:/mnt/EightTerra/NVR";
|
||||
device = "${cfg.tnasHost}:/mnt/EightTerra/NVR";
|
||||
fsType = "nfs";
|
||||
options = cfg.options;
|
||||
};
|
||||
|
||||
fileSystems."/mnt/terra1/Data/apps" = {
|
||||
device = "terra1.lab.internal:/mnt/Data/apps";
|
||||
device = "${cfg.terraHost}:/mnt/Data/apps";
|
||||
fsType = "nfs";
|
||||
options = cfg.options;
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
./admin.nix
|
||||
./arrs
|
||||
./k8s
|
||||
./k3s
|
||||
./services
|
||||
./timers.nix
|
||||
];
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
let
|
||||
cfg = config.skyg.nixos.server.k3s;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
skyg.nixos.server.k3s = {
|
||||
enable = lib.mkEnableOption
|
||||
"Enable K3s";
|
||||
role = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "server";
|
||||
};
|
||||
envPath = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "/mnt/EightTerra/k3s-cluster/configs/k3s.env";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config =
|
||||
lib.mkIf cfg.enable {
|
||||
system.activationScripts.k3sEnv = ''
|
||||
set -e
|
||||
mkdir -p /var/lib/k3s
|
||||
cp ${cfg.envPath} /var/lib/k3s/.env
|
||||
chmod 0644 /var/lib/k3s/.env
|
||||
chown root:root /var/lib/k3s/.env
|
||||
'';
|
||||
services.k3s = {
|
||||
enable = true;
|
||||
environmentFile = "/var/lib/k3s/.env";
|
||||
role = cfg.role;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user