-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdefault.nix
58 lines (48 loc) · 1.4 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{ config, lib, pkgs, ... }:
with lib;
let
overhead-mailer = pkgs.python36Packages.buildPythonPackage rec {
name = "overhead-mailer-${version}";
version = "0.1";
src = ./.;
propagatedBuildInputs = [ pkgs.python36Packages.beautifulsoup4 ];
};
cfg = config.services.overhead-mailer;
in {
options.services.overhead-mailer = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
If enabled, the overhead mailer will periodically check the
PmWiki's Overhead and compose a mail to the mailing list.
'';
};
interval = mkOption {
type = types.str;
default = "Thu *-*-* 04:00:00";
description = ''
Runs the overhead mailer at this interval, by default at 4 AM
every thursday.
The format is described in
systemd.time(7).
'';
};
configFile = mkOption {
type = types.path;
description = "Path of the 'config.ini' file.";
};
};
config = {
systemd.services.overhead-mailer = mkIf cfg.enable {
description = "Overhead Mailer";
script = "${overhead-mailer}/bin/overhead_mailer -c ${cfg.configFile}";
};
systemd.timers.overhead-mailer = mkIf cfg.enable {
description = "Overhead Mailer";
partOf = [ "overhead-mailer.service" ];
wantedBy = [ "timers.target" ];
timerConfig.OnCalendar = cfg.interval;
};
};
}