diff options
Diffstat (limited to 'flakes/private/openarc/flake.nix')
-rw-r--r-- | flakes/private/openarc/flake.nix | 69 |
1 files changed, 40 insertions, 29 deletions
diff --git a/flakes/private/openarc/flake.nix b/flakes/private/openarc/flake.nix index fd8ec56..9cc9aed 100644 --- a/flakes/private/openarc/flake.nix +++ b/flakes/private/openarc/flake.nix | |||
@@ -3,40 +3,51 @@ | |||
3 | path = "../../openarc"; | 3 | path = "../../openarc"; |
4 | type = "path"; | 4 | type = "path"; |
5 | }; | 5 | }; |
6 | inputs.files-watcher = { | ||
7 | path = "../../files-watcher"; | ||
8 | type = "path"; | ||
9 | }; | ||
10 | inputs.my-lib = { | ||
11 | path = "../../lib"; | ||
12 | type = "path"; | ||
13 | }; | ||
6 | inputs.nix-lib.url = "github:NixOS/nixpkgs"; | 14 | inputs.nix-lib.url = "github:NixOS/nixpkgs"; |
7 | 15 | ||
8 | description = "Private configuration for openarc"; | 16 | description = "Private configuration for openarc"; |
9 | outputs = { self, nix-lib, openarc }: | 17 | outputs = { self, nix-lib, my-lib, files-watcher, openarc }: |
10 | let | 18 | let |
11 | cfg = name': { config, lib, pkgs, name, ... }: lib.mkIf (name == name') { | 19 | cfg = name': { config, lib, pkgs, name, ... }: { |
12 | services.openarc = { | 20 | imports = [ (my-lib.lib.withNarKey files-watcher "nixosModule") ]; |
13 | enable = true; | 21 | config = lib.mkIf (name == name') { |
14 | user = "opendkim"; | 22 | services.openarc = { |
15 | socket = "local:${config.myServices.mail.milters.sockets.openarc}"; | 23 | enable = true; |
16 | group = config.services.postfix.group; | 24 | user = "opendkim"; |
17 | configFile = pkgs.writeText "openarc.conf" '' | 25 | socket = "local:${config.myServices.mail.milters.sockets.openarc}"; |
18 | AuthservID mail.immae.eu | 26 | group = config.services.postfix.group; |
19 | Domain mail.immae.eu | 27 | configFile = pkgs.writeText "openarc.conf" '' |
20 | KeyFile ${config.secrets.fullPaths."opendkim/eldiron.private"} | 28 | AuthservID mail.immae.eu |
21 | Mode sv | 29 | Domain mail.immae.eu |
22 | Selector eldiron | 30 | KeyFile ${config.secrets.fullPaths."opendkim/eldiron.private"} |
23 | SoftwareHeader yes | 31 | Mode sv |
24 | Syslog Yes | 32 | Selector eldiron |
33 | SoftwareHeader yes | ||
34 | Syslog Yes | ||
35 | ''; | ||
36 | }; | ||
37 | systemd.services.openarc.serviceConfig.Slice = "mail.slice"; | ||
38 | systemd.services.openarc.postStart = lib.optionalString | ||
39 | (lib.strings.hasPrefix "local:" config.services.openarc.socket) '' | ||
40 | while [ ! -S ${lib.strings.removePrefix "local:" config.services.openarc.socket} ]; do | ||
41 | sleep 0.5 | ||
42 | done | ||
43 | chmod g+w ${lib.strings.removePrefix "local:" config.services.openarc.socket} | ||
25 | ''; | 44 | ''; |
26 | }; | 45 | services.filesWatcher.openarc = { |
27 | systemd.services.openarc.serviceConfig.Slice = "mail.slice"; | 46 | restart = true; |
28 | systemd.services.openarc.postStart = lib.optionalString | 47 | paths = [ |
29 | (lib.strings.hasPrefix "local:" config.services.openarc.socket) '' | 48 | config.secrets.fullPaths."opendkim/eldiron.private" |
30 | while [ ! -S ${lib.strings.removePrefix "local:" config.services.openarc.socket} ]; do | 49 | ]; |
31 | sleep 0.5 | 50 | }; |
32 | done | ||
33 | chmod g+w ${lib.strings.removePrefix "local:" config.services.openarc.socket} | ||
34 | ''; | ||
35 | services.filesWatcher.openarc = { | ||
36 | restart = true; | ||
37 | paths = [ | ||
38 | config.secrets.fullPaths."opendkim/eldiron.private" | ||
39 | ]; | ||
40 | }; | 51 | }; |
41 | }; | 52 | }; |
42 | in | 53 | in |