Skip to content

Email

Source directory: modules/email/

default.nix

modules/email/auth/default.nix

  • Enable option: Email authentication system

Options: enable, method, appPasswords, email, passwordFile

Options declaration (Nix)
  options.features.email.auth = {
    enable = mkEnableOption "Email authentication system";

    method = mkOption {
      type = types.enum [ "oauth2" "app-password" ];
      default = "oauth2";
      description = "Authentication method to use for Gmail accounts";
    };

    appPasswords = mkOption {
      type = types.attrsOf (types.submodule {
        options = {
          email = mkOption {
            type = types.str;
            description = "Gmail account email address";
          };

          passwordFile = mkOption {
            type = types.path;
            description = "Path to file containing app-specific password";
          };
        };
      });
      default = { };
      description = "App-specific password configuration for Gmail accounts";
    };
  }

oauth2.nix

modules/email/auth/oauth2.nix

  • Enable option: OAuth2 authentication for Gmail accounts

Options: enable, clientId, clientSecretFile, accounts, email, refreshTokenFile, accessTokenFile

Options declaration (Nix)
  options.features.email.auth.oauth2 = {
    enable = mkEnableOption "OAuth2 authentication for Gmail accounts";

    clientCredentials = {
      clientId = mkOption {
        type = types.str;
        description = "OAuth2 client ID for Gmail API access";
        default = "";
      };

      clientSecretFile = mkOption {
        type = types.path;
        description = "Path to file containing OAuth2 client secret";
        default = "/run/agenix/gmail-oauth2-client-secret";
      };
    };

    accounts = mkOption {
      type = types.attrsOf (types.submodule {
        options = {
          email = mkOption {
            type = types.str;
            description = "Gmail account email address";
          };

          refreshTokenFile = mkOption {
            type = types.path;
            description = "Path to file containing OAuth2 refresh token";
          };

          accessTokenFile = mkOption {
            type = types.path;
            description = "Path to file containing OAuth2 access token";
          };
        };
      });
      default = { };
      description = "OAuth2 configuration for Gmail accounts";
    };
  }

default.nix

modules/email/default.nix

  • Enable option: Email system with NeoMutt and Gmail integration
  • Enable option: NeoMutt email client
  • Enable option: Email authentication system
  • Enable option: AI-powered email processing
  • Enable option: Email notifications via SwayNC

Options: enable, primary, secondary, provider, highPriorityOnly

Options declaration (Nix)
  options.features.email = {
    enable = mkEnableOption "Email system with NeoMutt and Gmail integration";

    accounts = {
      primary = mkOption {
        type = types.str;
        default = "olaf@freundcloud.com";
        description = "Primary email account";
      };

      secondary = mkOption {
        type = types.str;
        default = "olaf.loken@gmail.com";
        description = "Secondary email account";
      };
    };

    neomutt = {
      enable = mkEnableOption "NeoMutt email client" // { default = true; };
    };

    # auth = {
    #   enable = mkEnableOption "Email authentication system" // { default = true; };
    #   method = mkOption {
    #     type = types.enum [ "oauth2" "app-password" ];
    #     default = "oauth2";
    #     description = "Authentication method for Gmail accounts";
    #   };
    # };

    ai = {
      enable = mkEnableOption "AI-powered email processing";
      provider = mkOption {
        type = types.enum [ "openai" "anthropic" "gemini" ];
        default = "openai";
        description = "AI provider for email processing";
      };
    };

    notifications = {
      enable = mkEnableOption "Email notifications via SwayNC";
      highPriorityOnly = mkOption {
        type = types.bool;
        default = true;
        description = "Only show notifications for high-priority emails";
      };
    };
  }

accounts.nix

modules/email/neomutt/accounts.nix

No option declarations; see source for implementation.

default.nix

modules/email/neomutt/default.nix

No option declarations; see source for implementation.

theme.nix

modules/email/neomutt/theme.nix

No option declarations; see source for implementation.