mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 14:10:33 +03:00
jenkins service: add declarative plugin support
This commit is contained in:
parent
8c0b08d1a4
commit
41ea71a347
1 changed files with 34 additions and 3 deletions
|
@ -101,6 +101,22 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugins = mkOption {
|
||||||
|
default = null;
|
||||||
|
#type = types.nullOr (types.attrsOf types.package);
|
||||||
|
description = ''
|
||||||
|
A set of plugins to activate. Note that this will completely
|
||||||
|
remove and replace any previously installed plugins. If you
|
||||||
|
have manually-installed plugins that you want to keep while
|
||||||
|
using this module, set this option to
|
||||||
|
<literal>null</literal>. You can generate this set with a
|
||||||
|
tool such as <literal>jenkinsPlugins2nix</literal>.
|
||||||
|
'';
|
||||||
|
example = literalExample ''
|
||||||
|
import path/to/jenkinsPlugins2nix-generated-plugins.nix { inherit (pkgs) fetchurl stdenv; }
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
extraOptions = mkOption {
|
extraOptions = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
|
@ -149,9 +165,24 @@ in {
|
||||||
path = cfg.packages;
|
path = cfg.packages;
|
||||||
|
|
||||||
# Force .war (re)extraction, or else we might run stale Jenkins.
|
# Force .war (re)extraction, or else we might run stale Jenkins.
|
||||||
preStart = ''
|
|
||||||
rm -rf ${cfg.home}/war
|
preStart =
|
||||||
'';
|
let replacePlugins =
|
||||||
|
if isNull cfg.plugins
|
||||||
|
then ""
|
||||||
|
else
|
||||||
|
let pluginCmds = lib.attrsets.mapAttrsToList
|
||||||
|
(n: v: "cp ${v} ${cfg.home}/plugins/${n}.hpi")
|
||||||
|
cfg.plugins;
|
||||||
|
in ''
|
||||||
|
rm -r ${cfg.home}/plugins
|
||||||
|
mkdir -p ${cfg.home}/plugins
|
||||||
|
${lib.strings.concatStringsSep "\n" pluginCmds}
|
||||||
|
'';
|
||||||
|
in ''
|
||||||
|
rm -rf ${cfg.home}/war
|
||||||
|
${replacePlugins}
|
||||||
|
'';
|
||||||
|
|
||||||
script = ''
|
script = ''
|
||||||
${pkgs.jdk}/bin/java -jar ${pkgs.jenkins}/webapps/jenkins.war --httpListenAddress=${cfg.listenAddress} \
|
${pkgs.jdk}/bin/java -jar ${pkgs.jenkins}/webapps/jenkins.war --httpListenAddress=${cfg.listenAddress} \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue