summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-01-23 16:43:15 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-01-23 16:43:15 +0100
commit11a0344e13a908a84046c423908c42088fd73e43 (patch)
treeda7649d9bc94f74cc2ae60e0ab2e8608fa03934c
parent84e9a2e6364c58c2f62e6e02490fe739169dce5f (diff)
parent4fa5d1f626bcac4841c4862ace736d41d5e6cc53 (diff)
downloadnixlib-11a0344e13a908a84046c423908c42088fd73e43.tar
nixlib-11a0344e13a908a84046c423908c42088fd73e43.tar.gz
nixlib-11a0344e13a908a84046c423908c42088fd73e43.tar.bz2
nixlib-11a0344e13a908a84046c423908c42088fd73e43.tar.lz
nixlib-11a0344e13a908a84046c423908c42088fd73e43.tar.xz
nixlib-11a0344e13a908a84046c423908c42088fd73e43.tar.zst
nixlib-11a0344e13a908a84046c423908c42088fd73e43.zip
Merge pull request #5918 from robberer/openntpd
openntpd: add extraConfig and extraOptions
-rw-r--r--nixos/modules/services/networking/openntpd.nix24
1 files changed, 23 insertions, 1 deletions
diff --git a/nixos/modules/services/networking/openntpd.nix b/nixos/modules/services/networking/openntpd.nix
index 2f9031481d1d..d1c32db49c4c 100644
--- a/nixos/modules/services/networking/openntpd.nix
+++ b/nixos/modules/services/networking/openntpd.nix
@@ -12,6 +12,7 @@ let
 
   cfgFile = pkgs.writeText "openntpd.conf" ''
     ${concatStringsSep "\n" (map (s: "server ${s}") cfg.servers)}
+    ${cfg.extraConfig}
   '';
 in
 {
@@ -25,6 +26,27 @@ in
       type = types.listOf types.str;
       inherit (options.services.ntp.servers) description;
     };
+
+    extraConfig = mkOption {
+      type = with types; lines;
+      default = "";
+      example = ''
+        listen on 127.0.0.1 
+        listen on ::1 
+      '';
+      description = ''
+        Additional text appended to <filename>openntpd.conf</filename>.
+      '';
+    };
+
+    extraOptions = mkOption {
+      type = with types; string;
+      default = "";
+      example = "-s";
+      description = ''
+        Extra options used when launching openntpd.
+      '';
+    };
   };
 
   ###### implementation
@@ -42,7 +64,7 @@ in
     systemd.services.openntpd = {
       description = "OpenNTP Server";
       wantedBy = [ "multi-user.target" ];
-      serviceConfig.ExecStart = "${package}/sbin/ntpd -d -f ${cfgFile}";
+      serviceConfig.ExecStart = "${package}/sbin/ntpd -d -f ${cfgFile} ${cfg.extraOptions}";
     };
   };
 }