From 2760695df0bae341cc7f345593628d9c19af9007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= Date: Thu, 10 Jan 2019 03:29:35 +0100 Subject: [PATCH] nixos/smokeping: Add host option. Allows setting smokeping to not listen on the public Internet. --- nixos/modules/services/networking/smokeping.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nixos/modules/services/networking/smokeping.nix b/nixos/modules/services/networking/smokeping.nix index 6b550f4d0005..8b13e36c6f30 100644 --- a/nixos/modules/services/networking/smokeping.nix +++ b/nixos/modules/services/networking/smokeping.nix @@ -167,6 +167,17 @@ in defaultText = literalExpression "pkgs.smokeping"; description = "Specify a custom smokeping package"; }; + host = mkOption { + type = types.nullOr types.str; + default = null; + example = "192.0.2.1"; # rfc5737 example IP for documentation + description = '' + Host/IP to bind to for the web server. + + Setting it to null skips passing the -h option to thttpd, + which makes it bind to all interfaces. + ''; + }; port = mkOption { type = types.int; default = 8081; @@ -325,6 +336,7 @@ in [ "-u ${cfg.user}" ] [ ''-c "**.fcgi"'' ] [ "-d ${smokepingHome}" ] + (lib.optional (cfg.host != null) "-h ${cfg.host}") [ "-p ${builtins.toString cfg.port}" ] [ "-D -nos" ] ]);