diff options
Diffstat (limited to 'modules/private/environment.nix')
-rw-r--r-- | modules/private/environment.nix | 115 |
1 files changed, 65 insertions, 50 deletions
diff --git a/modules/private/environment.nix b/modules/private/environment.nix index 5f5f6c8..98d50b1 100644 --- a/modules/private/environment.nix +++ b/modules/private/environment.nix | |||
@@ -1,4 +1,4 @@ | |||
1 | { lib, ... }: | 1 | { config, lib, name, ... }: |
2 | with lib; | 2 | with lib; |
3 | with types; | 3 | with types; |
4 | with lists; | 4 | with lists; |
@@ -23,6 +23,7 @@ let | |||
23 | }; | 23 | }; |
24 | mysqlOptions = { | 24 | mysqlOptions = { |
25 | host = mkOption { description = "Host to access Mysql"; type = str; }; | 25 | host = mkOption { description = "Host to access Mysql"; type = str; }; |
26 | remoteHost = mkOption { description = "Host to access Mysql from outside"; type = str; }; | ||
26 | port = mkOption { description = "Port to access Mysql"; type = str; }; | 27 | port = mkOption { description = "Port to access Mysql"; type = str; }; |
27 | socket = mkOption { description = "Socket to access Mysql"; type = path; }; | 28 | socket = mkOption { description = "Socket to access Mysql"; type = path; }; |
28 | systemUsers = mkOption { | 29 | systemUsers = mkOption { |
@@ -107,6 +108,63 @@ let | |||
107 | }; | 108 | }; |
108 | }; | 109 | }; |
109 | }; | 110 | }; |
111 | hostEnv = submodule { | ||
112 | options = { | ||
113 | fqdn = mkOption { | ||
114 | description = "Host FQDN"; | ||
115 | type = str; | ||
116 | }; | ||
117 | emails = mkOption { | ||
118 | default = []; | ||
119 | description = "List of e-mails that the server can be a sender of"; | ||
120 | type = listOf str; | ||
121 | }; | ||
122 | ldap = mkOption { | ||
123 | description = '' | ||
124 | LDAP credentials for the host | ||
125 | ''; | ||
126 | type = submodule { | ||
127 | options = { | ||
128 | password = mkOption { type = string; description = "Password for the LDAP connection"; }; | ||
129 | dn = mkOption { type = string; description = "DN for the LDAP connection"; }; | ||
130 | }; | ||
131 | }; | ||
132 | }; | ||
133 | mx = mkOption { | ||
134 | description = "subdomain and priority for MX server"; | ||
135 | default = { enable = false; }; | ||
136 | type = submodule { | ||
137 | options = { | ||
138 | enable = mkEnableOption "Enable MX"; | ||
139 | subdomain = mkOption { type = nullOr str; description = "Subdomain name (mx-*)"; }; | ||
140 | priority = mkOption { type = nullOr str; description = "Priority"; }; | ||
141 | }; | ||
142 | }; | ||
143 | }; | ||
144 | ips = mkOption { | ||
145 | description = '' | ||
146 | attrs of ip4/ip6 grouped by section | ||
147 | ''; | ||
148 | type = attrsOf (submodule { | ||
149 | options = { | ||
150 | ip4 = mkOption { | ||
151 | type = string; | ||
152 | description = '' | ||
153 | ip4 address of the host | ||
154 | ''; | ||
155 | }; | ||
156 | ip6 = mkOption { | ||
157 | type = listOf string; | ||
158 | default = []; | ||
159 | description = '' | ||
160 | ip6 addresses of the host | ||
161 | ''; | ||
162 | }; | ||
163 | }; | ||
164 | }); | ||
165 | }; | ||
166 | }; | ||
167 | }; | ||
110 | in | 168 | in |
111 | { | 169 | { |
112 | options.myEnv = { | 170 | options.myEnv = { |
@@ -115,48 +173,7 @@ in | |||
115 | Attrs of servers information in the cluster (not necessarily handled by nixops) | 173 | Attrs of servers information in the cluster (not necessarily handled by nixops) |
116 | ''; | 174 | ''; |
117 | default = {}; | 175 | default = {}; |
118 | type = attrsOf (submodule { | 176 | type = attrsOf hostEnv; |
119 | options = { | ||
120 | emails = mkOption { | ||
121 | default = []; | ||
122 | description = "List of e-mails that the server can be a sender of"; | ||
123 | type = listOf str; | ||
124 | }; | ||
125 | ldap = mkOption { | ||
126 | description = '' | ||
127 | LDAP credentials for the host | ||
128 | ''; | ||
129 | type = submodule { | ||
130 | options = { | ||
131 | password = mkOption { type = string; description = "Password for the LDAP connection"; }; | ||
132 | dn = mkOption { type = string; description = "DN for the LDAP connection"; }; | ||
133 | }; | ||
134 | }; | ||
135 | }; | ||
136 | ips = mkOption { | ||
137 | description = '' | ||
138 | attrs of ip4/ip6 grouped by section | ||
139 | ''; | ||
140 | type = attrsOf (submodule { | ||
141 | options = { | ||
142 | ip4 = mkOption { | ||
143 | type = string; | ||
144 | description = '' | ||
145 | ip4 address of the host | ||
146 | ''; | ||
147 | }; | ||
148 | ip6 = mkOption { | ||
149 | type = listOf string; | ||
150 | default = []; | ||
151 | description = '' | ||
152 | ip6 addresses of the host | ||
153 | ''; | ||
154 | }; | ||
155 | }; | ||
156 | }); | ||
157 | }; | ||
158 | }; | ||
159 | }); | ||
160 | }; | 177 | }; |
161 | hetznerCloud = mkOption { | 178 | hetznerCloud = mkOption { |
162 | description = '' | 179 | description = '' |
@@ -1172,12 +1189,10 @@ in | |||
1172 | ''; | 1189 | ''; |
1173 | }; | 1190 | }; |
1174 | }; | 1191 | }; |
1175 | options.hostEnv = { | 1192 | options.hostEnv = mkOption { |
1176 | FQDN = mkOption { | 1193 | readOnly = true; |
1177 | type = string; | 1194 | type = hostEnv; |
1178 | description = '' | 1195 | default = config.myEnv.servers."${name}"; |
1179 | FQDN of the current host. | 1196 | description = "Host environment"; |
1180 | ''; | ||
1181 | }; | ||
1182 | }; | 1197 | }; |
1183 | } | 1198 | } |