1{
2 fetchurl,
3 gitUpdater,
4 jre,
5 lib,
6 nixosTests,
7 stdenvNoCC,
8 testers,
9}:
10
11let
12 common =
13 { version, hash }:
14 stdenvNoCC.mkDerivation (finalAttrs: {
15 pname = "apache-tomcat";
16 inherit version;
17
18 src = fetchurl {
19 url = "mirror://apache/tomcat/tomcat-${lib.versions.major version}/v${version}/bin/apache-tomcat-${version}.tar.gz";
20 inherit hash;
21 };
22
23 outputs = [
24 "out"
25 "webapps"
26 ];
27
28 installPhase = ''
29 mkdir $out
30 mv * $out
31 mkdir -p $webapps/webapps
32 mv $out/webapps $webapps/
33 '';
34
35 passthru = {
36 updateScript = gitUpdater {
37 url = "https://github.com/apache/tomcat.git";
38 allowedVersions = "^${lib.versions.major version}\\.";
39 ignoredVersions = "-M.*";
40 };
41 tests = {
42 inherit (nixosTests) tomcat;
43 version = testers.testVersion {
44 package = finalAttrs.finalPackage;
45 command = "JAVA_HOME=${jre} ${finalAttrs.finalPackage}/bin/version.sh";
46 };
47 };
48 };
49
50 meta = {
51 homepage = "https://tomcat.apache.org/";
52 description = "Implementation of the Java Servlet and JavaServer Pages technologies";
53 platforms = jre.meta.platforms;
54 maintainers = with lib.maintainers; [ anthonyroussel ];
55 license = lib.licenses.asl20;
56 sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
57 };
58 });
59
60in
61{
62 tomcat9 = common {
63 version = "9.0.107";
64 hash = "sha256-08qgrQpltJMafTrsok5VQc90O6X6nlGr2ls6MdC0hX0=";
65 };
66
67 tomcat10 = common {
68 version = "10.1.43";
69 hash = "sha256-hZ0Vx/DgjlQ6klv4RyjuIWbHELFKYvvJvn9Y8XqpZ10=";
70 };
71
72 tomcat11 = common {
73 version = "11.0.9";
74 hash = "sha256-YsVio60p26PqBPWK4x6/yGXPISAzUWP88PwD1CbtOoc=";
75 };
76}