Convert "tomcat"

svn path=/nixos/branches/fix-style/; revision=14380
This commit is contained in:
Marc Weber 2009-03-06 12:26:34 +00:00
parent b17f9995d5
commit eacbb7c38e
3 changed files with 162 additions and 148 deletions

View File

@ -480,53 +480,6 @@ in
}; };
tomcat = {
enable = mkOption {
default = false;
description = "Whether to enable Apache Tomcat";
};
baseDir = mkOption {
default = "/var/tomcat";
description = "Location where Tomcat stores configuration files, webapplications and logfiles";
};
user = mkOption {
default = "tomcat";
description = "User account under which Apache Tomcat runs.";
};
deployFrom = mkOption {
default = "";
description = "Location where webapplications are stored. Leave empty to use the baseDir.";
};
javaOpts = mkOption {
default = "";
description = "Parameters to pass to the Java Virtual Machine which spawns Apache Tomcat";
};
catalinaOpts = mkOption {
default = "";
description = "Parameters to pass to the Java Virtual Machine which spawns the Catalina servlet container";
};
sharedLibFrom = mkOption {
default = "";
description = "Location where shared libraries are stored. Leave empty to use the baseDir.";
};
commonLibFrom = mkOption {
default = "";
description = "Location where common libraries are stored. Leave empty to use the baseDir.";
};
contextXML = mkOption {
default = "";
description = "Location of the context.xml to use. Leave empty to use the default.";
};
};
httpd = { httpd = {
enable = mkOption { enable = mkOption {
@ -1302,6 +1255,7 @@ in
(import ../upstart-jobs/gnunet.nix) (import ../upstart-jobs/gnunet.nix)
(import ../upstart-jobs/ejabberd.nix) # untested, dosen't compile on x86_64-linux (import ../upstart-jobs/ejabberd.nix) # untested, dosen't compile on x86_64-linux
(import ../upstart-jobs/jboss.nix) (import ../upstart-jobs/jboss.nix)
(import ../upstart-jobs/tomcat.nix) # untested, too lazy to get that jdk
# nix # nix
(import ../upstart-jobs/nix.nix) # nix options and daemon (import ../upstart-jobs/nix.nix) # nix options and daemon

View File

@ -174,12 +174,6 @@ let
inherit config pkgs; inherit config pkgs;
}) })
# Apache Tomcat service
++ optional config.services.tomcat.enable
(import ../upstart-jobs/tomcat.nix {
inherit config pkgs;
})
# Samba service. # Samba service.
++ optional config.services.samba.enable ++ optional config.services.samba.enable
(import ../upstart-jobs/samba.nix { (import ../upstart-jobs/samba.nix {

View File

@ -1,10 +1,74 @@
args: with args; {pkgs, config, ...}:
###### interface
let
inherit (pkgs.lib) mkOption mkIf;
options = {
services = {
tomcat = {
enable = mkOption {
default = false;
description = "Whether to enable Apache Tomcat";
};
baseDir = mkOption {
default = "/var/tomcat";
description = "Location where Tomcat stores configuration files, webapplications and logfiles";
};
user = mkOption {
default = "tomcat";
description = "User account under which Apache Tomcat runs.";
};
deployFrom = mkOption {
default = "";
description = "Location where webapplications are stored. Leave empty to use the baseDir.";
};
javaOpts = mkOption {
default = "";
description = "Parameters to pass to the Java Virtual Machine which spawns Apache Tomcat";
};
catalinaOpts = mkOption {
default = "";
description = "Parameters to pass to the Java Virtual Machine which spawns the Catalina servlet container";
};
sharedLibFrom = mkOption {
default = "";
description = "Location where shared libraries are stored. Leave empty to use the baseDir.";
};
commonLibFrom = mkOption {
default = "";
description = "Location where common libraries are stored. Leave empty to use the baseDir.";
};
contextXML = mkOption {
default = "";
description = "Location of the context.xml to use. Leave empty to use the default.";
};
};
};
};
in
###### implementation
let let
cfg = config.services.tomcat; cfg = config.services.tomcat;
in in
{ mkIf config.services.tomcat.enable {
require = [
options
];
services = {
extraJobs = [{
name = "tomcat"; name = "tomcat";
groups = [ groups = [
@ -106,4 +170,6 @@ in
CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${pkgs.jdk} ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c ${pkgs.tomcat6}/bin/shutdown.sh CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${pkgs.jdk} ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c ${pkgs.tomcat6}/bin/shutdown.sh
end script end script
''; '';
}];
};
} }