From aed2c40e7773449c6cb5f120cdc6b12a6bdb4986 Mon Sep 17 00:00:00 2001 From: lunik1 Date: Sat, 10 Apr 2021 00:51:40 +0100 Subject: [PATCH 1/2] Add service.dns --- CHANGELOG.md | 2 ++ src/nix/modules/service/docker-compose-service.nix | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9947529..5a49809 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Next +* Support `service.dns`, for overriding the DNS servers used by containers. + * Support `service.labels`, which is useful for autodiscovery among other things. * Add a tested example for Traefik with label-based routing. diff --git a/src/nix/modules/service/docker-compose-service.nix b/src/nix/modules/service/docker-compose-service.nix index 4da0ab3..385cff0 100644 --- a/src/nix/modules/service/docker-compose-service.nix +++ b/src/nix/modules/service/docker-compose-service.nix @@ -115,6 +115,12 @@ in ${dockerComposeRef "devices"} ''; }; + service.dns = mkOption { + type = listOf str; + default = []; + example = [ "8.8.8.8" "8.8.4.4" ]; + description = dockerComposeRef "dns"; + }; service.labels = mkOption { type = attrsOf str; default = {}; @@ -258,6 +264,8 @@ in inherit (config.service) extra_hosts; } // lib.optionalAttrs (config.service.hostname != null) { inherit (config.service) hostname; + } // lib.optionalAttrs (config.service.dns != []) { + inherit (config.service) dns; } // lib.optionalAttrs (config.service.labels != {}) { inherit (config.service) labels; } // lib.optionalAttrs (config.service.links != []) { From e44c2c95ac927cfad44fbb60c5149052bed0ab02 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 10 Apr 2021 11:50:51 +0200 Subject: [PATCH 2/2] ./update-options --- docs/modules/ROOT/partials/NixOSOptions.adoc | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/modules/ROOT/partials/NixOSOptions.adoc b/docs/modules/ROOT/partials/NixOSOptions.adoc index 2a97cbb..7709010 100644 --- a/docs/modules/ROOT/partials/NixOSOptions.adoc +++ b/docs/modules/ROOT/partials/NixOSOptions.adoc @@ -525,6 +525,28 @@ Default:: No Example:: {blank} +== services..service.dns + +See link:https://docs.docker.com/compose/compose-file/#dns[Docker Compose#dns] + +[discrete] +=== details + +Type:: list of strings +Default:: ++ +---- +[] +---- + + +Example:: ++ +---- +["8.8.8.8","8.8.4.4"] +---- + + == services..service.entrypoint See link:https://docs.docker.com/compose/compose-file/#entrypoint[Docker Compose#entrypoint]