{ config, lib, pkgs, ... }:

let
  cfg = config.samfelag.modules.dev.docker;
in
{
  options.samfelag.modules.dev.docker = with lib.types; {
    enable = lib.mkEnableOption "docker";
    users = lib.my.mkOpt (listOf str) config.user.name;
  };
  config = lib.mkIf cfg.enable {
    virtualisation.docker.enable = true;

    users.extraGroups.docker.members = cfg.users;

    environment.systemPackages = with pkgs; [
      docker
    ];
  };
}
