2008-11-18 18:00:15 +00:00
|
|
|
# Disnix server
|
2009-10-12 17:36:19 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
2008-07-06 19:34:19 +01:00
|
|
|
|
|
|
|
let
|
2009-10-12 17:36:19 +01:00
|
|
|
|
|
|
|
cfg = config.services.disnix;
|
2010-11-01 17:33:54 +00:00
|
|
|
|
|
|
|
disnix_activation_scripts = pkgs.disnix_activation_scripts.override (origArgs: {
|
|
|
|
enableApacheWebApplication = config.services.httpd.enable;
|
|
|
|
enableAxis2WebService = config.services.tomcat.axis2.enable;
|
|
|
|
enableEjabberdDump = config.services.ejabberd.enable;
|
|
|
|
enableMySQLDatabase = config.services.mysql.enable;
|
|
|
|
enableTomcatWebApplication = config.services.tomcat.enable;
|
|
|
|
});
|
2009-10-12 17:36:19 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
2009-09-02 11:27:44 +01:00
|
|
|
|
2008-11-18 18:00:15 +00:00
|
|
|
options = {
|
2009-10-12 17:36:19 +01:00
|
|
|
|
|
|
|
services.disnix = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "Whether to enable Disnix";
|
2010-11-01 17:33:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
useWebServiceInterface = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "Whether to enable the DisnixWebService interface running on Apache Tomcat";
|
|
|
|
};
|
2009-10-12 17:36:19 +01:00
|
|
|
|
2008-11-18 18:00:15 +00:00
|
|
|
};
|
2009-10-12 17:36:19 +01:00
|
|
|
|
2008-11-18 18:00:15 +00:00
|
|
|
};
|
2009-10-12 17:36:19 +01:00
|
|
|
|
2008-11-18 18:00:15 +00:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
###### implementation
|
2008-11-18 18:00:15 +00:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
config = mkIf cfg.enable {
|
2008-07-06 19:34:19 +01:00
|
|
|
|
2010-11-02 04:20:37 +00:00
|
|
|
environment.systemPackages = [ pkgs.disnix ] ++ optional cfg.useWebServiceInterface pkgs.DisnixWebService;
|
2008-11-18 18:00:15 +00:00
|
|
|
|
2009-10-12 17:36:19 +01:00
|
|
|
services.dbus.enable = true;
|
|
|
|
services.dbus.packages = [ pkgs.disnix ];
|
2008-11-18 18:00:15 +00:00
|
|
|
|
2010-11-01 17:33:54 +00:00
|
|
|
services.tomcat.enable = cfg.useWebServiceInterface;
|
2010-11-01 19:01:26 +00:00
|
|
|
services.tomcat.extraGroups = [ "disnix" ];
|
2010-11-01 17:33:54 +00:00
|
|
|
services.tomcat.javaOpts = "${optionalString cfg.useWebServiceInterface "-Djava.library.path=${pkgs.libmatthew_java}/lib/jni"} ";
|
|
|
|
services.tomcat.sharedLibs = []
|
|
|
|
++ optional cfg.useWebServiceInterface "${pkgs.DisnixWebService}/share/java/DisnixConnection.jar"
|
|
|
|
++ optional cfg.useWebServiceInterface "${pkgs.dbus_java}/share/java/dbus.jar";
|
|
|
|
services.tomcat.webapps = [] ++ optional cfg.useWebServiceInterface pkgs.DisnixWebService;
|
|
|
|
|
2010-04-19 14:26:21 +01:00
|
|
|
users.extraGroups = singleton
|
|
|
|
{ name = "disnix";
|
|
|
|
gid = config.ids.gids.disnix;
|
|
|
|
};
|
|
|
|
|
2009-10-12 19:09:34 +01:00
|
|
|
jobs.disnix =
|
2009-10-12 17:36:19 +01:00
|
|
|
{ description = "Disnix server";
|
|
|
|
|
2009-11-06 22:19:17 +00:00
|
|
|
startOn = "started dbus";
|
2009-10-12 17:36:19 +01:00
|
|
|
|
|
|
|
script =
|
2010-11-01 17:33:54 +00:00
|
|
|
''
|
2010-11-01 19:01:26 +00:00
|
|
|
export PATH=/var/run/current-system/sw/bin:/var/run/current-system/sw/sbin
|
|
|
|
export HOME=/root
|
|
|
|
|
2010-11-01 17:33:54 +00:00
|
|
|
${pkgs.disnix}/bin/disnix-service --activation-modules-dir=${disnix_activation_scripts}/libexec/disnix/activation-scripts
|
2009-10-12 17:36:19 +01:00
|
|
|
'';
|
|
|
|
};
|
2008-11-23 01:28:58 +00:00
|
|
|
|
2008-11-18 18:00:15 +00:00
|
|
|
};
|
2009-10-12 17:36:19 +01:00
|
|
|
|
2008-07-06 19:34:19 +01:00
|
|
|
}
|