{ ... }: {
  flake.nixosModules.systemDocker =
    { config, lib, pkgs, ... }:
    let
      cfg = config.chiasson.system.docker;
    in
    {
      options.chiasson.system.docker = {
        enable = lib.mkEnableOption ''
          `virtualisation.docker` — add users to `docker` if they need the socket.
        '';

        compose.enable = lib.mkOption {
          type = lib.types.bool;
          default = true;
          description = "Install `docker-compose` in `environment.systemPackages`.";
        };

        daemonSettings = lib.mkOption {
          type = lib.types.attrs;
          default = { };
          description = "Merged into `virtualisation.docker.daemon.settings`.";
        };
      };

      config = lib.mkIf cfg.enable {
        virtualisation.docker = {
          enable = true;
          enableOnBoot = true;
          daemon.settings = cfg.daemonSettings;
        };

        environment.systemPackages = lib.optionals cfg.compose.enable [ pkgs.docker-compose ];
      };
    };
}
