]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - modules/private/environment.nix
Add netdata configuration
[perso/Immae/Config/Nix.git] / modules / private / environment.nix
CommitLineData
619e4f46 1{ config, lib, name, ... }:
ab8f306d
IB
2with lib;
3with types;
4with lists;
5let
6 ldapOptions = {
7 base = mkOption { description = "Base of the LDAP tree"; type = str; };
8 host = mkOption { description = "Host to access LDAP"; type = str; };
9 root_dn = mkOption { description = "DN of the root user"; type = str; };
10 root_pw = mkOption { description = "Hashed password of the root user"; type = str; };
11 replication_dn = mkOption { description = "DN of the user allowed to replicate the LDAP directory"; type = str; };
12 replication_pw = mkOption { description = "Password of the user allowed to replicate the LDAP directory"; type = str; };
13 };
14 mkLdapOptions = name: more: mkOption {
15 description = "${name} LDAP configuration";
16 type = submodule {
17 options = ldapOptions // {
18 dn = mkOption { description = "DN of the ${name} user"; type = str; };
19 password = mkOption { description = "password of the ${name} user"; type = str; };
20 filter = mkOption { description = "Filter for ${name} users"; type = str; default = ""; };
21 } // more;
22 };
23 };
24 mysqlOptions = {
25 host = mkOption { description = "Host to access Mysql"; type = str; };
619e4f46 26 remoteHost = mkOption { description = "Host to access Mysql from outside"; type = str; };
ab8f306d
IB
27 port = mkOption { description = "Port to access Mysql"; type = str; };
28 socket = mkOption { description = "Socket to access Mysql"; type = path; };
29 systemUsers = mkOption {
30 description = "Attrs of user-passwords allowed to access mysql";
31 type = attrsOf str;
32 };
33 pam = mkOption {
34 description = "PAM configuration for mysql";
35 type = submodule {
36 options = {
37 dn = mkOption { description = "DN to connect as to check users"; type = str; };
38 password = mkOption { description = "DN password to connect as to check users"; type = str; };
39 filter = mkOption { description = "filter to match users"; type = str; };
40 };
41 };
42 };
43 };
87a8bffd 44 mkMysqlOptions = name: more: mkOption {
ab8f306d
IB
45 description = "${name} mysql configuration";
46 type = submodule {
47 options = mysqlOptions // {
48 database = mkOption { description = "${name} database"; type = str; };
49 user = mkOption { description = "${name} user"; type = str; };
50 password = mkOption { description = "mysql password of the ${name} user"; type = str; };
87a8bffd 51 } // more;
ab8f306d
IB
52 };
53 };
54 psqlOptions = {
55 host = mkOption { description = "Host to access Postgresql"; type = str; };
56 port = mkOption { description = "Port to access Postgresql"; type = str; };
57 socket = mkOption { description = "Socket to access Postgresql"; type = path; };
58 pam = mkOption {
59 description = "PAM configuration for psql";
60 type = submodule {
61 options = {
62 dn = mkOption { description = "DN to connect as to check users"; type = str; };
63 password = mkOption { description = "DN password to connect as to check users"; type = str; };
64 filter = mkOption { description = "filter to match users"; type = str; };
65 };
66 };
67 };
68 };
69 mkPsqlOptions = name: mkOption {
70 description = "${name} psql configuration";
71 type = submodule {
72 options = psqlOptions // {
73 database = mkOption { description = "${name} database"; type = str; };
74 schema = mkOption { description = "${name} schema"; type = nullOr str; default = null; };
75 user = mkOption { description = "${name} user"; type = str; };
76 password = mkOption { description = "psql password of the ${name} user"; type = str; };
77 };
78 };
79 };
80 redisOptions = {
81 host = mkOption { description = "Host to access Redis"; type = str; };
82 port = mkOption { description = "Port to access Redis"; type = str; };
83 socket = mkOption { description = "Socket to access Redis"; type = path; };
84 dbs = mkOption {
85 description = "Attrs of db number. Each number should be unique to avoid collision!";
86 type = attrsOf str;
87 };
88 spiped_key = mkOption {
89 type = str;
90 description = ''
91 Key to use with spiped to make a secure channel to replication
92 '';
93 };
94 predixy = mkOption {
95 description = "Predixy configuration. Unused yet";
96 type = submodule {
97 options = {
98 read = mkOption { type = str; description = "Read password"; };
99 };
100 };
101 };
102 };
103 mkRedisOptions = name: mkOption {
104 description = "${name} redis configuration";
105 type = submodule {
106 options = redisOptions // {
107 db = mkOption { description = "${name} database"; type = str; };
108 };
109 };
110 };
6338573a
IB
111 smtpOptions = {
112 host = mkOption { description = "Host to access SMTP"; type = str; };
113 port = mkOption { description = "Port to access SMTP"; type = str; };
114 };
115 mkSmtpOptions = name: mkOption {
116 description = "${name} smtp configuration";
117 type = submodule {
118 options = smtpOptions // {
119 email = mkOption { description = "${name} email"; type = str; };
120 password = mkOption { description = "SMTP password of the ${name} user"; type = str; };
121 };
122 };
123 };
619e4f46
IB
124 hostEnv = submodule {
125 options = {
126 fqdn = mkOption {
127 description = "Host FQDN";
128 type = str;
129 };
8a304ef4
IB
130 users = mkOption {
131 type = unspecified;
132 default = pkgs: [];
133 description = ''
134 Sublist of users from realUsers. Function that takes pkgs as
135 argument and gives an array as a result
136 '';
137 };
619e4f46
IB
138 emails = mkOption {
139 default = [];
140 description = "List of e-mails that the server can be a sender of";
141 type = listOf str;
142 };
143 ldap = mkOption {
144 description = ''
145 LDAP credentials for the host
146 '';
147 type = submodule {
148 options = {
5400b9b6
IB
149 password = mkOption { type = str; description = "Password for the LDAP connection"; };
150 dn = mkOption { type = str; description = "DN for the LDAP connection"; };
619e4f46
IB
151 };
152 };
153 };
154 mx = mkOption {
155 description = "subdomain and priority for MX server";
156 default = { enable = false; };
157 type = submodule {
158 options = {
159 enable = mkEnableOption "Enable MX";
160 subdomain = mkOption { type = nullOr str; description = "Subdomain name (mx-*)"; };
161 priority = mkOption { type = nullOr str; description = "Priority"; };
162 };
163 };
164 };
165 ips = mkOption {
166 description = ''
167 attrs of ip4/ip6 grouped by section
168 '';
169 type = attrsOf (submodule {
170 options = {
171 ip4 = mkOption {
5400b9b6 172 type = str;
619e4f46
IB
173 description = ''
174 ip4 address of the host
175 '';
176 };
177 ip6 = mkOption {
5400b9b6 178 type = listOf str;
619e4f46
IB
179 default = [];
180 description = ''
181 ip6 addresses of the host
182 '';
183 };
184 };
185 });
186 };
187 };
188 };
ab8f306d
IB
189in
190{
191 options.myEnv = {
192 servers = mkOption {
193 description = ''
194 Attrs of servers information in the cluster (not necessarily handled by nixops)
195 '';
196 default = {};
619e4f46 197 type = attrsOf hostEnv;
ab8f306d
IB
198 };
199 hetznerCloud = mkOption {
200 description = ''
201 Hetzner Cloud credential information
202 '';
203 type = submodule {
204 options = {
205 authToken = mkOption {
206 type = str;
207 description = ''
208 The API auth token.
209 '';
210 };
211 };
212 };
213 };
214 hetzner = mkOption {
215 description = ''
216 Hetzner credential information
217 '';
218 type = submodule {
219 options = {
220 user = mkOption { type = str; description = "User"; };
221 pass = mkOption { type = str; description = "Password"; };
222 };
223 };
224 };
225 sshd = mkOption {
226 description = ''
227 sshd service credential information
228 '';
229 type = submodule {
230 options = {
231 ldap = mkOption {
232 description = ''
233 LDAP credentials for cn=ssh,ou=services,dc=immae,dc=eu dn
234 '';
235 type = submodule {
236 options = {
237 password = mkOption { description = "Password"; type = str; };
238 };
239 };
240 };
241 };
242 };
243 };
244 ports = mkOption {
245 description = ''
246 non-standard reserved ports. Must be unique!
247 '';
248 type = attrsOf port;
249 default = {};
250 apply = let
251 noDupl = x: builtins.length (builtins.attrValues x) == builtins.length (unique (builtins.attrValues x));
252 in
253 x: if isAttrs x && noDupl x then x else throw "Non unique values for ports";
254 };
255 httpd = mkOption {
256 description = ''
257 httpd service credential information
258 '';
259 type = submodule {
260 options = {
261 ldap = mkOption {
262 description = ''
263 LDAP credentials for cn=httpd,ou=services,dc=immae,dc=eu dn
264 '';
265 type = submodule {
266 options = {
267 password = mkOption { description = "Password"; type = str; };
268 };
269 };
270 };
271 };
272 };
273 };
6338573a
IB
274 smtp = mkOption {
275 type = submodule { options = smtpOptions; };
276 description = "SMTP configuration";
277 };
ab8f306d
IB
278 ldap = mkOption {
279 description = ''
280 LDAP server configuration
281 '';
282 type = submodule {
283 options = ldapOptions;
284 };
285 };
286 databases = mkOption {
287 description = "Databases configuration";
288 type = submodule {
289 options = {
290 mysql = mkOption {
291 type = submodule { options = mysqlOptions; };
292 description = "Mysql configuration";
293 };
294 redis = mkOption {
295 type = submodule { options = redisOptions; };
296 description = "Redis configuration";
297 };
298 postgresql = mkOption {
299 type = submodule { options = psqlOptions; };
300 description = "Postgresql configuration";
301 };
302 };
303 };
304 };
305 jabber = mkOption {
306 description = "Jabber configuration";
307 type = submodule {
308 options = {
5b53d86f 309 postfix_user_filter = mkOption { type = str; description = "Postfix filter to get xmpp users"; };
ab8f306d
IB
310 ldap = mkLdapOptions "Jabber" {};
311 postgresql = mkPsqlOptions "Jabber";
312 };
313 };
314 };
8a304ef4
IB
315 realUsers = mkOption {
316 description = ''
317 Attrset of function taking pkgs as argument.
318 Real users settings, should provide a subattr of users.users.<name>
319 with at least: name, (hashed)Password, shell
320 '';
321 type = attrsOf unspecified;
322 };
ab8f306d
IB
323 users = mkOption {
324 description = "System and regular users uid/gid";
325 type = attrsOf (submodule {
326 options = {
327 uid = mkOption {
328 description = "user uid";
329 type = int;
330 };
331 gid = mkOption {
332 description = "user gid";
333 type = int;
334 };
335 };
336 });
337 };
338 dns = mkOption {
339 description = "DNS configuration";
340 type = submodule {
341 options = {
342 soa = mkOption {
343 description = "SOA information";
344 type = submodule {
345 options = {
346 serial = mkOption {
347 description = "Serial number. Should be incremented at each change and unique";
348 type = str;
349 };
350 refresh = mkOption {
351 description = "Refresh time";
352 type = str;
353 };
354 retry = mkOption {
355 description = "Retry time";
356 type = str;
357 };
358 expire = mkOption {
359 description = "Expire time";
360 type = str;
361 };
362 ttl = mkOption {
363 description = "Default TTL time";
364 type = str;
365 };
366 email = mkOption {
367 description = "hostmaster e-mail";
368 type = str;
369 };
370 primary = mkOption {
371 description = "Primary NS";
372 type = str;
373 };
374 };
375 };
376 };
377 ns = mkOption {
378 description = "Attrs of NS servers group";
379 example = {
380 foo = {
381 "ns1.foo.com" = [ "198.51.100.10" "2001:db8:abcd::1" ];
382 "ns2.foo.com" = [ "198.51.100.15" "2001:db8:1234::1" ];
383 };
384 };
385 type = attrsOf (attrsOf (listOf str));
386 };
387 slaveZones = mkOption {
388 description = "List of slave zones";
389 type = listOf (submodule {
390 options = {
391 name = mkOption { type = str; description = "zone name"; };
392 masters = mkOption {
393 description = "NS master groups of this zone";
394 type = listOf str;
395 };
396 };
397 });
398 };
399 masterZones = mkOption {
400 description = "List of master zones";
401 type = listOf (submodule {
402 options = {
403 name = mkOption { type = str; description = "zone name"; };
404 slaves = mkOption {
405 description = "NS slave groups of this zone";
406 type = listOf str;
407 };
408 ns = mkOption {
409 description = "groups names that should have their NS entries listed here";
410 type = listOf str;
411 };
412 extra = mkOption {
413 description = "Extra zone configuration for bind";
414 example = ''
415 notify yes;
416 '';
417 type = lines;
418 };
419 entries = mkOption { type = lines; description = "Regular entries of the NS zone"; };
420 withEmail = mkOption {
421 description = "List of domains that should have mail entries (MX, dkim, SPF, ...)";
422 default = [];
423 type = listOf (submodule {
424 options = {
425 domain = mkOption { type = str; description = "Which subdomain is concerned"; };
426 send = mkOption { type = bool; description = "Whether there can be e-mails originating from the subdomain"; };
427 receive = mkOption { type = bool; description = "Whether there can be e-mails arriving to the subdomain"; };
428 };
429 });
430 };
431 };
432 });
433 };
434 };
435 };
436 };
437 backup = mkOption {
438 description = ''
439 Remote backup with duplicity
440 '';
441 type = submodule {
442 options = {
443 password = mkOption { type = str; description = "Password for encrypting files"; };
5a61f6ad
IB
444 remotes = mkOption {
445 type = attrsOf (submodule {
446 options = {
447 remote = mkOption {
448 type = unspecified;
449 example = literalExample ''
450 bucket: "s3://some_host/${bucket}";
451 '';
452 description = ''
453 Function.
454 Takes a bucket name as argument and returns a url
455 '';
456 };
457 accessKeyId = mkOption { type = str; description = "Remote access-key"; };
458 secretAccessKey = mkOption { type = str; description = "Remote access secret"; };
459 };
460 });
461 };
ab8f306d
IB
462 };
463 };
464 };
5dda316b
IB
465 zrepl_backup = mkOption {
466 type = submodule {
467 options = {
468 ssh_key = mkOption {
469 description = "SSH key information";
470 type = submodule {
471 options = {
472 public = mkOption { type = str; description = "Public part of the key"; };
473 private = mkOption { type = lines; description = "Private part of the key"; };
474 };
475 };
476 };
477 mysql = mkMysqlOptions "Zrepl" {};
478 };
479 };
480 };
ab8f306d
IB
481 rsync_backup = mkOption {
482 description =''
483 Rsync backup configuration from controlled host
484 '';
485 type = submodule {
486 options = {
ab8f306d
IB
487 ssh_key = mkOption {
488 description = "SSH key information";
489 type = submodule {
490 options = {
491 public = mkOption { type = str; description = "Public part of the key"; };
492 private = mkOption { type = lines; description = "Private part of the key"; };
493 };
494 };
495 };
496 profiles = mkOption {
497 description = "Attrs of profiles to backup";
498 type = attrsOf (submodule {
499 options = {
500 keep = mkOption { type = int; description = "Number of backups to keep"; };
46b7e627 501 check_command = mkOption { type = str; description = "command to check if backup needs to be done"; default = "backup"; };
ab8f306d
IB
502 login = mkOption { type = str; description = "Login to connect to host"; };
503 port = mkOption { type = str; default = "22"; description = "Port to connect to host"; };
504 host = mkOption { type = str; description = "Host to connect to"; };
505 host_key = mkOption { type = str; description = "Host key"; };
506 host_key_type = mkOption { type = str; description = "Host key type"; };
507 parts = mkOption {
508 description = "Parts to backup for this host";
509 type = attrsOf (submodule {
510 options = {
511 remote_folder = mkOption { type = path; description = "Remote folder to backup";};
512 exclude_from = mkOption {
513 type = listOf path;
514 default = [];
515 description = "List of folders/files to exclude from the backup";
516 };
517 files_from = mkOption {
518 type = listOf path;
519 default = [];
520 description = "List of folders/files to backup in the base folder";
521 };
522 args = mkOption {
523 type = nullOr str;
524 default = null;
525 description = "Extra arguments to pass to rsync";
526 };
527 };
528 });
529 };
530 };
531 });
532 };
533 };
534 };
535 };
536 monitoring = mkOption {
537 description = "Monitoring configuration";
538 type = submodule {
539 options = {
540 status_url = mkOption { type = str; description = "URL to push status to"; };
541 status_token = mkOption { type = str; description = "Token for the status url"; };
e820134d 542 http_user_password = mkOption { type = str; description = "HTTP credentials to check services behind wall"; };
ab8f306d 543 email = mkOption { type = str; description = "Admin E-mail"; };
e820134d
IB
544 ssh_public_key = mkOption { type = str; description = "SSH public key"; };
545 ssh_secret_key = mkOption { type = str; description = "SSH secret key"; };
546 imap_login = mkOption { type = str; description = "IMAP login"; };
547 imap_password = mkOption { type = str; description = "IMAP password"; };
25844101 548 eriomem_keys = mkOption { type = listOf (listOf str); description = "Eriomem keys"; default = []; };
6191bdeb
IB
549 ovh_sms = mkOption {
550 description = "OVH credentials for sms script";
551 type = submodule {
552 options = {
553 endpoint = mkOption { type = str; default = "ovh-eu"; description = "OVH endpoint"; };
554 application_key = mkOption { type = str; description = "Application key"; };
555 application_secret = mkOption { type = str; description = "Application secret"; };
556 consumer_key = mkOption { type = str; description = "Consumer key"; };
557 account = mkOption { type = str; description = "Account"; };
558 };
559 };
560 };
e820134d
IB
561 nrdp_tokens = mkOption { type = listOf str; description = "Tokens allowed to push status update"; };
562 slack_url = mkOption { type = str; description = "Slack webhook url to push status update"; };
563 slack_channel = mkOption { type = str; description = "Slack channel to push status update"; };
e43fdf34
IB
564 netdata_aggregator = mkOption { type = str; description = "Url where netdata information should be sent"; };
565 netdata_keys = mkOption { type = attrsOf str; description = "netdata host keys"; };
e820134d 566 contacts = mkOption { type = attrsOf unspecified; description = "Contact dicts to fill naemon objects"; };
71a2425e
IB
567 email_check = mkOption {
568 description = "Emails services to check";
569 type = attrsOf (submodule {
570 options = {
571 local = mkOption { type = bool; default = false; description = "Use local configuration"; };
572 port = mkOption { type = nullOr str; default = null; description = "Port to connect to ssh"; };
573 login = mkOption { type = nullOr str; default = null; description = "Login to connect to ssh"; };
574 targets = mkOption { type = listOf str; description = "Hosts to send E-mails to"; };
ef0a9217
IB
575 mail_address = mkOption { type = nullOr str; default = null; description = "E-mail recipient part to send e-mail to"; };
576 mail_domain = mkOption { type = nullOr str; default = null; description = "E-mail domain part to send e-mail to"; };
71a2425e
IB
577 };
578 });
579 };
ab8f306d
IB
580 };
581 };
582 };
583 mpd = mkOption {
584 description = "MPD configuration";
585 type = submodule {
586 options = {
587 folder = mkOption { type = str; description = "Folder to serve from the MPD instance"; };
588 password = mkOption { type = str; description = "Password to connect to the MPD instance"; };
589 host = mkOption { type = str; description = "Host to connect to the MPD instance"; };
590 port = mkOption { type = str; description = "Port to connect to the MPD instance"; };
591 };
592 };
593 };
594 ftp = mkOption {
595 description = "FTP configuration";
596 type = submodule {
597 options = {
598 ldap = mkLdapOptions "FTP" {};
599 };
600 };
601 };
ea9c6fe8
IB
602 vpn = mkOption {
603 description = "VPN configuration";
604 type = attrsOf (submodule {
605 options = {
606 prefix = mkOption { type = str; description = "ipv6 prefix for the vpn subnet"; };
607 privateKey = mkOption { type = str; description = "Private key for the host"; };
608 publicKey = mkOption { type = str; description = "Public key for the host"; };
609 };
610 });
611 };
ab8f306d
IB
612 mail = mkOption {
613 description = "Mail configuration";
614 type = submodule {
615 options = {
616 dmarc = mkOption {
617 description = "DMARC configuration";
618 type = submodule {
619 options = {
620 ignore_hosts = mkOption {
621 type = lines;
622 description = ''
623 Hosts to ignore when checking for dmarc
624 '';
625 };
626 };
627 };
628 };
629 dkim = mkOption {
630 description = "DKIM configuration";
631 type = attrsOf (submodule {
632 options = {
633 public = mkOption {
634 type = str;
635 example = ''
636 ( "v=DKIM1; k=rsa; "
637 "p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC3w1a2aMxWw9+hdcmbqX4UevcVqr204y0K73Wdc7MPZiOOlUJQYsMNSYR1Y/SC7jmPKeitpcJCpQgn/cveJZbuikjjPLsDReHyFEYmC278ZLRTELHx6f1IXM8WE08JIRT69CfZiMi1rVcOh9qRT4F93PyjCauU8Y5hJjtg9ThsWwIDAQAB" )
638 '';
639 description = "Public entry to put in DNS TXT field";
640 };
641 private = mkOption { type = str; description = "Private key"; };
642 };
643 });
644 };
645 postfix = mkOption {
646 description = "Postfix configuration";
647 type = submodule {
648 options = {
649 additional_mailbox_domains = mkOption {
650 description = ''
651 List of domains that are used as mailbox final destination, in addition to those defined in the DNS records
652 '';
653 type = listOf str;
654 };
87a8bffd
IB
655 mysql = mkMysqlOptions "Postfix" {
656 password_encrypt = mkOption { type = str; description = "Key to encrypt relay password in database"; };
657 };
ab8f306d
IB
658 backup_domains = mkOption {
659 description = ''
660 Domains that are accepted for relay as backup domain
661 '';
662 type = attrsOf (submodule {
663 options = {
664 domains = mkOption { type = listOf str; description = "Domains list"; };
665 relay_restrictions = mkOption {
666 type = lines;
667 description = ''
668 Restrictions for relaying the e-mails from the domains
669 '';
670 };
671 recipient_maps = mkOption {
672 description = ''
673 Recipient map to accept relay for.
674 Must be specified for domain, the rules apply to everyone!
675 '';
676 type = listOf (submodule {
677 options = {
678 type = mkOption {
679 type = enum [ "hash" ];
680 description = "Map type";
681 };
682 content = mkOption {
683 type = str;
684 description = "Map content";
685 };
686 };
687 });
688 };
689 };
690 });
691 };
692 };
693 };
694 };
695 dovecot = mkOption {
696 description = "Dovecot configuration";
697 type = submodule {
698 options = {
699 ldap = mkLdapOptions "Dovecot" {
700 pass_attrs = mkOption { type = str; description = "Password attribute in LDAP"; };
701 user_attrs = mkOption { type = str; description = "User attribute mapping in LDAP"; };
702 iterate_attrs = mkOption { type = str; description = "User attribute mapping for listing in LDAP"; };
703 iterate_filter = mkOption { type = str; description = "User attribute filter for listing in LDAP"; };
22b4bd78 704 postfix_mailbox_filter = mkOption { type = str; description = "Postfix filter to get mailboxes"; };
ab8f306d
IB
705 };
706 };
707 };
708 };
709 rspamd = mkOption {
710 description = "rspamd configuration";
711 type = submodule {
712 options = {
713 redis = mkRedisOptions "Redis";
714 read_password_hashed = mkOption { type = str; description = "Hashed read password for rspamd"; };
715 write_password_hashed = mkOption { type = str; description = "Hashed write password for rspamd"; };
716 read_password = mkOption {
717 type = str;
718 description = "Read password for rspamd. Unused";
719 apply = x: "";
720 };
721 write_password = mkOption {
722 type = str;
723 description = "Write password for rspamd. Unused";
724 apply = x: "";
725 };
726 };
727 };
728 };
729 scripts = mkOption {
730 description = "Mail script recipients";
731 type = attrsOf (submodule {
732 options = {
5b53d86f 733 external = mkEnableOption "Create a script_<name>@mail.immae.eu external address";
ab8f306d
IB
734 src = mkOption {
735 description = ''
736 git source to fetch the script from.
737 It must have a default.nix file as its root accepting a scriptEnv parameter
738 '';
739 type = submodule {
740 options = {
741 url = mkOption { type = str; description = "git url to fetch"; };
742 rev = mkOption { type = str; description = "git reference to fetch"; };
743 };
744 };
745 };
746 env = mkOption {
747 description = "Variables to pass to the script";
748 type = unspecified;
749 };
750 };
751 });
752 };
418a4ed7
IB
753 sympa = mkOption {
754 description = "Sympa configuration";
755 type = submodule {
756 options = {
757 listmasters = mkOption {
758 type = listOf str;
759 description = "Listmasters";
760 };
761 postgresql = mkPsqlOptions "Sympa";
762 data_sources = mkOption {
763 type = attrsOf str;
764 default = {};
765 description = "Data sources to make available to sympa";
766 };
767 scenari = mkOption {
768 type = attrsOf str;
769 default = {};
770 description = "Scenari to make available to sympa";
771 };
772 };
773 };
774 };
ab8f306d
IB
775 };
776 };
777 };
778 buildbot = mkOption {
779 description = "Buildbot configuration";
780 type = submodule {
781 options = {
782 user = mkOption {
783 description = "Buildbot user";
784 type = submodule {
785 options = {
786 uid = mkOption {
787 description = "user uid";
788 type = int;
789 };
790 gid = mkOption {
791 description = "user gid";
792 type = int;
793 };
794 };
795 };
796 };
797 ldap = mkOption {
798 description = "Ldap configuration for buildbot";
799 type = submodule {
800 options = {
801 password = mkOption { type = str; description = "Buildbot password"; };
802 };
803 };
804 };
805 projects = mkOption {
806 description = "Projects to make a buildbot for";
807 type = attrsOf (submodule {
808 options = {
809 name = mkOption { type = str; description = "Project name"; };
810 packages = mkOption {
811 type = unspecified;
812 example = literalExample ''
813 pkgs: [ pkgs.bash pkgs.git pkgs.gzip pkgs.openssh ];
814 '';
815 description = ''
816 Function.
817 Builds packages list to make available to buildbot project.
818 Takes pkgs as argument.
819 '';
820 };
821 pythonPackages = mkOption {
822 type = unspecified;
823 example = literalExample ''
824 p: pkgs: [ pkgs.python3Packages.pip ];
825 '';
826 description = ''
827 Function.
828 Builds python packages list to make available to buildbot project.
829 Takes buildbot python module as first argument and pkgs as second argument in order to augment the python modules list.
830 '';
831 };
832 pythonPathHome = mkOption { type = bool; description = "Whether to add project’s python home to python path"; };
833 secrets = mkOption {
834 type = attrsOf str;
835 description = "Secrets for the project to dump as files";
836 };
837 environment = mkOption {
838 type = attrsOf str;
839 description = ''
840 Environment variables for the project.
841 BUILDBOT_ is prefixed to the variable names
842 '';
843 };
844 activationScript = mkOption {
845 type = lines;
846 description = ''
847 Activation script to run during deployment
848 '';
849 };
850 builderPaths = mkOption {
851 type = attrsOf unspecified;
852 default = {};
853 description = ''
854 Attrs of functions to make accessible specifically per builder.
855 Takes pkgs as argument and should return a single path containing binaries.
856 This path will be accessible as BUILDBOT_PATH_<attrskey>
857 '';
858 };
859 webhookTokens = mkOption {
860 type = nullOr (listOf str);
861 default = null;
862 description = ''
863 List of tokens allowed to push to project’s change_hook/base endpoint
864 '';
865 };
866 };
867 });
868 };
869 };
870 };
871 };
872 tools = mkOption {
873 description = "Tools configurations";
874 type = submodule {
875 options = {
251c0a13 876 contact = mkOption { type = str; description = "Contact e-mail address"; };
4c42e0be
IB
877 assets = mkOption {
878 default = {};
879 type = attrsOf (submodule {
880 options = {
881 url = mkOption { type = str; description = "URL to fetch"; };
882 sha256 = mkOption { type = str; description = "Hash of the url"; };
883 };
884 });
885 description = "Assets to provide on assets.immae.eu";
886 };
ab8f306d
IB
887 davical = mkOption {
888 description = "Davical configuration";
889 type = submodule {
890 options = {
891 postgresql = mkPsqlOptions "Davical";
892 ldap = mkLdapOptions "Davical" {};
893 };
894 };
895 };
896 diaspora = mkOption {
897 description = "Diaspora configuration";
898 type = submodule {
899 options = {
900 postgresql = mkPsqlOptions "Diaspora";
901 redis = mkRedisOptions "Diaspora";
902 ldap = mkLdapOptions "Diaspora" {};
903 secret_token = mkOption { type = str; description = "Secret token"; };
904 };
905 };
906 };
7df5e532
IB
907 dmarc_reports = mkOption {
908 description = "DMARC reports configuration";
909 type = submodule {
910 options = {
911 mysql = mkMysqlOptions "DMARC" {};
9c08c3bc 912 anonymous_key = mkOption { type = str; description = "Anonymous hashing key"; };
7df5e532
IB
913 };
914 };
915 };
ab8f306d
IB
916 etherpad-lite = mkOption {
917 description = "Etherpad configuration";
918 type = submodule {
919 options = {
920 postgresql = mkPsqlOptions "Etherpad";
921 ldap = mkLdapOptions "Etherpad" {
922 group_filter = mkOption { type = str; description = "Filter for groups"; };
923 };
f0d942ac 924 adminPassword = mkOption { type = str; description = "Admin password for mypads / admin"; };
ab8f306d
IB
925 session_key = mkOption { type = str; description = "Session key"; };
926 api_key = mkOption { type = str; description = "API key"; };
927 redirects = mkOption { type = str; description = "Redirects for apache"; };
928 };
929 };
930 };
931 gitolite = mkOption {
932 description = "Gitolite configuration";
933 type = submodule {
934 options = {
935 ldap = mkLdapOptions "Gitolite" {};
936 };
937 };
938 };
939 kanboard = mkOption {
940 description = "Kanboard configuration";
941 type = submodule {
942 options = {
943 postgresql = mkPsqlOptions "Kanboard";
944 ldap = mkLdapOptions "Kanboard" {
945 admin_dn = mkOption { type = str; description = "Admin DN"; };
946 };
947 };
948 };
949 };
950 mantisbt = mkOption {
951 description = "Mantisbt configuration";
952 type = submodule {
953 options = {
954 postgresql = mkPsqlOptions "Mantisbt";
955 ldap = mkLdapOptions "Mantisbt" {};
956 master_salt = mkOption { type = str; description = "Master salt for password hash"; };
957 };
958 };
959 };
960 mastodon = mkOption {
961 description = "Mastodon configuration";
962 type = submodule {
963 options = {
964 postgresql = mkPsqlOptions "Mastodon";
965 redis = mkRedisOptions "Mastodon";
966 ldap = mkLdapOptions "Mastodon" {};
967 paperclip_secret = mkOption { type = str; description = "Paperclip secret"; };
968 otp_secret = mkOption { type = str; description = "OTP secret"; };
969 secret_key_base = mkOption { type = str; description = "Secret key base"; };
970 vapid = mkOption {
971 description = "vapid key";
972 type = submodule {
973 options = {
974 private = mkOption { type = str; description = "Private key"; };
975 public = mkOption { type = str; description = "Public key"; };
976 };
977 };
978 };
979 };
980 };
981 };
982 mediagoblin = mkOption {
983 description = "Mediagoblin configuration";
984 type = submodule {
985 options = {
986 postgresql = mkPsqlOptions "Mediagoblin";
987 redis = mkRedisOptions "Mediagoblin";
988 ldap = mkLdapOptions "Mediagoblin" {};
989 };
990 };
991 };
992 nextcloud = mkOption {
993 description = "Nextcloud configuration";
994 type = submodule {
995 options = {
996 postgresql = mkPsqlOptions "Peertube";
997 redis = mkRedisOptions "Peertube";
998 password_salt = mkOption { type = str; description = "Password salt"; };
999 instance_id = mkOption { type = str; description = "Instance ID"; };
1000 secret = mkOption { type = str; description = "App secret"; };
1001 };
1002 };
1003 };
1004 peertube = mkOption {
1005 description = "Peertube configuration";
1006 type = submodule {
1007 options = {
1008 listenPort = mkOption { type = port; description = "Port to listen to"; };
1009 postgresql = mkPsqlOptions "Peertube";
1010 redis = mkRedisOptions "Peertube";
1011 ldap = mkLdapOptions "Peertube" {};
1012 };
1013 };
1014 };
8a05c7fb
IB
1015 syden_peertube = mkOption {
1016 description = "Peertube Syden configuration";
1017 type = submodule {
1018 options = {
1019 listenPort = mkOption { type = port; description = "Port to listen to"; };
1020 postgresql = mkPsqlOptions "Peertube";
1021 redis = mkRedisOptions "Peertube";
1022 };
1023 };
1024 };
ab8f306d
IB
1025 phpldapadmin = mkOption {
1026 description = "phpLdapAdmin configuration";
1027 type = submodule {
1028 options = {
1029 ldap = mkLdapOptions "phpldapadmin" {};
1030 };
1031 };
1032 };
1033 rompr = mkOption {
1034 description = "Rompr configuration";
1035 type = submodule {
1036 options = {
1037 mpd = mkOption {
1038 description = "MPD configuration";
1039 type = submodule {
1040 options = {
1041 host = mkOption { type = str; description = "Host for MPD"; };
1042 port = mkOption { type = port; description = "Port to access MPD host"; };
1043 };
1044 };
1045 };
1046 };
1047 };
1048 };
1049 roundcubemail = mkOption {
1050 description = "Roundcubemail configuration";
1051 type = submodule {
1052 options = {
1053 postgresql = mkPsqlOptions "TT-RSS";
1054 secret = mkOption { type = str; description = "Secret"; };
1055 };
1056 };
1057 };
1058 shaarli = mkOption {
1059 description = "Shaarli configuration";
1060 type = submodule {
1061 options = {
1062 ldap = mkLdapOptions "Shaarli" {};
1063 };
1064 };
1065 };
a97118c4
IB
1066 status_engine = mkOption {
1067 description = "Status Engine configuration";
1068 type = submodule {
1069 options = {
1070 mysql = mkMysqlOptions "StatusEngine" {};
1071 ldap = mkLdapOptions "StatusEngine" {};
1072 };
1073 };
1074 };
ab8f306d
IB
1075 task = mkOption {
1076 description = "Taskwarrior configuration";
1077 type = submodule {
1078 options = {
1079 ldap = mkLdapOptions "Taskwarrior" {};
1080 taskwarrior-web = mkOption {
1081 description = "taskwarrior-web profiles";
1082 type = attrsOf (submodule {
1083 options = {
1084 uid = mkOption {
1085 type = listOf str;
1086 description = "List of ldap uids having access to this profile";
1087 };
1088 org = mkOption { type = str; description = "Taskd organisation"; };
1089 key = mkOption { type = str; description = "Taskd key"; };
1090 date = mkOption { type = str; description = "Preferred date format"; };
1091 };
1092 });
1093 };
1094 };
1095 };
1096 };
1097 ttrss = mkOption {
1098 description = "TT-RSS configuration";
1099 type = submodule {
1100 options = {
1101 postgresql = mkPsqlOptions "TT-RSS";
1102 ldap = mkLdapOptions "TT-RSS" {};
1103 };
1104 };
1105 };
1106 wallabag = mkOption {
1107 description = "Wallabag configuration";
1108 type = submodule {
1109 options = {
1110 postgresql = mkPsqlOptions "Wallabag";
1111 ldap = mkLdapOptions "Wallabag" {
1112 admin_filter = mkOption { type = str; description = "Admin users filter"; };
1113 };
1114 redis = mkRedisOptions "Wallabag";
1115 secret = mkOption { type = str; description = "App secret"; };
1116 };
1117 };
1118 };
251c0a13
IB
1119 webhooks = mkOption {
1120 type = attrsOf str;
1121 description = "Mapping 'name'.php => script for webhooks";
1122 };
68c45ad5
IB
1123 csp_reports = mkOption {
1124 description = "CSP report configuration";
1125 type = submodule {
1126 options = {
1127 report_uri = mkOption { type = str; description = "URI to report CSP violations to"; };
1128 policies = mkOption { type = attrsOf str; description = "CSP policies to apply"; };
1129 postgresql = mkPsqlOptions "CSP reports";
1130 };
1131 };
1132 };
6338573a
IB
1133 commento = mkOption {
1134 description = "Commento configuration";
1135 type = submodule {
1136 options = {
1137 listenPort = mkOption { type = port; description = "Port to listen to"; };
1138 postgresql = mkPsqlOptions "Commento";
1139 smtp = mkSmtpOptions "Commento";
1140 };
1141 };
1142 };
ab8f306d
IB
1143 ympd = mkOption {
1144 description = "Ympd configuration";
1145 type = submodule {
1146 options = {
1147 listenPort = mkOption { type = port; description = "Port to listen to"; };
1148 mpd = mkOption {
1149 description = "MPD configuration";
1150 type = submodule {
1151 options = {
1152 password = mkOption { type = str; description = "Password to access MPD host"; };
1153 host = mkOption { type = str; description = "Host for MPD"; };
1154 port = mkOption { type = port; description = "Port to access MPD host"; };
1155 };
1156 };
1157 };
1158 };
1159 };
1160 };
1161 yourls = mkOption {
1162 description = "Yourls configuration";
1163 type = submodule {
1164 options = {
87a8bffd 1165 mysql = mkMysqlOptions "Yourls" {};
ab8f306d
IB
1166 ldap = mkLdapOptions "Yourls" {};
1167 cookieKey = mkOption { type = str; description = "Cookie key"; };
1168 };
1169 };
1170 };
1171 };
1172 };
1173 };
1174 websites = mkOption {
1175 description = "Websites configurations";
1176 type = submodule {
1177 options = {
91b3d06b
IB
1178 immae = mkOption {
1179 description = "Immae configuration by environment";
1180 type = submodule {
1181 options = {
1182 temp = mkOption {
1183 description = "Temp configuration";
1184 type = submodule {
1185 options = {
1186 ldap = mkLdapOptions "Immae temp" {
1187 filter = mkOption { type = str; description = "Filter for user access"; };
1188 };
1189 };
1190 };
1191 };
1192 };
1193 };
1194 };
829ef7f1
IB
1195 isabelle = mkOption {
1196 description = "Isabelle configurations by environment";
ab8f306d
IB
1197 type =
1198 let
1199 atenSubmodule = mkOption {
1200 description = "environment configuration";
1201 type = submodule {
1202 options = {
1203 environment = mkOption { type = str; description = "Symfony environment"; };
1204 secret = mkOption { type = str; description = "Symfony App secret"; };
1205 postgresql = mkPsqlOptions "Aten";
1206 };
1207 };
1208 };
1209 in
1210 submodule {
1211 options = {
829ef7f1
IB
1212 aten_production = atenSubmodule;
1213 aten_integration = atenSubmodule;
423c3f1c
IB
1214 iridologie = mkOption {
1215 description = "environment configuration";
1216 type = submodule {
1217 options = {
1218 environment = mkOption { type = str; description = "SPIP environment"; };
1219 mysql = mkMysqlOptions "Iridologie" {};
1220 ldap = mkLdapOptions "Iridologie" {};
1221 };
1222 };
1223 };
ab8f306d
IB
1224 };
1225 };
1226 };
1227 chloe = mkOption {
1228 description = "Chloe configurations by environment";
1229 type =
1230 let
1231 chloeSubmodule = mkOption {
1232 description = "environment configuration";
1233 type = submodule {
1234 options = {
423c3f1c 1235 environment = mkOption { type = str; description = "SPIP environment"; };
87a8bffd 1236 mysql = mkMysqlOptions "Chloe" {};
ab8f306d
IB
1237 ldap = mkLdapOptions "Chloe" {};
1238 };
1239 };
1240 };
1241 in
1242 submodule {
1243 options = {
1244 production = chloeSubmodule;
1245 integration = chloeSubmodule;
1246 };
1247 };
1248 };
1249 connexionswing = mkOption {
1250 description = "Connexionswing configurations by environment";
1251 type =
1252 let
1253 csSubmodule = mkOption {
1254 description = "environment configuration";
1255 type = submodule {
1256 options = {
1257 environment = mkOption { type = str; description = "Symfony environment"; };
87a8bffd 1258 mysql = mkMysqlOptions "Connexionswing" {};
ab8f306d
IB
1259 secret = mkOption { type = str; description = "Symfony App secret"; };
1260 email = mkOption { type = str; description = "Symfony email notification"; };
1261 };
1262 };
1263 };
1264 in
1265 submodule {
1266 options = {
1267 production = csSubmodule;
1268 integration = csSubmodule;
1269 };
1270 };
1271 };
1272 jerome = mkOption {
1273 description = "Naturaloutil configuration";
1274 type = submodule {
1275 options = {
87a8bffd 1276 mysql = mkMysqlOptions "Naturaloutil" {};
ab8f306d
IB
1277 server_admin = mkOption { type = str; description = "Server admin e-mail"; };
1278 };
1279 };
1280 };
d3452fc5 1281 telio_tortay = mkOption {
ab8f306d
IB
1282 description = "Telio Tortay configuration";
1283 type = submodule {
1284 options = {
1285 server_admin = mkOption { type = str; description = "Server admin e-mail"; };
1286 };
1287 };
1288 };
d3452fc5 1289 ludivine = mkOption {
ab8f306d
IB
1290 description = "Ludivinecassal configurations by environment";
1291 type =
1292 let
1293 lcSubmodule = mkOption {
1294 description = "environment configuration";
1295 type = submodule {
1296 options = {
1297 environment = mkOption { type = str; description = "Symfony environment"; };
87a8bffd 1298 mysql = mkMysqlOptions "LudivineCassal" {};
ab8f306d
IB
1299 ldap = mkLdapOptions "LudivineCassal" {};
1300 secret = mkOption { type = str; description = "Symfony App secret"; };
1301 };
1302 };
1303 };
1304 in
1305 submodule {
1306 options = {
1307 production = lcSubmodule;
1308 integration = lcSubmodule;
1309 };
1310 };
1311 };
1312 emilia = mkOption {
1313 description = "Emilia configuration";
1314 type = submodule {
1315 options = {
1316 postgresql = mkPsqlOptions "Emilia";
1317 };
1318 };
1319 };
1320 florian = mkOption {
1321 description = "Florian configuration";
1322 type = submodule {
1323 options = {
1324 server_admin = mkOption { type = str; description = "Server admin e-mail"; };
1325 };
1326 };
1327 };
1328 nassime = mkOption {
1329 description = "Nassime configuration";
1330 type = submodule {
1331 options = {
1332 server_admin = mkOption { type = str; description = "Server admin e-mail"; };
1333 };
1334 };
1335 };
1336 piedsjaloux = mkOption {
1337 description = "Piedsjaloux configurations by environment";
1338 type =
1339 let
1340 pjSubmodule = mkOption {
1341 description = "environment configuration";
1342 type = submodule {
1343 options = {
1344 environment = mkOption { type = str; description = "Symfony environment"; };
87a8bffd 1345 mysql = mkMysqlOptions "Piedsjaloux" {};
ab8f306d
IB
1346 secret = mkOption { type = str; description = "Symfony App secret"; };
1347 };
1348 };
1349 };
1350 in
1351 submodule {
1352 options = {
1353 production = pjSubmodule;
1354 integration = pjSubmodule;
1355 };
1356 };
1357 };
91b75ffe
IB
1358 richie = mkOption {
1359 description = "Europe Richie configurations by environment";
1360 type = submodule {
1361 options = {
87a8bffd 1362 mysql = mkMysqlOptions "Richie" {};
91b75ffe
IB
1363 smtp_mailer = mkOption {
1364 description = "SMTP mailer configuration";
1365 type = submodule {
1366 options = {
1367 user = mkOption { type = str; description = "Username"; };
1368 password = mkOption { type = str; description = "Password"; };
1369 };
1370 };
1371 };
1372 };
1373 };
1374 };
6c95e93c
IB
1375 caldance = mkOption {
1376 description = "Caldance configurations by environment";
1377 type = submodule {
1378 options = {
1379 integration = mkOption {
1380 description = "environment configuration";
1381 type = submodule {
1382 options = {
1383 password = mkOption { type = str; description = "Password file content for basic auth"; };
1384 };
1385 };
1386 };
1387 };
1388 };
1389 };
ab8f306d
IB
1390 tellesflorian = mkOption {
1391 description = "Tellesflorian configurations by environment";
1392 type =
1393 let
1394 tfSubmodule = mkOption {
1395 description = "environment configuration";
1396 type = submodule {
1397 options = {
1398 environment = mkOption { type = str; description = "Symfony environment"; };
87a8bffd 1399 mysql = mkMysqlOptions "Tellesflorian" {};
ab8f306d
IB
1400 secret = mkOption { type = str; description = "Symfony App secret"; };
1401 invite_passwords = mkOption { type = str; description = "Password basic auth"; };
1402 };
1403 };
1404 };
1405 in
1406 submodule {
1407 options = {
1408 integration = tfSubmodule;
1409 };
1410 };
1411 };
1412 };
1413 };
1414 };
1415
1416 privateFiles = mkOption {
1417 type = path;
1418 description = ''
1419 Path to secret files to make available during build
1420 '';
1421 };
1422 };
619e4f46
IB
1423 options.hostEnv = mkOption {
1424 readOnly = true;
1425 type = hostEnv;
1426 default = config.myEnv.servers."${name}";
1427 description = "Host environment";
ab8f306d
IB
1428 };
1429}