Refer to the file in the dir

This commit is contained in:
niten 2023-09-28 17:00:26 -07:00
parent efe6f49c2b
commit c4ad7a89a4
1 changed files with 7 additions and 7 deletions

View File

@ -25,15 +25,15 @@ let
concatStringsSep "\n" (map (ensureDomainDkimCert keyDir) domains); concatStringsSep "\n" (map (ensureDomainDkimCert keyDir) domains);
makeKeyTable = keyDir: domains: makeKeyTable = keyDir: domains:
pkgs.writeTextDir "dkim-tables/key.table" (concatStringsSep "\n" pkgs.writeTextDir "key.table" (concatStringsSep "\n"
(map (dom: "${dom}:mail:${keyDir}/${dom}.mail.key") domains)); (map (dom: "${dom}:mail:${keyDir}/${dom}.mail.key") domains));
makeSigningTable = domains: makeSigningTable = domains:
pkgs.writeTextDir "dkim-tables/signing.table" pkgs.writeTextDir "signing.table"
(concatStringsSep "\n" (map (dom: "${dom} ${dom}") domains)); (concatStringsSep "\n" (map (dom: "${dom} ${dom}") domains));
keyTable = makeKeyTable cfg.state-directory cfg.domains; keyTableDir = makeKeyTable cfg.state-directory cfg.domains;
signingTable = makeSigningTable cfg.domains; signingTableDir = makeSigningTable cfg.domains;
in { in {
options.fudo.mail.dkim = with types; { options.fudo.mail.dkim = with types; {
@ -99,8 +99,8 @@ in {
in pkgs.writeText "opendkim.conf" '' in pkgs.writeText "opendkim.conf" ''
Canonicalization relaxed/simple Canonicalization relaxed/simple
Socket inet:${toString cfg.port} Socket inet:${toString cfg.port}
KeyTable file: ${keyTable} KeyTable file: ${keyTableDir}/key.table
SigningTable file:${signingTable} SigningTable file:${signingTableDir}/signing.table
${optionalString cfg.debug debugString} ${optionalString cfg.debug debugString}
''; '';
}; };
@ -118,7 +118,7 @@ in {
(ensureAllDkimCerts cfg.state-directory cfg.domains)) (ensureAllDkimCerts cfg.state-directory cfg.domains))
]; ];
ReadWritePaths = [ cfg.state-directory ]; ReadWritePaths = [ cfg.state-directory ];
ReadOnlyPaths = [ (dirOf keyTable) (dirOf signingTable) ]; ReadOnlyPaths = [ keyTableDir signingTableDir ];
}; };
}; };
}; };