Use submodules for program email accounts
This reworks the way program specific email account options are specified. In particular, we no longer use the deprecated `options` field of `mkOption`. Instead submodules are used.
This commit is contained in:
parent
99c900946d
commit
4b32f16747
5 changed files with 71 additions and 71 deletions
57
modules/programs/mbsync-accounts.nix
Normal file
57
modules/programs/mbsync-accounts.nix
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
{ lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options.mbsync = {
|
||||
enable = mkEnableOption "synchronization using mbsync";
|
||||
|
||||
flatten = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = ".";
|
||||
description = ''
|
||||
If set, flattens the hierarchy within the maildir by
|
||||
substituting the canonical hierarchy delimiter
|
||||
<literal>/</literal> with this value.
|
||||
'';
|
||||
};
|
||||
|
||||
create = mkOption {
|
||||
type = types.enum [ "none" "maildir" "imap" "both" ];
|
||||
default = "none";
|
||||
example = "maildir";
|
||||
description = ''
|
||||
Automatically create missing mailboxes within the
|
||||
given mail store.
|
||||
'';
|
||||
};
|
||||
|
||||
remove = mkOption {
|
||||
type = types.enum [ "none" "maildir" "imap" "both" ];
|
||||
default = "none";
|
||||
example = "imap";
|
||||
description = ''
|
||||
Propagate mailbox deletions to the given mail store.
|
||||
'';
|
||||
};
|
||||
|
||||
expunge = mkOption {
|
||||
type = types.enum [ "none" "maildir" "imap" "both" ];
|
||||
default = "none";
|
||||
example = "both";
|
||||
description = ''
|
||||
Permanently remove messages marked for deletion from
|
||||
the given mail store.
|
||||
'';
|
||||
};
|
||||
|
||||
patterns = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ "*" ];
|
||||
description = ''
|
||||
Pattern of mailboxes to synchronize.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -132,64 +132,6 @@ in
|
|||
'';
|
||||
};
|
||||
};
|
||||
|
||||
accounts.email.accounts = mkOption {
|
||||
options = [
|
||||
{
|
||||
mbsync = {
|
||||
enable = mkEnableOption "synchronization using mbsync";
|
||||
|
||||
flatten = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = ".";
|
||||
description = ''
|
||||
If set, flattens the hierarchy within the maildir by
|
||||
substituting the canonical hierarchy delimiter
|
||||
<literal>/</literal> with this value.
|
||||
'';
|
||||
};
|
||||
|
||||
create = mkOption {
|
||||
type = types.enum [ "none" "maildir" "imap" "both" ];
|
||||
default = "none";
|
||||
example = "maildir";
|
||||
description = ''
|
||||
Automatically create missing mailboxes within the
|
||||
given mail store.
|
||||
'';
|
||||
};
|
||||
|
||||
remove = mkOption {
|
||||
type = types.enum [ "none" "maildir" "imap" "both" ];
|
||||
default = "none";
|
||||
example = "imap";
|
||||
description = ''
|
||||
Propagate mailbox deletions to the given mail store.
|
||||
'';
|
||||
};
|
||||
|
||||
expunge = mkOption {
|
||||
type = types.enum [ "none" "maildir" "imap" "both" ];
|
||||
default = "none";
|
||||
example = "both";
|
||||
description = ''
|
||||
Permanently remove messages marked for deletion from
|
||||
the given mail store.
|
||||
'';
|
||||
};
|
||||
|
||||
patterns = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ "*" ];
|
||||
description = ''
|
||||
Pattern of mailboxes to synchronize.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
|
|
|||
7
modules/programs/notmuch-accounts.nix
Normal file
7
modules/programs/notmuch-accounts.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{ lib, ... }:
|
||||
|
||||
{
|
||||
options.notmuch = {
|
||||
enable = lib.mkEnableOption "notmuch indexing";
|
||||
};
|
||||
}
|
||||
|
|
@ -129,16 +129,6 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
accounts.email.accounts = mkOption {
|
||||
options = [
|
||||
{
|
||||
notmuch = {
|
||||
enable = mkEnableOption "notmuch indexing";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue