2024-09-26 21:05:27 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
cfg = config.krop.docker;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.krop.docker = {
|
|
|
|
enable = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
|
|
|
default = false;
|
|
|
|
example = true;
|
|
|
|
description = "Whether to enable Docker service.";
|
|
|
|
};
|
|
|
|
addUserToGroup = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
|
|
|
default = true;
|
|
|
|
example = false;
|
|
|
|
description = "Whether to add the user to the Docker group.";
|
|
|
|
};
|
2024-10-25 12:15:44 +02:00
|
|
|
changeDefaultNetwork = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
|
|
|
default = false;
|
|
|
|
example = true;
|
|
|
|
description = "Whether to change docker daemon to use different networks.";
|
|
|
|
};
|
2024-09-26 21:05:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
virtualisation.docker = {
|
|
|
|
enable = true;
|
2024-10-25 15:57:14 +02:00
|
|
|
daemon.settings = lib.mkIf cfg.changeDefaultNetwork {
|
2024-10-25 12:15:44 +02:00
|
|
|
default-address-pools = [
|
|
|
|
{
|
|
|
|
base = "10.250.0.0/16";
|
|
|
|
size = 24;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2024-09-26 21:05:27 +02:00
|
|
|
};
|
|
|
|
users.users.krop = lib.mkIf cfg.addUserToGroup {
|
2024-09-27 09:10:23 +02:00
|
|
|
extraGroups = [ "docker" ];
|
2024-09-26 21:05:27 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|