himalaya: improve derivation for v0.7.X (#3664)

* himalaya: add soywod to maintainers

* himalaya: make the config safer

Also added two services and more tests.

* himalaya: fix doc + typos

* himalaya: use freeform

* himalaya: run ./format

* himalaya: make use of mkPackageOption
This commit is contained in:
Clément DOUIN 2023-05-04 12:28:08 +02:00 committed by GitHub
parent 514c0a71f4
commit 6abb775e75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 386 additions and 135 deletions

View file

@ -1,25 +1,24 @@
display-name = ""
downloads-dir = "/data/download"
["hm@example.com"]
backend = "imap"
default = true
display-name = "H. M. Test"
email = "hm@example.com"
email-listing-page-size = 50
imap-host = "imap.example.com"
imap-login = "home.manager"
imap-passwd-cmd = "'password-command'"
imap-port = 995
imap-passwd-cmd = "password-command"
imap-port = 993
imap-ssl = true
imap-starttls = false
sender = "smtp"
smtp-host = "smtp.example.com"
smtp-login = "home.manager"
smtp-passwd-cmd = "'password-command'"
smtp-passwd-cmd = "password-command"
smtp-port = 465
smtp-ssl = true
smtp-starttls = false
["hm@example.com".mailboxes]
draft = "Drafts"
inbox = "In"
sent = "Out"
["hm@example.com".folder-aliases]
drafts = "Drafts"
inbox = "Inbox"
sent = "Sent"
trash = "Trash"

View file

@ -0,0 +1,28 @@
{ config, lib, pkgs, ... }:
with lib;
{
imports = [ ../../accounts/email-test-accounts.nix ];
accounts.email.accounts = {
"hm@example.com" = {
imap.port = 993;
smtp.port = 465;
himalaya.enable = true;
himalaya.backend = "deprecated";
himalaya.sender = "deprecated";
};
};
programs.himalaya = { enable = true; };
test.stubs.himalaya = { };
nmt.script = ''
assertFileExists home-files/.config/himalaya/config.toml
assertFileContent home-files/.config/himalaya/config.toml ${
./basic-expected.toml
}
'';
}

View file

@ -1 +1,5 @@
{ himalaya = ./himalaya.nix; }
{
himalaya-basic = ./basic.nix;
himalaya-imap-smtp = ./imap-smtp.nix;
himalaya-maildir-sendmail = ./maildir-sendmail.nix;
}

View file

@ -0,0 +1,29 @@
email-listing-page-size = 40
["hm@example.com"]
backend = "imap"
default = true
display-name = "H. M. Test"
email = "hm@example.com"
email-listing-page-size = 50
folder-listing-page-size = 50
imap-host = "imap.example.com"
imap-login = "home.manager"
imap-passwd-cmd = "password-command"
imap-port = 143
imap-ssl = false
imap-starttls = false
sender = "smtp"
smtp-host = "smtp.example.com"
smtp-login = "home.manager"
smtp-passwd-cmd = "password-command"
smtp-port = 465
smtp-ssl = true
smtp-starttls = true
["hm@example.com".folder-aliases]
custom = "Custom"
drafts = "D"
inbox = "In2"
sent = "Out"
trash = "Trash"

View file

@ -0,0 +1,58 @@
{ config, lib, pkgs, ... }:
with lib;
{
accounts.email.accounts = {
"hm@example.com" = {
primary = true;
address = "hm@example.com";
userName = "home.manager";
realName = "H. M. Test";
passwordCommand = "password-command";
imap = {
host = "imap.example.com";
port = 143;
tls = { enable = false; };
};
smtp = {
host = "smtp.example.com";
port = 465;
tls = {
enable = true;
useStartTls = true;
};
};
folders = {
inbox = "In";
sent = "Out";
drafts = "D";
};
himalaya = {
enable = true;
settings = {
folder-listing-page-size = 50;
email-listing-page-size = 50;
folder-aliases = {
inbox = "In2";
custom = "Custom";
};
};
};
};
};
programs.himalaya = {
enable = true;
settings = { email-listing-page-size = 40; };
};
test.stubs.himalaya = { };
nmt.script = ''
assertFileExists home-files/.config/himalaya/config.toml
assertFileContent home-files/.config/himalaya/config.toml ${
./imap-smtp-expected.toml
}
'';
}

View file

@ -0,0 +1,16 @@
email-listing-page-size = 50
["hm@example.com"]
backend = "maildir"
default = true
display-name = "H. M. Test"
email = "hm@example.com"
maildir-root-dir = "/home/hm-user/Maildir/hm@example.com"
sender = "sendmail"
sendmail-cmd = "msmtp"
["hm@example.com".folder-aliases]
drafts = "Drafts"
inbox = "Inbox"
sent = "Sent"
trash = "Deleted"

View file

@ -3,32 +3,27 @@
with lib;
{
imports = [ ../../accounts/email-test-accounts.nix ];
accounts.email.accounts = {
"hm@example.com" = {
primary = true;
address = "hm@example.com";
userName = "home.manager";
realName = "H. M. Test";
passwordCommand = "password-command";
folders = { trash = "Deleted"; };
himalaya = {
enable = true;
backend = "imap";
sender = "smtp";
settings = { email-listing-page-size = 50; };
settings = {
sender = "sendmail";
sendmail-cmd = "msmtp";
};
};
folders = {
inbox = "In";
sent = "Out";
drafts = "Drafts";
};
imap.port = 995;
smtp.port = 465;
};
};
programs.himalaya = {
enable = true;
settings = { downloads-dir = "/data/download"; };
settings = { email-listing-page-size = 50; };
};
test.stubs.himalaya = { };
@ -36,7 +31,7 @@ with lib;
nmt.script = ''
assertFileExists home-files/.config/himalaya/config.toml
assertFileContent home-files/.config/himalaya/config.toml ${
./himalaya-expected.toml
./maildir-sendmail-expected.toml
}
'';
}