2008-11-18 18:00:15 +00:00
|
|
|
# Disnix server
|
2014-04-14 14:26:48 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2009-10-12 16:36:19 +00:00
|
|
|
|
2014-04-14 14:26:48 +00:00
|
|
|
with lib;
|
2008-07-06 18:34:19 +00:00
|
|
|
|
|
|
|
let
|
2009-10-12 16:36:19 +00:00
|
|
|
|
|
|
|
cfg = config.services.disnix;
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2013-06-27 13:32:49 +00:00
|
|
|
dysnomia = pkgs.dysnomia.override (origArgs: {
|
2010-11-01 17:33:54 +00:00
|
|
|
enableApacheWebApplication = config.services.httpd.enable;
|
|
|
|
enableAxis2WebService = config.services.tomcat.axis2.enable;
|
|
|
|
enableEjabberdDump = config.services.ejabberd.enable;
|
|
|
|
enableMySQLDatabase = config.services.mysql.enable;
|
2010-12-22 13:32:51 +00:00
|
|
|
enablePostgreSQLDatabase = config.services.postgresql.enable;
|
|
|
|
enableSubversionRepository = config.services.svnserve.enable;
|
2010-11-01 17:33:54 +00:00
|
|
|
enableTomcatWebApplication = config.services.tomcat.enable;
|
2013-11-07 09:54:53 +00:00
|
|
|
enableMongoDatabase = config.services.mongodb.enable;
|
2010-11-01 17:33:54 +00:00
|
|
|
});
|
2009-10-12 16:36:19 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2008-11-18 18:00:15 +00:00
|
|
|
options = {
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
services.disnix = {
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = "Whether to enable Disnix";
|
2010-11-01 17:33:54 +00:00
|
|
|
};
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2010-11-01 17:33:54 +00:00
|
|
|
useWebServiceInterface = mkOption {
|
|
|
|
default = false;
|
2012-02-06 22:49:41 +00:00
|
|
|
description = "Whether to enable the DisnixWebService interface running on Apache Tomcat";
|
2010-11-01 17:33:54 +00:00
|
|
|
};
|
2016-06-17 09:12:44 +00:00
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.path;
|
|
|
|
description = "The Disnix package";
|
|
|
|
default = pkgs.disnix;
|
2010-11-21 13:28:48 +00:00
|
|
|
};
|
2009-10-12 16:36:19 +00:00
|
|
|
|
2008-11-18 18:00:15 +00:00
|
|
|
};
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2008-11-18 18:00:15 +00:00
|
|
|
};
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
###### implementation
|
2008-11-18 18:00:15 +00:00
|
|
|
|
2009-10-12 16:36:19 +00:00
|
|
|
config = mkIf cfg.enable {
|
2016-06-17 09:12:44 +00:00
|
|
|
dysnomia.enable = true;
|
|
|
|
|
|
|
|
environment.systemPackages = [ pkgs.disnix ] ++ optional cfg.useWebServiceInterface pkgs.DisnixWebService;
|
2008-11-18 18:00:15 +00:00
|
|
|
|
2009-10-12 16:36:19 +00: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"} ";
|
2010-12-10 14:22:00 +00:00
|
|
|
services.tomcat.sharedLibs = optional cfg.useWebServiceInterface "${pkgs.DisnixWebService}/share/java/DisnixConnection.jar"
|
2016-06-17 09:12:44 +00:00
|
|
|
++ optional cfg.useWebServiceInterface "${pkgs.dbus_java}/share/java/dbus.jar";
|
2010-12-10 14:22:00 +00:00
|
|
|
services.tomcat.webapps = optional cfg.useWebServiceInterface pkgs.DisnixWebService;
|
2010-11-01 17:33:54 +00:00
|
|
|
|
2010-04-19 13:26:21 +00:00
|
|
|
users.extraGroups = singleton
|
|
|
|
{ name = "disnix";
|
|
|
|
gid = config.ids.gids.disnix;
|
|
|
|
};
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2016-01-06 06:50:18 +00:00
|
|
|
systemd.services = {
|
|
|
|
disnix = {
|
|
|
|
description = "Disnix server";
|
|
|
|
wants = [ "dysnomia.target" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
after = [ "dbus.service" ]
|
|
|
|
++ optional config.services.httpd.enable "httpd.service"
|
|
|
|
++ optional config.services.mysql.enable "mysql.service"
|
|
|
|
++ optional config.services.postgresql.enable "postgresql.service"
|
|
|
|
++ optional config.services.tomcat.enable "tomcat.service"
|
|
|
|
++ optional config.services.svnserve.enable "svnserve.service"
|
|
|
|
++ optional config.services.mongodb.enable "mongodb.service";
|
|
|
|
|
|
|
|
restartIfChanged = false;
|
|
|
|
|
2016-06-17 09:12:44 +00:00
|
|
|
path = [ config.nix.package cfg.package config.dysnomia.package "/run/current-system/sw" ];
|
2016-01-06 06:50:18 +00:00
|
|
|
|
|
|
|
environment = {
|
|
|
|
HOME = "/root";
|
2016-06-17 09:12:44 +00:00
|
|
|
}
|
|
|
|
// (if config.environment.variables ? DYSNOMIA_CONTAINERS_PATH then { inherit (config.environment.variables) DYSNOMIA_CONTAINERS_PATH; } else {})
|
|
|
|
// (if config.environment.variables ? DYSNOMIA_MODULES_PATH then { inherit (config.environment.variables) DYSNOMIA_MODULES_PATH; } else {});
|
|
|
|
|
|
|
|
serviceConfig.ExecStart = "${cfg.package}/bin/disnix-service";
|
2016-01-06 06:50:18 +00:00
|
|
|
};
|
|
|
|
|
2010-12-10 14:22:00 +00:00
|
|
|
};
|
2008-11-18 18:00:15 +00:00
|
|
|
};
|
2008-07-06 18:34:19 +00:00
|
|
|
}
|