tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
nixos: add htpdate module
Jookia
9 years ago
e23cc550
a83eadd8
+81
2 changed files
expand all
collapse all
unified
split
nixos
modules
module-list.nix
services
networking
htpdate.nix
+1
nixos/modules/module-list.nix
···
354
354
./services/networking/haproxy.nix
355
355
./services/networking/heyefi.nix
356
356
./services/networking/hostapd.nix
357
357
+
./services/networking/htpdate.nix
357
358
./services/networking/i2pd.nix
358
359
./services/networking/i2p.nix
359
360
./services/networking/iodine.nix
+80
nixos/modules/services/networking/htpdate.nix
···
1
1
+
{ config, lib, pkgs, ... }:
2
2
+
3
3
+
with lib;
4
4
+
5
5
+
let
6
6
+
inherit (pkgs) htpdate;
7
7
+
8
8
+
cfg = config.services.htpdate;
9
9
+
in
10
10
+
11
11
+
{
12
12
+
13
13
+
###### interface
14
14
+
15
15
+
options = {
16
16
+
17
17
+
services.htpdate = {
18
18
+
19
19
+
enable = mkOption {
20
20
+
type = types.bool;
21
21
+
default = false;
22
22
+
description = ''
23
23
+
Enable htpdate daemon.
24
24
+
'';
25
25
+
};
26
26
+
27
27
+
extraOptions = mkOption {
28
28
+
type = types.str;
29
29
+
default = "";
30
30
+
description = ''
31
31
+
Additional command line arguments to pass to htpdate.
32
32
+
'';
33
33
+
};
34
34
+
35
35
+
servers = mkOption {
36
36
+
type = types.listOf types.str;
37
37
+
default = [ "www.google.com" ];
38
38
+
description = ''
39
39
+
HTTP servers to use for time synchronization.
40
40
+
'';
41
41
+
};
42
42
+
43
43
+
proxy = mkOption {
44
44
+
type = types.str;
45
45
+
default = "";
46
46
+
example = "127.0.0.1:8118";
47
47
+
description = ''
48
48
+
HTTP proxy used for requests.
49
49
+
'';
50
50
+
};
51
51
+
52
52
+
};
53
53
+
54
54
+
};
55
55
+
56
56
+
###### implementation
57
57
+
58
58
+
config = mkIf cfg.enable {
59
59
+
60
60
+
systemd.services.htpdate = {
61
61
+
description = "htpdate daemon";
62
62
+
wantedBy = [ "multi-user.target" ];
63
63
+
serviceConfig = {
64
64
+
Type = "forking";
65
65
+
PIDFile = "/var/run/htpdate.pid";
66
66
+
ExecStart = concatStringsSep " " [
67
67
+
"${htpdate}/bin/htpdate"
68
68
+
"-D -u nobody"
69
69
+
"-a -s"
70
70
+
"-l"
71
71
+
"${optionalString (cfg.proxy != "") "-P ${cfg.proxy}"}"
72
72
+
"${cfg.extraOptions}"
73
73
+
"${concatStringsSep " " cfg.servers}"
74
74
+
];
75
75
+
};
76
76
+
};
77
77
+
78
78
+
};
79
79
+
80
80
+
}