Add toplevel module, and enable modules in config

This commit is contained in:
Jonas Juselius
2020-10-31 09:16:52 +01:00
parent 375a26915f
commit 533928a880
5 changed files with 30 additions and 19 deletions

View File

@@ -40,7 +40,7 @@ in {
}
];
imports = [ host.hw ./k8s.nix ];
imports = [ host.hw ./modules.nix ];
};
node = host: self: {
@@ -57,7 +57,7 @@ in {
}
];
imports = [ host.hw ./k8s.nix ];
imports = [ host.hw ./modules.nix ];
};
mkDeployment = master: nodes:
@@ -82,7 +82,7 @@ in {
}
];
imports = [ host.hw ./fs.nix ];
imports = [ host.hw ./modules.nix ];
};
mkDeployment = nodes:
@@ -104,7 +104,7 @@ in {
}
];
imports = [ host.hw ./os.nix ];
imports = [ host.hw ./modules.nix ];
};
mkDeployment = masterNode: workerNodes:

View File

@@ -42,6 +42,7 @@ let
};
in {
options.cluster.fs = {
enable = mkEnableOption "Enable nfs fileserver";
nfs = {
enable = mkEnableOption "Enable nfs fileserver";
exports = mkOption {
@@ -52,13 +53,13 @@ in {
glusterfs.enable = mkEnableOption "Enable glusterfs fileserver";
};
config = mkMerge [
common
(mkIf cfg.nfs.enable nfs)
(mkIf cfg.glusterfs.enable glusterfs)
];
config = mkIf cfg.enable (
mkMerge [
common
(mkIf cfg.nfs.enable nfs)
(mkIf cfg.glusterfs.enable glusterfs)
]
);
imports = [ ./os.nix ];
}

View File

@@ -204,6 +204,7 @@ let
in {
options.cluster.k8s = {
enable = mkEnableOption "Enable kubernetes";
nodes = mkOption {
type = types.listOf types.attrs;
default = [];
@@ -211,12 +212,12 @@ in {
fileserver = mkOption {
type = types.str;
default = "127.0.0.1";
default = null;
};
cidr = mkOption {
type = types.str;
default = "10.11.0.0/16";
default = "10.0.0.0/16";
};
master = {
@@ -270,10 +271,12 @@ in {
};
};
config = mkMerge [
(mkIf cfg.k8s.master.enable kubeMaster)
(mkIf cfg.k8s.node.enable kubeNode)
];
config = mkIf cfg.k8s.enable (
mkMerge [
(mkIf cfg.k8s.master.enable kubeMaster)
(mkIf cfg.k8s.node.enable kubeNode)
]
);
imports = [ ./os.nix ];
}

7
lib/modules.nix Normal file
View File

@@ -0,0 +1,7 @@
{
imports = [
./os.nix
./fs.nix
./k8s.nix
];
}

View File

@@ -55,8 +55,8 @@ in
networking = {
hostName = cfg.hostName;
domain = cfg.domain;
search = cfg.searchDomains;
# domain = cfg.domain;
# search = cfg.searchDomains;
extraHosts = cfg.extraHosts;
};