Author: egorochkin
Date: 2010-06-28 18:36:37 +0000 (Mon, 28 Jun 2010)
New Revision: 22425

You can view the changes in this commit at:
   https://svn.nixos.org/viewvc/nix?rev=22425&view=rev

Added:
   nixos/trunk/modules/services/networking/quassel.nix
Modified:
   nixos/trunk/modules/module-list.nix

Log:
Added Quassel IRC client service

Changes:

Modified: nixos/trunk/modules/module-list.nix
===================================================================
--- nixos/trunk/modules/module-list.nix 2010-06-27 19:55:21 UTC (rev 22424)
+++ nixos/trunk/modules/module-list.nix 2010-06-28 18:36:37 UTC (rev 22425)
@@ -92,6 +92,7 @@
   ./services/networking/openvpn.nix
   ./services/networking/portmap.nix
   ./services/networking/privoxy.nix
+  ./services/networking/quassel.nix
   ./services/networking/ssh/lshd.nix
   ./services/networking/ssh/sshd.nix
   ./services/networking/tftpd.nix

Added: nixos/trunk/modules/services/networking/quassel.nix
===================================================================
--- nixos/trunk/modules/services/networking/quassel.nix                         
(rev 0)
+++ nixos/trunk/modules/services/networking/quassel.nix 2010-06-28 18:36:37 UTC 
(rev 22425)
@@ -0,0 +1,97 @@
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+let
+  quassel = pkgs.quassel.override { daemon = true; monolithic = false; client 
= false; };
+  cfg = config.services.quassel;
+in
+
+{
+
+  ###### interface
+
+  options = {
+  
+    services.quassel = {
+
+      enable = mkOption {
+        default = false;
+        description = ''
+          Whether to run the Quassel IRC client daemon.
+        '';
+      };
+
+      interface = mkOption {
+        default = "127.0.0.1";
+        description = ''
+          The interface the Quassel daemon will be listening to.  If 
`127.0.0.1',
+          only clients on the local host can connect to it; if `0.0.0.0', 
clients
+          can access it from any network interface.
+        '';
+      };
+
+      portNumber = mkOption {
+        default = 4242;
+        description = ''
+          The port number the Quassel daemon will be listening to.
+        '';
+      };
+
+      logFile = mkOption {
+        default = "/var/log/quassel.log";
+        description = "Location of the logfile of the Quassel daemon.";
+      };
+
+      dataDir = mkOption {
+        default = ''/home/${cfg.user}/.config/quassel-irc.org'';
+        description = ''
+          The directory holding configuration files, the SQlite database and 
the SSL Cert.
+        '';
+      };
+
+      user = mkOption {
+        default = "quassel";
+        description = ''
+          The user the Quassel daemon should run as.
+        '';
+      };
+
+    };
+
+  };
+  
+
+  ###### implementation
+
+  config = mkIf cfg.enable {
+
+    users.extraUsers = singleton
+      { name = cfg.user;
+        description = "Quassel IRC client daemon";
+      };
+    
+
+    jobs.quassel =
+      { description = "Quassel IRC client daemon";
+
+        startOn = "ip-up";
+
+        preStart = ''
+            mkdir -p ${cfg.dataDir}
+            chown ${cfg.user} ${cfg.dataDir}
+            touch ${cfg.logFile} && chown ${cfg.user} ${cfg.logFile}
+        '';
+
+        exec = ''
+            ${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${cfg.user} \
+                -c '${quassel}/bin/quasselcore --listen=${cfg.interface}\
+                    --port=${toString cfg.portNumber} 
--configdir=${cfg.dataDir} --logfile=${cfg.logFile}'
+        '';
+      };
+
+    environment.systemPackages = [ quassel ];
+
+  };
+  
+}

_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to