refactor: switch from modules to import arrays

This commit is contained in:
wi11-holdsworth 2025-10-22 01:22:05 +11:00
parent d893750c09
commit 41eaa38d31
75 changed files with 1870 additions and 2541 deletions

View file

@ -1,62 +1,54 @@
{
# keep-sorted start
config,
lib,
hostName,
# keep-sorted end
...
}:
let
feature = "mail";
in
{
config = lib.mkIf config.${feature}.enable {
accounts.email =
let
certificatesFile = config.age.secrets.protonmail-cert.path;
in
{
inherit certificatesFile;
accounts =
let
# keep-sorted start block=yes
address = "willholdsworth@pm.me";
authentication = "login";
host = "127.0.0.1";
tls = {
enable = false;
useStartTls = true;
inherit certificatesFile;
};
# keep-sorted end
in
{
personal = {
enable = true;
# keep-sorted start block=yes
imap = {
port = 1143;
inherit tls;
inherit authentication;
inherit host;
};
inherit address;
passwordCommand = "cat ${config.age.secrets."protonmail-${hostName}-password".path}";
primary = true;
realName = "Will Holdsworth";
smtp = {
port = 1025;
inherit tls;
inherit authentication;
inherit host;
};
userName = address;
# keep-sorted end
};
accounts.email =
let
certificatesFile = config.age.secrets.protonmail-cert.path;
in
{
inherit certificatesFile;
accounts =
let
# keep-sorted start block=yes
address = "willholdsworth@pm.me";
authentication = "login";
host = "127.0.0.1";
tls = {
enable = false;
useStartTls = true;
inherit certificatesFile;
};
};
age.secrets."protonmail-cert".file = ../../../secrets/protonmail-cert.age;
};
imports = [ ];
options.${feature}.enable = lib.mkEnableOption "enables ${feature}";
# keep-sorted end
in
{
personal = {
enable = true;
# keep-sorted start block=yes
imap = {
port = 1143;
inherit tls;
inherit authentication;
inherit host;
};
inherit address;
passwordCommand = "cat ${config.age.secrets."protonmail-${hostName}-password".path}";
primary = true;
realName = "Will Holdsworth";
smtp = {
port = 1025;
inherit tls;
inherit authentication;
inherit host;
};
userName = address;
# keep-sorted end
};
};
};
age.secrets."protonmail-cert".file = ../../../secrets/protonmail-cert.age;
}