This commit is contained in:
1 parent
1f3976a77f
commit
3cf8fd289a
6 files changed
+84
-2
No files matched your search
+15
-1
@@ -1,3 +1,17 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
imports = [ ./crossplane.nix ];
|
||||
imports = [
|
||||
./crossplane.nix
|
||||
./talos.nix
|
||||
];
|
||||
|
||||
options.k8s.enable = lib.mkOption {
|
||||
default = false;
|
||||
type = lib.types.bool;
|
||||
};
|
||||
|
||||
config = lib.mkIf config.k8s.enable {
|
||||
k8s.talos.enable = lib.mkDefault true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (config.host) username;
|
||||
in
|
||||
{
|
||||
options.k8s.talos = {
|
||||
enable = lib.mkOption {
|
||||
default = false;
|
||||
type = lib.types.bool;
|
||||
};
|
||||
platform = lib.mkOption {
|
||||
default = "qemu";
|
||||
type = lib.types.enum [
|
||||
"docker"
|
||||
"qemu"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.k8s.talos.enable (
|
||||
lib.mkMerge [
|
||||
(lib.mkIf (config.k8s.talos.platform == "docker") {
|
||||
docker.enable = true;
|
||||
assertions = [
|
||||
{
|
||||
assertion = !config.docker.rootless;
|
||||
message = "talos in docker needs 'docker.rootless = false;'";
|
||||
}
|
||||
];
|
||||
})
|
||||
(lib.mkIf (config.k8s.talos.platform == "qemu") {
|
||||
users.users.${username}.extraGroups = [ "kvm" ];
|
||||
environment.systemPackages = [ pkgs.qemu ];
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user