1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7 cfg = config.services.jboss;
8
9 jbossService = pkgs.stdenv.mkDerivation {
10 name = "jboss-server";
11 builder = ./builder.sh;
12 inherit (pkgs) jboss su;
13 inherit (cfg) tempDir logDir libUrl deployDir serverDir user useJK;
14 };
15
16in
17
18{
19
20 ###### interface
21
22 options = {
23
24 services.jboss = {
25
26 enable = mkOption {
27 default = false;
28 description = "Whether to enable JBoss. WARNING : this package is outdated and is known to have vulnerabilities.";
29 };
30
31 tempDir = mkOption {
32 default = "/tmp";
33 description = "Location where JBoss stores its temp files";
34 };
35
36 logDir = mkOption {
37 default = "/var/log/jboss";
38 description = "Location of the logfile directory of JBoss";
39 };
40
41 serverDir = mkOption {
42 description = "Location of the server instance files";
43 default = "/var/jboss/server";
44 };
45
46 deployDir = mkOption {
47 description = "Location of the deployment files";
48 default = "/nix/var/nix/profiles/default/server/default/deploy/";
49 };
50
51 libUrl = mkOption {
52 default = "file:///nix/var/nix/profiles/default/server/default/lib";
53 description = "Location where the shared library JARs are stored";
54 };
55
56 user = mkOption {
57 default = "nobody";
58 description = "User account under which jboss runs.";
59 };
60
61 useJK = mkOption {
62 default = false;
63 description = "Whether to use to connector to the Apache HTTP server";
64 };
65
66 };
67
68 };
69
70
71 ###### implementation
72
73 config = mkIf config.services.jboss.enable {
74 systemd.services.jboss = {
75 description = "JBoss server";
76 script = "${jbossService}/bin/control start";
77 wantedBy = [ "multi-user.target" ];
78 };
79 };
80}