nix-config/nixosModules/dev/docker.nix
2024-09-27 09:10:23 +02:00

34 lines
648 B
Nix

{
config,
pkgs,
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.";
};
};
config = lib.mkIf cfg.enable {
virtualisation.docker = {
enable = true;
};
users.users.krop = lib.mkIf cfg.addUserToGroup {
extraGroups = [ "docker" ];
};
};
}