|
57 | 57 | default = []; |
58 | 58 | description = serviceRef "tmpfs"; |
59 | 59 | }; |
60 | | - service.build.context = mkOption { |
61 | | - type = nullOr str; |
62 | | - default = null; |
63 | | - description = '' |
64 | | - Locates a Dockerfile to use for creating an image to use in this service. |
| 60 | + service.build = mkOption { |
| 61 | + default = {}; |
| 62 | + description = serviceRef "build"; |
| 63 | + type = submodule ({ options, ...}: { |
| 64 | + options = { |
| 65 | + _out = mkOption { |
| 66 | + internal = true; |
| 67 | + readOnly = true; |
| 68 | + default = lib.mapAttrs (k: opt: opt.value) (lib.filterAttrs (_: opt: opt.value != null) { inherit (options) context dockerfile target secrets; }); |
| 69 | + }; |
| 70 | + context = mkOption { |
| 71 | + type = nullOr str; |
| 72 | + default = null; |
| 73 | + description = '' |
| 74 | + Locates a Dockerfile to use for creating an image to use in this service. |
65 | 75 |
|
66 | | - https://docs.docker.com/compose/compose-file/build/#context |
67 | | - ''; |
68 | | - }; |
69 | | - service.build.dockerfile = mkOption { |
70 | | - type = nullOr str; |
71 | | - default = null; |
72 | | - description = '' |
73 | | - Sets an alternate Dockerfile. A relative path is resolved from the build context. |
74 | | - https://docs.docker.com/compose/compose-file/build/#dockerfile |
75 | | - ''; |
| 76 | + https://docs.docker.com/compose/compose-file/build/#context |
| 77 | + ''; |
| 78 | + }; |
| 79 | + dockerfile = mkOption { |
| 80 | + type = nullOr str; |
| 81 | + default = null; |
| 82 | + description = '' |
| 83 | + Sets an alternate Dockerfile. A relative path is resolved from the build context. |
| 84 | + https://docs.docker.com/compose/compose-file/build/#dockerfile |
| 85 | + ''; |
| 86 | + }; |
| 87 | + target = mkOption { |
| 88 | + type = nullOr str; |
| 89 | + default = null; |
| 90 | + description = '' |
| 91 | + Defines the stage to build as defined inside a multi-stage Dockerfile. |
| 92 | + https://docs.docker.com/compose/compose-file/build/#target |
| 93 | + ''; |
| 94 | + }; |
| 95 | + secrets = mkOption { |
| 96 | + type = nullOr (listOf str); |
| 97 | + default = null; |
| 98 | + description = '' |
| 99 | + Build-time secrets exposed to the service. |
| 100 | + ''; |
| 101 | + }; |
| 102 | + }; |
| 103 | + }); |
76 | 104 | }; |
77 | | - service.build.target = mkOption { |
78 | | - type = nullOr str; |
79 | | - default = null; |
| 105 | + service.secrets = mkOption { |
| 106 | + type = listOf str; |
| 107 | + default = []; |
80 | 108 | description = '' |
81 | | - Defines the stage to build as defined inside a multi-stage Dockerfile. |
82 | | - https://docs.docker.com/compose/compose-file/build/#target |
| 109 | + Run-time secrets exposed to the service. |
83 | 110 | ''; |
84 | 111 | }; |
85 | 112 | service.hostname = mkOption { |
|
353 | 380 | ; |
354 | 381 | } // lib.optionalAttrs (config.service.image != null) { |
355 | 382 | inherit (config.service) image; |
356 | | - } // lib.optionalAttrs (config.service.build.context != null ) { |
357 | | - build = lib.filterAttrs (n: v: v != null) config.service.build; |
| 383 | + } // lib.optionalAttrs (config.service.build._out != {}) { |
| 384 | + build = config.service.build._out; |
358 | 385 | } // lib.optionalAttrs (cap_add != []) { |
359 | 386 | inherit cap_add; |
360 | 387 | } // lib.optionalAttrs (cap_drop != []) { |
|
379 | 406 | inherit (config.service) external_links; |
380 | 407 | } // lib.optionalAttrs (config.service.extra_hosts != []) { |
381 | 408 | inherit (config.service) extra_hosts; |
| 409 | + } // lib.optionalAttrs (config.service.secrets != []) { |
| 410 | + inherit (config.service) secrets; |
382 | 411 | } // lib.optionalAttrs (config.service.hostname != null) { |
383 | 412 | inherit (config.service) hostname; |
384 | 413 | } // lib.optionalAttrs (config.service.dns != []) { |
|
0 commit comments