diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2018-12-11 18:10:48 +0300 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2018-12-11 18:10:48 +0300 |
commit | 8b0968b2054d3bb8d90b5ac056727f7c2ebeaed3 (patch) | |
tree | d03b70f693463fc836a8dbe4240424d2547530c8 /modules/pkgs/jenkinsWithPlugins/default.nix | |
parent | c4273035cf5876e3ba8ed2c6b492d31c2de290ee (diff) | |
download | nixsap-8b0968b2054d3bb8d90b5ac056727f7c2ebeaed3.tar.gz |
(* HUGE *) Use nixpkgs overlays
Diffstat (limited to 'modules/pkgs/jenkinsWithPlugins/default.nix')
-rw-r--r-- | modules/pkgs/jenkinsWithPlugins/default.nix | 128 |
1 files changed, 0 insertions, 128 deletions
diff --git a/modules/pkgs/jenkinsWithPlugins/default.nix b/modules/pkgs/jenkinsWithPlugins/default.nix deleted file mode 100644 index ebc12db..0000000 --- a/modules/pkgs/jenkinsWithPlugins/default.nix +++ /dev/null @@ -1,128 +0,0 @@ -{ pkgs, lib, stdenv, fetchurl }: - -/* - - `pluginsFunc` is a function that should return an attribute set of plugins - to be included in the WAR. - - The plugins are provided by `pkgs.jenkinsUpdateCenter.plugins`. - Dependencies between those plugins are automatically resolved within the - same jenkinsUpdateCenter. - - Example: - - pkgs.jenkinsWithPlugins - (plugins: { - inherit (plugins) BlameSubversion ... ; - inherit (pkgs) my-plugin; - }) - - Each attribute of `plugins` is a derivation and you can return in - the set any other plugins that are not available in Jenkins registry - (https://updates.jenkins-ci.org/) or replacing plugins in the registry. - - Non-optional dependencies, if any, are automatically added. Optional - dependencies are ignored, you have to add them explicitly. - -*/ - -pluginsFunc: - -let - - inherit (builtins) - attrNames fromJSON readFile ; - - inherit (lib) - concatStrings filter filterAttrs flatten genAttrs mapAttrs - mapAttrsToList unique ; - - fromBase64 = import ./fromBase64.nix; - - updateCenter = - let - registry = fromJSON (readFile pkgs.jenkinsUpdateCenter); - in - registry // { - core = with registry.core; fetchurl { - inherit url; - name = "jenkins-core-${version}.war"; - sha1 = fromBase64 sha1; - meta = registry.core; - }; - - plugins = mapAttrs ( - _: plugin: fetchurl { - inherit (plugin) url; - sha1 = fromBase64 plugin.sha1; - name = "jenkins-plugin-${plugin.name}-${plugin.version}.hpi"; - meta = plugin; - } - ) registry.plugins; - }; - - inherit (updateCenter) core; - - neededPlugins = - let - rootPlugins = pluginsFunc updateCenter.plugins; - hasDeps = _: p: (p ? meta) && (p.meta ? dependencies); - directDeps = nn: - let - isRequired = d: ! (d ? optional && d.optional); - deps = p: map (d: d.name) (filter isRequired p.meta.dependencies); - in flatten (map (n: deps updateCenter.plugins.${n}) nn); - - getDepsRecursive = nn: if nn == [] then [] else nn ++ getDepsRecursive (directDeps nn); - depNames = unique (getDepsRecursive (attrNames (filterAttrs hasDeps rootPlugins))); - deps = genAttrs depNames (n: updateCenter.plugins.${n}); - in deps // rootPlugins; - - pluginsPack = stdenv.mkDerivation { - name = "jenkins-plugins-pack"; - phases = [ "installPhase" ]; - installPhase = '' - mkdir -p $out - ${concatStrings ( - mapAttrsToList (n: p: '' - ln -svf '${p}' "$out/${n}.hpi" - '') neededPlugins)} - ''; - }; - - pack = stdenv.mkDerivation rec { - name = "jenkins-${core.meta.version}+plugins.war"; - - # https://wiki.jenkins-ci.org/display/JENKINS/Bundling+plugins+with+Jenkins - build-xml = pkgs.writeXML "jenkins.build.xml" - '' - <?xml version="1.0" encoding="UTF-8"?> - <project basedir="." name="Jenkins-Bundle"> - <target name="bundle" description="Merge plugins into jenkins.war"> - <zip destfile="jenkins.war" level="9"> - <zipfileset src="${core}" /> - <zipfileset dir="${pluginsPack}" prefix="WEB-INF/plugins" /> - </zip> - </target> - </project> - ''; - - meta = with stdenv.lib; { - description = "An extendable open source continuous integration server"; - homepage = http://jenkins-ci.org; - license = licenses.mit; - platforms = platforms.all; - }; - - buildInputs = with pkgs; [ ant jdk ]; - - phases = [ "buildPhase" "installPhase" ]; - buildPhase = '' - ln -sf ${build-xml} build.xml - ant bundle - ''; - installPhase = "cp jenkins.war $out"; - }; - -in if neededPlugins == [] then core else pack - |