diff --git a/system/options.nix b/system/options.nix index 4b8face4306..9244d54d3b2 100644 --- a/system/options.nix +++ b/system/options.nix @@ -1744,6 +1744,20 @@ }; }; + openfire = { + enable = mkOption { + default = false; + description = " + Whether to enable OpenFire XMPP server. + "; + }; + usePostgreSQL = mkOption { + default = true; + description = " + Whether you use PostgreSQL service for your storage back-end. + "; + }; + }; }; diff --git a/upstart-jobs/default.nix b/upstart-jobs/default.nix index c1d73f6e656..fab5f8fe537 100644 --- a/upstart-jobs/default.nix +++ b/upstart-jobs/default.nix @@ -187,6 +187,12 @@ let inherit config pkgs; }) + # OpenFire XMPP server + ++ optional config.services.openfire.enable + (import ../upstart-jobs/openfire.nix { + inherit config pkgs; + }) + # JBoss service ++ optional config.services.jboss.enable (import ../upstart-jobs/jboss.nix { diff --git a/upstart-jobs/openfire.nix b/upstart-jobs/openfire.nix new file mode 100644 index 00000000000..495934e0be2 --- /dev/null +++ b/upstart-jobs/openfire.nix @@ -0,0 +1,28 @@ +{pkgs, config}: + +assert config.services.openfire.usePostgreSQL -> config.services.postgresql.enable; +let + startDependency = if config.services.openfire.usePostgreSQL then + "postgresql" + else + if config.services.gw6c.enable then + "gw6c" + else + "network-interfaces"; +in +with pkgs; +{ + name = "openfire"; + job = '' + description "OpenFire XMPP server" + + start on ${startDependency}/started + stop on shutdown + + script + export PATH=${jre}/bin:${openfire}/bin:${coreutils}/bin:${which}/bin:${gnugrep}/bin:${gawk}/bin:${gnused}/bin + export HOME=/tmp + openfire start + end script + ''; +}