small fixes
This commit is contained in:
@@ -17,22 +17,21 @@ lib.mkIf hasMailDiscoveryConfig (
|
||||
|
||||
safeLegacyPath = email: builtins.replaceStrings [ "@" "+" ] [ "_" "-" ] email;
|
||||
|
||||
accountEntries =
|
||||
lib.filter (entry: entry.domain == domain) (
|
||||
lib.mapAttrsToList (
|
||||
email: _:
|
||||
let
|
||||
parts = lib.splitString "@" email;
|
||||
username = builtins.head parts;
|
||||
domainPart = lib.last parts;
|
||||
in
|
||||
{
|
||||
inherit email username;
|
||||
domain = domainPart;
|
||||
legacyPath = safeLegacyPath email;
|
||||
}
|
||||
) cfg.loginAccounts
|
||||
);
|
||||
accountEntries = lib.filter (entry: entry.domain == domain) (
|
||||
lib.mapAttrsToList (
|
||||
email: _:
|
||||
let
|
||||
parts = lib.splitString "@" email;
|
||||
username = builtins.head parts;
|
||||
domainPart = lib.last parts;
|
||||
in
|
||||
{
|
||||
inherit email username;
|
||||
domain = domainPart;
|
||||
legacyPath = safeLegacyPath email;
|
||||
}
|
||||
) cfg.loginAccounts
|
||||
);
|
||||
|
||||
usernames = map (entry: entry.username) accountEntries;
|
||||
defaultUsername =
|
||||
@@ -40,8 +39,8 @@ lib.mkIf hasMailDiscoveryConfig (
|
||||
|
||||
generatorScript = ./mobileconfig-generator.py;
|
||||
|
||||
accountArgs = lib.concatMapStrings (entry:
|
||||
" --account ${entry.username}:${entry.email}:${entry.legacyPath}"
|
||||
accountArgs = lib.concatMapStrings (
|
||||
entry: " --account ${entry.username}:${entry.email}:${entry.legacyPath}"
|
||||
) accountEntries;
|
||||
|
||||
defaultUsernameArg =
|
||||
@@ -61,7 +60,12 @@ lib.mkIf hasMailDiscoveryConfig (
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
DynamicUser = true;
|
||||
ExecStart = "${pkgs.python3}/bin/python3 ${generatorScript} --domain ${domain} --mail-host ${cfg.fqdn} --radicale-host ${radicaleHost} --port ${toString mobileconfigPort}${defaultUsernameArg}${accountArgs}";
|
||||
ExecStart = "${pkgs.python3}/bin/python3 \
|
||||
${generatorScript} \
|
||||
--domain ${domain} \
|
||||
--mail-host ${cfg.fqdn} \
|
||||
--radicale-host ${radicaleHost} \
|
||||
--port ${toString mobileconfigPort}${defaultUsernameArg}${accountArgs}";
|
||||
NoNewPrivileges = true;
|
||||
PrivateTmp = true;
|
||||
ProtectHome = true;
|
||||
|
||||
Reference in New Issue
Block a user