Define module for detailed depends_on options

This commit is contained in:
t4ccer 2022-04-27 14:23:25 -06:00
parent cf20442a7a
commit 69b9109dea
No known key found for this signature in database
GPG key ID: 19E5A2D8B1E43F19
2 changed files with 16 additions and 6 deletions

View file

@ -514,7 +514,7 @@ See link:https://docs.docker.com/compose/compose-file/#depends_on[Docker Compose
[discrete] [discrete]
=== details === details
Type:: list of strings or attribute set of attribute set of stringss Type:: list of strings or attribute set of submodules
Default:: Default::
+ +
---- ----

View file

@ -8,7 +8,7 @@
let let
inherit (lib) mkOption types; inherit (lib) mkOption types;
inherit (types) listOf nullOr attrsOf str either int bool; inherit (types) listOf nullOr attrsOf str either int bool submodule enum;
link = url: text: link = url: text:
''link:${url}[${text}]''; ''link:${url}[${text}]'';
@ -100,8 +100,18 @@ in
default = null; default = null;
description = dockerComposeRef "container_name"; description = dockerComposeRef "container_name";
}; };
service.depends_on = mkOption { service.depends_on =
type = either (listOf str) (attrsOf (attrsOf str)); let conditionsModule = {
options = {
condition = mkOption {
type = enum ["service_started" "service_healthy" "service_completed_successfully"];
description = dockerComposeRef "depends_on";
default = "service_started";
};
};
};
in mkOption {
type = either (listOf str) (attrsOf (submodule conditionsModule));
default = []; default = [];
description = dockerComposeRef "depends_on"; description = dockerComposeRef "depends_on";
}; };