diff options
Diffstat (limited to 'modules/communication/neomutt')
5 files changed, 34 insertions, 28 deletions
diff --git a/modules/communication/neomutt/account/assertions.nix b/modules/communication/neomutt/account/assertions.nix index c19ab72..5c30311 100644 --- a/modules/communication/neomutt/account/assertions.nix +++ b/modules/communication/neomutt/account/assertions.nix @@ -5,12 +5,12 @@ { assertion = !config.communication.neomutt.enable - || !lib.any (account: account.enable && account.passwordGopassSecret != null) ( + || !lib.any (account: account.enable && account.password-gopass-secret != null) ( lib.attrValues config.communication.neomutt.accounts ) || config.security.gopass.enable; message = '' - An enabled communication.neomutt account uses passwordGopassSecret but security.gopass.enable is not set. + An enabled communication.neomutt account uses password-gopass-secret but security.gopass.enable is not set. Enable security.gopass to provide the account password command. ''; } diff --git a/modules/communication/neomutt/account/default.nix b/modules/communication/neomutt/account/default.nix index e2d92eb..61256e1 100644 --- a/modules/communication/neomutt/account/default.nix +++ b/modules/communication/neomutt/account/default.nix @@ -21,17 +21,19 @@ config = lib.mkIf config.communication.neomutt.enable { accounts.email.accounts = lib.mapAttrs (accountName: accountInformation: { - inherit (accountInformation) realName address primary; + inherit (accountInformation) address primary; + + realName = accountInformation.real-name; userName = - if accountInformation.userName != null then - accountInformation.userName + if accountInformation.username != null then + accountInformation.username else accountInformation.address; passwordCommand = - if accountInformation.passwordGopassSecret != null then - "${lib.getExe config.security.gopass.package} -o ${accountInformation.passwordGopassSecret}" + if accountInformation.password-gopass-secret != null then + "${lib.getExe config.security.gopass.package} -o ${accountInformation.password-gopass-secret}" else null; @@ -50,7 +52,7 @@ neomutt = { enable = true; - mailboxType = accountInformation.neomutt.mailboxType; + mailboxType = accountInformation.neomutt.mailbox-type; extraConfig = accountInformation.neomutt.extraConfig; }; @@ -71,7 +73,7 @@ enable = true; neomutt = { enable = true; - virtualMailboxes = accountInformation.notmuch.neomutt.virtualMailboxes; + virtualMailboxes = accountInformation.notmuch.neomutt.virtual-mailboxes; }; }; @@ -80,7 +82,7 @@ port = accountInformation.imap.port; tls = { enable = accountInformation.imap.tls.enable; - useStartTls = accountInformation.imap.tls.useStartTls; + useStartTls = accountInformation.imap.tls.use-start-tls; }; }; @@ -89,14 +91,14 @@ port = accountInformation.smtp.port; tls = { enable = accountInformation.smtp.tls.enable; - useStartTls = accountInformation.smtp.tls.useStartTls; + useStartTls = accountInformation.smtp.tls.use-start-tls; }; }; gpg = lib.optionalAttrs (accountInformation.gpg.key != null) { key = accountInformation.gpg.key; - signByDefault = accountInformation.gpg.signByDefault; - encryptByDefault = accountInformation.gpg.encryptByDefault; + signByDefault = accountInformation.gpg.sign-by-default; + encryptByDefault = accountInformation.gpg.encrypt-by-default; }; signature = @@ -105,7 +107,7 @@ { text = accountInformation.signature.text; command = accountInformation.signature.command; - showSignature = accountInformation.signature.showSignature; + showSignature = accountInformation.signature.show-signature; }; }) (lib.filterAttrs (n: a: a.enable) config.communication.neomutt.accounts); }; diff --git a/modules/communication/neomutt/account/flavors/gmail/default.nix b/modules/communication/neomutt/account/flavors/gmail/default.nix index 66d7db3..5b3c098 100644 --- a/modules/communication/neomutt/account/flavors/gmail/default.nix +++ b/modules/communication/neomutt/account/flavors/gmail/default.nix @@ -32,7 +32,7 @@ neomutt.extraConfig = lib.mkBefore (builtins.readFile ./.muttrc); - notmuch.neomutt.virtualMailboxes = lib.mkDefault [ + notmuch.neomutt.virtual-mailboxes = lib.mkDefault [ { name = "All Mail"; query = "folder:${name}/Inbox or folder:\"${name}/[Gmail]/Sent Mail\""; diff --git a/modules/communication/neomutt/account/options.nix b/modules/communication/neomutt/account/options.nix index 45e6744..676f8b0 100644 --- a/modules/communication/neomutt/account/options.nix +++ b/modules/communication/neomutt/account/options.nix @@ -6,7 +6,7 @@ default = true; }; - realName = lib.mkOption { + real-name = lib.mkOption { type = lib.types.str; description = "Name displayed when sending mails."; }; @@ -16,13 +16,13 @@ description = "Email address of this account."; }; - userName = lib.mkOption { + username = lib.mkOption { type = lib.types.nullOr lib.types.str; default = null; description = "Server username. Defaults to address if null."; }; - passwordGopassSecret = lib.mkOption { + password-gopass-secret = lib.mkOption { type = lib.types.nullOr lib.types.str; default = null; description = "Gopass secret path (e.g. mail/user@gmail.com). Constructs passwordCommand automatically."; @@ -81,7 +81,7 @@ }; neomutt = { - mailboxType = lib.mkOption { + mailbox-type = lib.mkOption { type = lib.types.enum [ "maildir" "imap" @@ -178,7 +178,7 @@ notmuch = { neomutt = { - virtualMailboxes = lib.mkOption { + virtual-mailboxes = lib.mkOption { type = lib.types.listOf ( lib.types.submodule { options = { @@ -237,7 +237,7 @@ description = "Enable TLS."; }; - useStartTls = lib.mkOption { + use-start-tls = lib.mkOption { type = lib.types.bool; default = false; description = "Use STARTTLS."; @@ -265,7 +265,7 @@ description = "Enable TLS."; }; - useStartTls = lib.mkOption { + use-start-tls = lib.mkOption { type = lib.types.bool; default = false; description = "Use STARTTLS."; @@ -280,13 +280,13 @@ description = "GPG key to use."; }; - signByDefault = lib.mkOption { + sign-by-default = lib.mkOption { type = lib.types.bool; default = false; description = "Sign messages by default."; }; - encryptByDefault = lib.mkOption { + encrypt-by-default = lib.mkOption { type = lib.types.bool; default = false; description = "Encrypt messages by default."; @@ -306,7 +306,7 @@ description = "Command that generates a signature."; }; - showSignature = lib.mkOption { + show-signature = lib.mkOption { type = lib.types.nullOr ( lib.types.enum [ "append" diff --git a/modules/communication/neomutt/default.nix b/modules/communication/neomutt/default.nix index 018555f..e091a7d 100644 --- a/modules/communication/neomutt/default.nix +++ b/modules/communication/neomutt/default.nix @@ -6,6 +6,8 @@ ... }: let + cfg = config.communication.neomutt; + neomuttSyncScript = pkgs.writeShellApplication { name = "neomutt-sync"; runtimeInputs = [ @@ -61,13 +63,15 @@ in }; config = lib.mkMerge [ - (lib.mkIf config.communication.neomutt.enable { + (lib.mkIf cfg.enable { accounts.email.maildirBasePath = "${config.home.homeDirectory}/.local/share/mail"; home.sessionVariables.MAILDIR = config.accounts.email.maildirBasePath; xdg.configFile."neomutt/mailcap".text = builtins.replaceStrings [ "@@HTML_VIEWER@@" ] [ (lib.getExe config.web.chawan.package) ] (builtins.readFile ./mailcap); + home.file.".local/share/icons/hicolor/scalable/apps/neomutt.svg".source = + config.lib.file.mkOutOfStoreSymlink "${config.programs.neomutt.package}/share/neomutt/logo/neomutt.svg"; programs.neomutt = { enable = true; package = pkgs.symlinkJoin { @@ -93,11 +97,11 @@ in ); }; }) - (lib.mkIf (config.communication.neomutt.enable && config.terminal.kitty.enable) { + (lib.mkIf (cfg.enable && config.terminal.kitty.enable) { xdg.desktopEntries."neomutt" = { name = "NeoMutt"; exec = "${lib.getExe config.terminal.kitty.package} --class neomutt -e ${lib.getExe config.programs.neomutt.package}"; - icon = "${config.programs.neomutt.package}/share/neomutt/logo/neomutt.svg"; + icon = "neomutt"; categories = [ "Network" "Email" |
