summary refs log tree commit diff
path: root/nixos/modules/services/networking/znc.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/services/networking/znc.nix')
-rw-r--r--nixos/modules/services/networking/znc.nix191
1 files changed, 90 insertions, 101 deletions
diff --git a/nixos/modules/services/networking/znc.nix b/nixos/modules/services/networking/znc.nix
index 2aa63c6e7df..b39aea04521 100644
--- a/nixos/modules/services/networking/znc.nix
+++ b/nixos/modules/services/networking/znc.nix
@@ -25,85 +25,6 @@ let
     paths = cfg.modulePackages;
   };
 
-  confOptions = { ... }: {
-    options = {
-      modules = mkOption {
-        type = types.listOf types.string;
-        default = [ "partyline" "webadmin" "adminlog" "log" ];
-        example = [ "partyline" "webadmin" "adminlog" "log" ];
-        description = ''
-          A list of modules to include in the `znc.conf` file.
-        '';
-      };
-
-      userModules = mkOption {
-        type = types.listOf types.string;
-        default = [ ];
-        example = [ "fish" "push" ];
-        description = ''
-          A list of user modules to include in the `znc.conf` file.
-        '';
-      };
-
-      userName = mkOption {
-        default = defaultUserName;
-        example = "johntron";
-        type = types.string;
-        description = ''
-          The user name to use when generating the `znc.conf` file.
-          This is the user name used by the user logging into the ZNC web admin. 
-        '';
-      };
-
-      nick = mkOption {
-        default = "znc-user";
-        example = "john";
-        type = types.string;
-        description = ''
-          The IRC nick to use when generating the `znc.conf` file.
-        '';
-      };
-
-      passBlock = mkOption {
-        default = defaultPassBlock;
-        example = "Must be the block generated by the `znc --makepass` command.";
-        type = types.string;
-        description = ''
-          The pass block to use when generating the `znc.conf` file.
-          This is the password used by the user logging into the ZNC web admin.
-          This is the block generated by the `znc --makepass` command.
-          !!! If not specified, please change this after starting the service. !!!
-        '';
-      };
-
-      port = mkOption {
-        default = 5000;
-        example = 5000;
-        type = types.int;
-        description = ''
-          Specifies the port on which to listen.
-        '';
-      };
- 
-      useSSL = mkOption {
-        default = true;
-        example = true;
-        type = types.bool;
-        description = ''
-          Indicates whether the ZNC server should use SSL when listening on the specified port.
-        '';
-      };
-
-      extraZncConf = mkOption {
-        default = "";
-        type = types.lines;
-        description = ''
-          Extra config to `znc.conf` file
-        '';
-      };
-    };
-  };
-
   # Keep znc.conf in nix store, then symlink or copy into `dataDir`, depending on `mutable`.
   mkZncConf = confOpts: ''
     // Also check http://en.znc.in/wiki/Configuration
@@ -211,18 +132,91 @@ in
         '';
       };
 
-      confOptions = mkOption {
-        default = {};
-        example = {
-          modules = [ "log" ];
-          userName = "john";
-          nick = "johntron";
+      /* TODO: add to the documentation of the current module:
+
+         Values to use when creating a `znc.conf` file.
+
+           confOptions = {
+             modules = [ "log" ];
+             userName = "john";
+             nick = "johntron";
+           };
+      */
+      confOptions = {
+        modules = mkOption {
+          type = types.listOf types.string;
+          default = [ "partyline" "webadmin" "adminlog" "log" ];
+          example = [ "partyline" "webadmin" "adminlog" "log" ];
+          description = ''
+            A list of modules to include in the `znc.conf` file.
+          '';
+        };
+
+        userModules = mkOption {
+          type = types.listOf types.string;
+          default = [ ];
+          example = [ "fish" "push" ];
+          description = ''
+            A list of user modules to include in the `znc.conf` file.
+          '';
+        };
+
+        userName = mkOption {
+          default = defaultUserName;
+          example = "johntron";
+          type = types.string;
+          description = ''
+            The user name to use when generating the `znc.conf` file.
+            This is the user name used by the user logging into the ZNC web admin.
+          '';
+        };
+
+        nick = mkOption {
+          default = "znc-user";
+          example = "john";
+          type = types.string;
+          description = ''
+            The IRC nick to use when generating the `znc.conf` file.
+          '';
+        };
+
+        passBlock = mkOption {
+          default = defaultPassBlock;
+          example = "Must be the block generated by the `znc --makepass` command.";
+          type = types.string;
+          description = ''
+            The pass block to use when generating the `znc.conf` file.
+            This is the password used by the user logging into the ZNC web admin.
+            This is the block generated by the `znc --makepass` command.
+            !!! If not specified, please change this after starting the service. !!!
+          '';
+        };
+
+        port = mkOption {
+          default = 5000;
+          example = 5000;
+          type = types.int;
+          description = ''
+            Specifies the port on which to listen.
+          '';
+        };
+
+        useSSL = mkOption {
+          default = true;
+          example = true;
+          type = types.bool;
+          description = ''
+            Indicates whether the ZNC server should use SSL when listening on the specified port.
+          '';
+        };
+
+        extraZncConf = mkOption {
+          default = "";
+          type = types.lines;
+          description = ''
+            Extra config to `znc.conf` file
+          '';
         };
-        type = types.optionSet;
-        description = ''
-          Values to use when creating a `znc.conf` file.
-        '';
-        options = confOptions; 
       };
 
       modulePackages = mkOption {
@@ -280,20 +274,16 @@ in
 
         # If mutable, regenerate conf file every time.
         ${optionalString (!cfg.mutable) ''
-          ${pkgs.coreutils}/echo "znc is set to be system-managed. Now deleting old znc.conf file to be regenerated."
-          ${pkgs.coreutils}/rm -f ${cfg.dataDir}/configs/znc.conf
+          ${pkgs.coreutils}/bin/echo "znc is set to be system-managed. Now deleting old znc.conf file to be regenerated."
+          ${pkgs.coreutils}/bin/rm -f ${cfg.dataDir}/configs/znc.conf
         ''}
 
         # Ensure essential files exist.
         if [[ ! -f ${cfg.dataDir}/configs/znc.conf ]]; then
-          ${pkgs.coreutils}/bin/echo "No znc.conf file found in ${cfg.dataDir}. Creating one now."
-          ${if (!cfg.mutable)
-            then "${pkgs.coreutils}/bin/ln --force -s ${zncConfFile} ${cfg.dataDir}/.znc/configs/znc.conf"
-            else ''
-              ${pkgs.coreutils}/bin/cp --no-clobber ${zncConfFile} ${cfg.dataDir}/configs/znc.conf
-              ${pkgs.coreutils}/bin/chmod u+rw ${cfg.dataDir}/configs/znc.conf
-              ${pkgs.coreutils}/bin/chown ${cfg.user} ${cfg.dataDir}/configs/znc.conf
-            ''}
+            ${pkgs.coreutils}/bin/echo "No znc.conf file found in ${cfg.dataDir}. Creating one now."
+            ${pkgs.coreutils}/bin/cp --no-clobber ${zncConfFile} ${cfg.dataDir}/configs/znc.conf
+            ${pkgs.coreutils}/bin/chmod u+rw ${cfg.dataDir}/configs/znc.conf
+            ${pkgs.coreutils}/bin/chown ${cfg.user} ${cfg.dataDir}/configs/znc.conf
         fi
 
         if [[ ! -f ${cfg.dataDir}/znc.pem ]]; then
@@ -315,7 +305,6 @@ in
         uid = config.ids.uids.znc;
         home = cfg.dataDir;
         createHome = true;
-        createUser = true;
       };
  
     users.extraGroups = optional (cfg.user == defaultUser)