my Nix configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mail.nix 974B

1234567891011121314151617181920212223242526272829303132333435363738
  1. { config, pkgs, lib, ... }:
  2. let
  3. cfg = config.services.yorick.mail;
  4. in
  5. {
  6. imports = [
  7. ../modules/mailz.nix
  8. ../modules/backup.nix
  9. ];
  10. options.services.yorick.mail = with lib; {
  11. enable = mkEnableOption "mail service";
  12. mainUser = mkOption { type = types.string; };
  13. users = mkOption {};
  14. };
  15. config = lib.mkIf cfg.enable {
  16. # email
  17. services.mailz = rec {
  18. domain = config.networking.hostName;
  19. keydir = "${config.security.acme.directory}/${domain}";
  20. inherit (cfg) mainUser users;
  21. };
  22. security.acme.certs.${config.networking.hostName}.postRun = ''
  23. systemctl reload dovecot2.service postfix.service
  24. '';
  25. services.backup = {
  26. enable = true;
  27. backups = {
  28. mail = {
  29. dir = "/var/spool/mail";
  30. remote = "webdavs://mail@yorickvp.stackstorage.com/remote.php/webdav//mail_bak";
  31. keyfile = "/var/backup/creds";
  32. interval = "daily";
  33. };
  34. };
  35. };
  36. };
  37. }