at 23.11-pre 2.1 kB view raw
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 type = types.bool; 28 default = false; 29 description = lib.mdDoc "Whether to enable JBoss. WARNING : this package is outdated and is known to have vulnerabilities."; 30 }; 31 32 tempDir = mkOption { 33 default = "/tmp"; 34 type = types.str; 35 description = lib.mdDoc "Location where JBoss stores its temp files"; 36 }; 37 38 logDir = mkOption { 39 default = "/var/log/jboss"; 40 type = types.str; 41 description = lib.mdDoc "Location of the logfile directory of JBoss"; 42 }; 43 44 serverDir = mkOption { 45 description = lib.mdDoc "Location of the server instance files"; 46 default = "/var/jboss/server"; 47 type = types.str; 48 }; 49 50 deployDir = mkOption { 51 description = lib.mdDoc "Location of the deployment files"; 52 default = "/nix/var/nix/profiles/default/server/default/deploy/"; 53 type = types.str; 54 }; 55 56 libUrl = mkOption { 57 default = "file:///nix/var/nix/profiles/default/server/default/lib"; 58 description = lib.mdDoc "Location where the shared library JARs are stored"; 59 type = types.str; 60 }; 61 62 user = mkOption { 63 default = "nobody"; 64 description = lib.mdDoc "User account under which jboss runs."; 65 type = types.str; 66 }; 67 68 useJK = mkOption { 69 type = types.bool; 70 default = false; 71 description = lib.mdDoc "Whether to use to connector to the Apache HTTP server"; 72 }; 73 74 }; 75 76 }; 77 78 79 ###### implementation 80 81 config = mkIf config.services.jboss.enable { 82 systemd.services.jboss = { 83 description = "JBoss server"; 84 script = "${jbossService}/bin/control start"; 85 wantedBy = [ "multi-user.target" ]; 86 }; 87 }; 88}