aboutsummaryrefslogtreecommitdiff
path: root/modules/apps
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2017-11-26 20:15:53 +0300
committerIgor Pashev <pashev.igor@gmail.com>2017-11-26 20:18:16 +0300
commit6ba5900c3311ccb8fa683e03294993deb8b036f9 (patch)
tree1fe924de7396d2cf9e17de8cb059737528b3f307 /modules/apps
parent88b1eb65bf7a71b3d74d00ed711ae7891884c5d6 (diff)
downloadnixsap-6ba5900c3311ccb8fa683e03294993deb8b036f9.tar.gz
(*BREAKING*) Jenkins: introduce java properties
Just like in Cassandra. First of all `hudson.model.DirectoryBrowserSupport.CSP` is needed. BREAKING: `jre` -> `jre.package`
Diffstat (limited to 'modules/apps')
-rw-r--r--modules/apps/jenkins/default.nix18
-rw-r--r--modules/apps/jenkins/instance.nix18
2 files changed, 24 insertions, 12 deletions
diff --git a/modules/apps/jenkins/default.nix b/modules/apps/jenkins/default.nix
index 63dbe00..0e5fa6b 100644
--- a/modules/apps/jenkins/default.nix
+++ b/modules/apps/jenkins/default.nix
@@ -40,12 +40,13 @@ let
mkService = name: cfg:
let
+ inherit (cfg.jre) properties;
+
mkOpt = n: v: if isBool v then (if v then "--${n}" else "")
else if isString v then "--${n}='${v}'"
else "--${n}=${toString v}";
path = ".war.path";
- tmpdir = "${cfg.home}/tmp";
start = pkgs.writeBashScriptBin "jenkins-${name}" ''
set -euo pipefail
@@ -98,14 +99,17 @@ let
echo '${cfg.war}' > ${path}
fi
- rm -rf -- '${tmpdir}'
- mkdir -p -- '${tmpdir}'
- exec ${cfg.jre}/bin/java \
+ rm -rf -- '${cfg.jre.properties.java.io.tmpdir}'
+ mkdir -p -- '${cfg.jre.properties.java.io.tmpdir}'
+
+ # TODO: generalize properties, maybe put in a file:
+ exec ${cfg.jre.package}/bin/java \
-DJENKINS_HOME='${cfg.home}' \
- -Djava.io.tmpdir='${tmpdir}' \
+ ${optionalString (properties.hudson.model.DirectoryBrowserSupport.CSP != null)
+ ''-Dhudson.model.DirectoryBrowserSupport.CSP="${properties.hudson.model.DirectoryBrowserSupport.CSP}"''} \
+ -Djava.io.tmpdir='${properties.java.io.tmpdir}' \
-jar '${cfg.war}' \
- ${concatStringsSep " \\\n " (
- mapAttrsToList mkOpt (explicit cfg.options))}
+ ${concatStringsSep " \\\n " (mapAttrsToList mkOpt (explicit cfg.options))}
'';
in {
diff --git a/modules/apps/jenkins/instance.nix b/modules/apps/jenkins/instance.nix
index 692b066..6735ab8 100644
--- a/modules/apps/jenkins/instance.nix
+++ b/modules/apps/jenkins/instance.nix
@@ -1,5 +1,5 @@
pkgs:
-{ lib, name, ... }:
+{ lib, name, config, ... }:
let
@@ -13,14 +13,22 @@ let
default = d: t: mkOption { type = t; default = d; };
optional = t: mkOption { type = nullOr t; default = null; };
+ readonly = d: t: mkOption { type = nullOr t; default = d; readOnly = true; };
in {
options = {
- jre = mkOption {
- description = "Java runtime package";
- default = pkgs.jre8;
- type = package;
+ jre = {
+ package = mkOption {
+ description = "Java runtime package";
+ default = pkgs.jre8;
+ type = package;
+ };
+
+ properties = {
+ hudson.model.DirectoryBrowserSupport.CSP = optional str;
+ java.io.tmpdir = readonly "${config.home}/tmp" path;
+ };
};
war = mkOption {