summary refs log tree commit diff
path: root/nixos/modules/services/networking/ddclient.nix
diff options
context:
space:
mode:
authorThomas Bereknyei <tomberek@gmail.com>2016-08-20 03:39:52 -0400
committerRobert Helgesson <robert@rycee.net>2016-09-30 19:13:56 +0200
commit5bca9297ffb7806b3b350938ab652befb2cd1c24 (patch)
tree554518e1095f903c122908d01558c53b6b083367 /nixos/modules/services/networking/ddclient.nix
parentd454f9cca2dec6b52fe7428c674f8ba3262ee63b (diff)
downloadnixpkgs-5bca9297ffb7806b3b350938ab652befb2cd1c24.tar
nixpkgs-5bca9297ffb7806b3b350938ab652befb2cd1c24.tar.gz
nixpkgs-5bca9297ffb7806b3b350938ab652befb2cd1c24.tar.bz2
nixpkgs-5bca9297ffb7806b3b350938ab652befb2cd1c24.tar.lz
nixpkgs-5bca9297ffb7806b3b350938ab652befb2cd1c24.tar.xz
nixpkgs-5bca9297ffb7806b3b350938ab652befb2cd1c24.tar.zst
nixpkgs-5bca9297ffb7806b3b350938ab652befb2cd1c24.zip
ddclient: add configFile option
ddclient: improve documentation

Adopted @joachifm's suggestions.

ddclient additional refinement
Diffstat (limited to 'nixos/modules/services/networking/ddclient.nix')
-rw-r--r--nixos/modules/services/networking/ddclient.nix15
1 files changed, 14 insertions, 1 deletions
diff --git a/nixos/modules/services/networking/ddclient.nix b/nixos/modules/services/networking/ddclient.nix
index 005c57dce7c..08655f56d79 100644
--- a/nixos/modules/services/networking/ddclient.nix
+++ b/nixos/modules/services/networking/ddclient.nix
@@ -7,7 +7,7 @@ let
 
   stateDir = "/var/spool/ddclient";
   ddclientUser = "ddclient";
-  ddclientFlags = "-foreground -verbose -noquiet -file /etc/ddclient.conf";
+  ddclientFlags = "-foreground -verbose -noquiet -file ${config.services.ddclient.configFile}";
   ddclientPIDFile = "${stateDir}/ddclient.pid";
 
 in
@@ -52,6 +52,17 @@ in
         '';
       };
 
+      configFile = mkOption {
+        default = "/etc/ddclient.conf";
+        type = path;
+        description = ''
+          Path to configuration file.
+          When set to the default '/etc/ddclient.conf' it will be populated with the various other options in this module. When it is changed (for example: '/root/nixos/secrets/ddclient.conf') the file read directly to configure ddclient. This is a source of impurity.
+          The purpose of this is to avoid placing secrets into the store.
+        '';
+        example = "/root/nixos/secrets/ddclient.conf";
+      };
+
       protocol = mkOption {
         default = "dyndns2";
         type = str;
@@ -109,9 +120,11 @@ in
     };
 
     environment.etc."ddclient.conf" = {
+      enable = config.services.ddclient.configFile == /etc/ddclient.conf;
       uid = config.ids.uids.ddclient;
       mode = "0600";
       text = ''
+        # This file can be used as a template for configFile or is automatically generated by Nix options.
         daemon=600
         cache=${stateDir}/ddclient.cache
         pid=${ddclientPIDFile}