mirror of
https://github.com/nix-community/home-manager
synced 2025-01-30 21:05:02 +01:00
himalaya: adjust package for released v1.0.0
This commit is contained in:
parent
2ae3dd460f
commit
e9068facd7
1 changed files with 40 additions and 60 deletions
|
@ -35,7 +35,7 @@ let
|
||||||
email = account.address;
|
email = account.address;
|
||||||
display-name = account.realName;
|
display-name = account.realName;
|
||||||
default = account.primary;
|
default = account.primary;
|
||||||
folder.alias = {
|
folder.aliases = {
|
||||||
inbox = account.folders.inbox;
|
inbox = account.folders.inbox;
|
||||||
sent = account.folders.sent;
|
sent = account.folders.sent;
|
||||||
drafts = account.folders.drafts;
|
drafts = account.folders.drafts;
|
||||||
|
@ -46,43 +46,48 @@ let
|
||||||
signatureConfig =
|
signatureConfig =
|
||||||
lib.optionalAttrs (account.signature.showSignature == "append") {
|
lib.optionalAttrs (account.signature.showSignature == "append") {
|
||||||
# TODO: signature cannot be attached yet
|
# TODO: signature cannot be attached yet
|
||||||
# https://todo.sr.ht/~soywod/pimalaya/27
|
# https://github.com/pimalaya/himalaya/issues/534
|
||||||
signature = account.signature.text;
|
signature = account.signature.text;
|
||||||
signature-delim = account.signature.delimiter;
|
signature-delim = account.signature.delimiter;
|
||||||
};
|
};
|
||||||
|
|
||||||
imapConfig = lib.optionalAttrs imapEnabled (compactAttrs {
|
imapConfig = lib.optionalAttrs imapEnabled (compactAttrs {
|
||||||
backend = "imap";
|
backend.type = "imap";
|
||||||
imap.host = account.imap.host;
|
backend.host = account.imap.host;
|
||||||
imap.port = account.imap.port;
|
backend.port = account.imap.port;
|
||||||
imap.encryption = mkEncryptionConfig account.imap.tls;
|
backend.encryption.type = mkEncryptionConfig account.imap.tls;
|
||||||
imap.login = account.userName;
|
backend.login = account.userName;
|
||||||
imap.passwd.cmd = builtins.concatStringsSep " " account.passwordCommand;
|
backend.auth.type = "password";
|
||||||
|
backend.auth.cmd =
|
||||||
|
builtins.concatStringsSep " " account.passwordCommand;
|
||||||
});
|
});
|
||||||
|
|
||||||
maildirConfig = lib.optionalAttrs maildirEnabled (compactAttrs {
|
maildirConfig = lib.optionalAttrs maildirEnabled (compactAttrs {
|
||||||
backend = "maildir";
|
backend.type = "maildir";
|
||||||
maildir.root-dir = account.maildir.absPath;
|
backend.root-dir = account.maildir.absPath;
|
||||||
});
|
});
|
||||||
|
|
||||||
notmuchConfig = lib.optionalAttrs notmuchEnabled (compactAttrs {
|
notmuchConfig = lib.optionalAttrs notmuchEnabled (compactAttrs {
|
||||||
backend = "notmuch";
|
backend.type = "notmuch";
|
||||||
notmuch.database-path = maildirBasePath;
|
backend.db-path = maildirBasePath;
|
||||||
});
|
});
|
||||||
|
|
||||||
smtpConfig = lib.optionalAttrs (!isNull account.smtp) (compactAttrs {
|
smtpConfig = lib.optionalAttrs (!isNull account.smtp) (compactAttrs {
|
||||||
message.send.backend = "smtp";
|
message.send.backend.type = "smtp";
|
||||||
smtp.host = account.smtp.host;
|
message.send.backend.host = account.smtp.host;
|
||||||
smtp.port = account.smtp.port;
|
message.send.backend.port = account.smtp.port;
|
||||||
smtp.encryption = mkEncryptionConfig account.smtp.tls;
|
message.send.backend.encryption.type =
|
||||||
smtp.login = account.userName;
|
mkEncryptionConfig account.smtp.tls;
|
||||||
smtp.passwd.cmd = builtins.concatStringsSep " " account.passwordCommand;
|
message.send.backend.login = account.userName;
|
||||||
|
message.send.backend.auth.type = "password";
|
||||||
|
message.send.backend.auth.cmd =
|
||||||
|
builtins.concatStringsSep " " account.passwordCommand;
|
||||||
});
|
});
|
||||||
|
|
||||||
sendmailConfig =
|
sendmailConfig =
|
||||||
lib.optionalAttrs (isNull account.smtp && !isNull account.msmtp) {
|
lib.optionalAttrs (isNull account.smtp && !isNull account.msmtp) {
|
||||||
sender = "sendmail";
|
message.send.backend.type = "sendmail";
|
||||||
sendmail.cmd = lib.getExe pkgs.msmtp;
|
message.send.backend.cmd = lib.getExe pkgs.msmtp;
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.attrsets.mergeAttrsList [
|
config = lib.attrsets.mergeAttrsList [
|
||||||
|
@ -100,6 +105,18 @@ let
|
||||||
in {
|
in {
|
||||||
meta.maintainers = with lib.hm.maintainers; [ soywod toastal ];
|
meta.maintainers = with lib.hm.maintainers; [ soywod toastal ];
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
(mkRemovedOptionModule [ "services" "himalaya-watch" "enable" ] ''
|
||||||
|
services.himalaya-watch has been removed.
|
||||||
|
|
||||||
|
The watch feature moved away from Himalaya scope, and resides
|
||||||
|
now in its own project called Mirador. Once the v1 released, the
|
||||||
|
service will land back in nixpkgs and home-manager.
|
||||||
|
|
||||||
|
See <https://github.com/pimalaya/mirador>.
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
programs.himalaya = {
|
programs.himalaya = {
|
||||||
enable = lib.mkEnableOption "the email client Himalaya CLI";
|
enable = lib.mkEnableOption "the email client Himalaya CLI";
|
||||||
|
@ -109,25 +126,7 @@ in {
|
||||||
default = { };
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
Himalaya CLI global configuration.
|
Himalaya CLI global configuration.
|
||||||
See <https://pimalaya.org/himalaya/cli/latest/configuration/index.html#global-configuration> for supported values.
|
See <https://github.com/pimalaya/himalaya/blob/master/config.sample.toml> for supported values.
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
services.himalaya-watch = {
|
|
||||||
enable = lib.mkEnableOption
|
|
||||||
"the email client Himalaya CLI envelopes watcher service";
|
|
||||||
|
|
||||||
environment = lib.mkOption {
|
|
||||||
type = with lib.types; attrsOf str;
|
|
||||||
default = { };
|
|
||||||
example = lib.literalExpression ''
|
|
||||||
{
|
|
||||||
"PASSWORD_STORE_DIR" = "~/.password-store";
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
description = ''
|
|
||||||
Extra environment variables to be exported in the service.
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -143,7 +142,7 @@ in {
|
||||||
default = { };
|
default = { };
|
||||||
description = ''
|
description = ''
|
||||||
Himalaya CLI configuration for this email account.
|
Himalaya CLI configuration for this email account.
|
||||||
See <https://pimalaya.org/himalaya/cli/latest/configuration/index.html#account-configuration> for supported values.
|
See <https://github.com/pimalaya/himalaya/blob/master/config.sample.toml> for supported values.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -161,7 +160,7 @@ in {
|
||||||
accountsConfig = lib.mapAttrs mkAccountConfig enabledAccounts;
|
accountsConfig = lib.mapAttrs mkAccountConfig enabledAccounts;
|
||||||
globalConfig = compactAttrs himalaya.settings;
|
globalConfig = compactAttrs himalaya.settings;
|
||||||
allConfig = globalConfig // { accounts = accountsConfig; };
|
allConfig = globalConfig // { accounts = accountsConfig; };
|
||||||
in tomlFormat.generate "himalaya-config.toml" allConfig;
|
in tomlFormat.generate "himalaya.config.toml" allConfig;
|
||||||
|
|
||||||
desktopEntries.himalaya = lib.mkIf pkgs.stdenv.hostPlatform.isLinux {
|
desktopEntries.himalaya = lib.mkIf pkgs.stdenv.hostPlatform.isLinux {
|
||||||
type = "Application";
|
type = "Application";
|
||||||
|
@ -175,24 +174,5 @@ in {
|
||||||
settings = { Keywords = "email"; };
|
settings = { Keywords = "email"; };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.user.services."himalaya-watch@" =
|
|
||||||
let inherit (config.services.himalaya-watch) enable environment;
|
|
||||||
in lib.mkIf enable {
|
|
||||||
Unit = {
|
|
||||||
Description = "Email client Himalaya CLI envelopes watcher service";
|
|
||||||
After = [ "network.target" ];
|
|
||||||
};
|
|
||||||
Install = { WantedBy = [ "default.target" ]; };
|
|
||||||
Service = {
|
|
||||||
ExecStart =
|
|
||||||
"${lib.getExe himalaya.package} envelopes watch --account %I";
|
|
||||||
ExecSearchPath = "/bin";
|
|
||||||
Environment =
|
|
||||||
lib.mapAttrsToList (key: val: "${key}=${val}") environment;
|
|
||||||
Restart = "always";
|
|
||||||
RestartSec = 10;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue