{ config, lib, ... }: with lib; let cfg = config.roles.virtualisation; in { options.roles.virtualisation = { enable = mkEnableOption "Enable virtualisation"; dockerUsers = mkOption { type = types.listOf types.str; default = [ "johno" ]; description = "List of users to add to the docker group"; }; }; config = mkIf cfg.enable { virtualisation.libvirtd.enable = true; programs.virt-manager.enable = true; virtualisation.docker.enable = true; users.extraGroups.docker.members = cfg.dockerUsers; }; }