2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, common-updater-scripts, coreutils, git, gnused, nix
|
|
|
|
, nixfmt, writeScript, nixosTests, jq, cacert, curl }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "jenkins";
|
2021-04-22 02:08:21 +00:00
|
|
|
version = "2.277.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "http://mirrors.jenkins.io/war-stable/${version}/jenkins.war";
|
2021-04-22 02:08:21 +00:00
|
|
|
sha256 = "1awixb55bkpqcvf2s59aph3kxdd70g9x1a5s5kly33kwrplcf8iy";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
buildCommand = ''
|
|
|
|
mkdir -p "$out/webapps"
|
|
|
|
cp "$src" "$out/webapps/jenkins.war"
|
|
|
|
'';
|
|
|
|
|
2020-11-06 00:33:48 +00:00
|
|
|
passthru = {
|
|
|
|
tests = { inherit (nixosTests) jenkins; };
|
|
|
|
|
|
|
|
updateScript = writeScript "update.sh" ''
|
|
|
|
#!${stdenv.shell}
|
|
|
|
set -o errexit
|
|
|
|
PATH=${
|
2021-02-05 17:12:51 +00:00
|
|
|
lib.makeBinPath [
|
2020-11-06 00:33:48 +00:00
|
|
|
cacert
|
|
|
|
common-updater-scripts
|
|
|
|
coreutils
|
|
|
|
curl
|
|
|
|
git
|
|
|
|
gnused
|
|
|
|
jq
|
|
|
|
nix
|
|
|
|
nixfmt
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
core_json="$(curl -s --fail --location https://updates.jenkins.io/stable/update-center.actual.json | jq .core)"
|
|
|
|
oldVersion=$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion jenkins" | tr -d '"')
|
|
|
|
|
|
|
|
version="$(jq -r .version <<<$core_json)"
|
|
|
|
sha256="$(jq -r .sha256 <<<$core_json)"
|
|
|
|
hash="$(nix-hash --type sha256 --to-base32 "$sha256")"
|
|
|
|
url="$(jq -r .url <<<$core_json)"
|
|
|
|
|
|
|
|
if [ ! "$oldVersion" = "$version" ]; then
|
|
|
|
update-source-version jenkins "$version" "$hash" "$url"
|
|
|
|
nixpkgs="$(git rev-parse --show-toplevel)"
|
|
|
|
default_nix="$nixpkgs/pkgs/development/tools/continuous-integration/jenkins/default.nix"
|
|
|
|
nixfmt "$default_nix"
|
|
|
|
else
|
|
|
|
echo "jenkins is already up-to-date"
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "An extendable open source continuous integration server";
|
|
|
|
homepage = "https://jenkins-ci.org";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.all;
|
2020-11-06 00:33:48 +00:00
|
|
|
maintainers = with maintainers; [ coconnor fpletz earldouglas nequissimus ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|