{ lib, pkgs, config, ... }: let inherit (lib) mkIf mkEnableOption mkOption ; cfg = config.programs.docker-cli; jsonFormat = pkgs.formats.json { }; in { meta.maintainers = [ lib.maintainers.friedrichaltheide lib.hm.maintainers.will-lol ]; options.programs.docker-cli = { enable = mkEnableOption "management of docker client config"; configDir = mkOption { type = lib.types.str; apply = p: lib.removePrefix "${config.home.homeDirectory}/" p; default = if config.xdg.enable && lib.versionAtLeast config.home.stateVersion "26.05" then "${config.xdg.configHome}/docker" else ".docker"; defaultText = lib.literalExpression '' if config.xdg.enable && lib.versionAtLeast config.home.stateVersion "26.05" then "$XDG_CONFIG_HOME/docker" else ".docker" ''; example = lib.literalExpression "\${config.xdg.configHome}/docker"; description = "Directory to store configuration and state. This also sets $DOCKER_CONFIG."; }; contexts = mkOption { type = lib.types.attrsOf ( lib.types.submodule ( { name, config, ... }: { freeformType = jsonFormat.type; options = { Name = mkOption { type = lib.types.str; readOnly = true; description = "Name of the Docker context. Defaults to the attribute name (the in programs.docker-cli.contexts.). Overriding requires lib.mkForce."; }; }; config.Name = name; } ) ); default = { }; example = lib.literalExpression '' { example = { Metadata = { Description = "example1"; }; Endpoints.docker.Host = "unix://example2"; }; } ''; description = '' Attribute set of Docker context configurations. Each attribute name becomes the context Name; overriding requires lib.mkForce. See: