File tree 2 files changed +33
-5
lines changed
2 files changed +33
-5
lines changed Original file line number Diff line number Diff line change 12
12
self . nixosModules . server
13
13
] ;
14
14
services . server . enable = true ;
15
+ services . server . metrics . enable = true ;
15
16
} ;
16
17
verifyServices = [ "server.service" ] ;
17
18
} ;
Original file line number Diff line number Diff line change 4
4
types
5
5
mkOption
6
6
mkIf
7
- mkMerge
8
7
mkEnableOption
9
8
escapeShellArgs
9
+ optionals
10
10
;
11
11
cfg = config . services . server ;
12
12
in
37
37
'' ;
38
38
} ;
39
39
40
+ metrics = {
41
+ enable = lib . mkEnableOption "Prometheus metrics server" ;
42
+
43
+ address = mkOption {
44
+ type = types . str ;
45
+ default = "0.0.0.0" ;
46
+ example = "0.0.0.0" ;
47
+ description = ''
48
+ Listen address of the metrics server.
49
+ '' ;
50
+ } ;
51
+
52
+ port = mkOption {
53
+ type = types . port ;
54
+ default = 8081 ;
55
+ description = ''
56
+ Listen port of the metrics service.
57
+ '' ;
58
+ } ;
59
+ } ;
60
+
40
61
logLevel = mkOption {
41
62
type = types . str ;
42
63
default = "info" ;
50
71
51
72
systemd . services . server =
52
73
let
53
- args = escapeShellArgs [
54
- "--listen-address"
55
- "${ cfg . address } :${ toString cfg . port } "
56
- ] ;
74
+ args = escapeShellArgs (
75
+ [
76
+ "--listen-address"
77
+ "${ cfg . address } :${ toString cfg . port } "
78
+ ]
79
+ ++ optionals cfg . metrics . enable [
80
+ "--metrics-listen-address"
81
+ "${ cfg . metrics . address } :${ toString cfg . metrics . port } "
82
+ ]
83
+ ) ;
57
84
in
58
85
{
59
86
description = "server" ;
You can’t perform that action at this time.
0 commit comments