File tree Expand file tree Collapse file tree 2 files changed +33
-5
lines changed Expand file tree Collapse file tree 2 files changed +33
-5
lines changed Original file line number Diff line number Diff line change 1212 self . nixosModules . server
1313 ] ;
1414 services . server . enable = true ;
15+ services . server . metrics . enable = true ;
1516 } ;
1617 verifyServices = [ "server.service" ] ;
1718 } ;
Original file line number Diff line number Diff line change 44 types
55 mkOption
66 mkIf
7- mkMerge
87 mkEnableOption
98 escapeShellArgs
9+ optionals
1010 ;
1111 cfg = config . services . server ;
1212in
3737 '' ;
3838 } ;
3939
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+
4061 logLevel = mkOption {
4162 type = types . str ;
4263 default = "info" ;
5071
5172 systemd . services . server =
5273 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+ ) ;
5784 in
5885 {
5986 description = "server" ;
You can’t perform that action at this time.
0 commit comments