neomutt: Add encryptByDefault support (#1882)

Adds support for encryptByDefault to the neomutt module using the
crypt_opportunistic_encrypt option.
This commit is contained in:
Sumner Evans 2021-04-07 13:45:50 -06:00 committed by GitHub
parent c12897e8e1
commit be56b6f2c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 69 additions and 0 deletions

View File

@ -189,6 +189,7 @@ let
# GPG section
set crypt_use_gpgme = yes
set crypt_autosign = ${yesno (gpg.signByDefault or false)}
set crypt_opportunistic_encrypt = ${yesno (gpg.encryptByDefault or false)}
set pgp_use_gpg_agent = yes
set mbox_type = ${if maildir != null then "Maildir" else "mbox"}
set sort = "${cfg.sort}"

View File

@ -6,4 +6,5 @@
neomutt-with-binds-with-warning = ./neomutt-with-binds-with-warning.nix;
neomutt-with-binds-invalid-settings =
./neomutt-with-binds-invalid-settings.nix;
neomutt-with-gpg = ./neomutt-with-gpg.nix;
}

View File

@ -5,6 +5,7 @@ set certificate_file=/etc/ssl/certs/ca-certificates.crt
# GPG section
set crypt_use_gpgme = yes
set crypt_autosign = no
set crypt_opportunistic_encrypt = no
set pgp_use_gpg_agent = yes
set mbox_type = Maildir
set sort = "threads"

View File

@ -0,0 +1,32 @@
# Generated by Home Manager.
set ssl_force_tls = yes
set certificate_file=/etc/ssl/certs/ca-certificates.crt
# GPG section
set crypt_use_gpgme = yes
set crypt_autosign = yes
set crypt_opportunistic_encrypt = yes
set pgp_use_gpg_agent = yes
set mbox_type = Maildir
set sort = "threads"
# MTA section
set smtp_pass="`password-command`"
set smtp_url='smtps://home.manager@smtp.example.com'
# MRA section
set folder='/home/hm-user/Mail/hm@example.com'
set from='hm@example.com'
set postponed='+Drafts'
set realname='H. M. Test'
set record='+Sent'
set spoolfile='+Inbox'
set trash='+Trash'
# Extra configuration

View File

@ -5,6 +5,7 @@ set certificate_file=/etc/ssl/certs/ca-certificates.crt
# GPG section
set crypt_use_gpgme = yes
set crypt_autosign = no
set crypt_opportunistic_encrypt = no
set pgp_use_gpg_agent = yes
set mbox_type = Maildir
set sort = "threads"

View File

@ -0,0 +1,33 @@
{ config, lib, pkgs, ... }:
with lib; {
imports = [ ../../accounts/email-test-accounts.nix ];
config = {
accounts.email.accounts = {
"hm@example.com" = {
gpg = {
encryptByDefault = true;
signByDefault = true;
};
neomutt.enable = true;
imap.port = 993;
};
};
programs.neomutt.enable = true;
nixpkgs.overlays =
[ (self: super: { neomutt = pkgs.writeScriptBin "dummy-neomutt" ""; }) ];
nmt.script = ''
assertFileExists home-files/.config/neomutt/neomuttrc
assertFileExists home-files/.config/neomutt/hm@example.com
assertFileContent home-files/.config/neomutt/neomuttrc ${
./neomutt-expected.conf
}
assertFileContent home-files/.config/neomutt/hm@example.com ${
./hm-example.com-gpg-expected.conf
}
'';
};
}