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