nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 unzip,
6 elasticsearch,
7}:
8
9let
10 esVersion = elasticsearch.version;
11
12 esPlugin =
13 a@{
14 pluginName,
15 installPhase ? ''
16 mkdir -p $out/config
17 mkdir -p $out/plugins
18 ln -s ${elasticsearch}/lib ${elasticsearch}/modules $out
19 ES_HOME=$out ${elasticsearch}/bin/elasticsearch-plugin install --batch -v file://$src
20 rm $out/lib $out/modules
21 '',
22 ...
23 }:
24 stdenv.mkDerivation (
25 a
26 // {
27 inherit installPhase;
28 pname = "elasticsearch-${pluginName}";
29 dontUnpack = true;
30 # Work around the "unpacker appears to have produced no directories"
31 # case that happens when the archive doesn't have a subdirectory.
32 sourceRoot = ".";
33 nativeBuildInputs = [ unzip ];
34 meta = a.meta // {
35 platforms = elasticsearch.meta.platforms;
36 maintainers = (a.meta.maintainers or [ ]) ++ (with lib.maintainers; [ offline ]);
37 };
38 }
39 );
40in
41{
42
43 analysis-icu = esPlugin rec {
44 name = "elasticsearch-analysis-icu-${version}";
45 pluginName = "analysis-icu";
46 version = esVersion;
47 src = fetchurl {
48 url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/${pluginName}/${pluginName}-${version}.zip";
49 hash =
50 if version == "7.17.27" then
51 "sha256-HGHhcWj+6IWZ9kQCGJD7HmmvwqYV1zjN0tCsEpN4IAA="
52 else
53 throw "unsupported version ${version} for plugin ${pluginName}";
54 };
55 meta = {
56 homepage = "https://github.com/elastic/elasticsearch/tree/master/plugins/analysis-icu";
57 description = "ICU Analysis plugin integrates the Lucene ICU module into elasticsearch";
58 license = lib.licenses.asl20;
59 };
60 };
61
62 analysis-kuromoji = esPlugin rec {
63 pluginName = "analysis-kuromoji";
64 version = esVersion;
65 src = fetchurl {
66 url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/${pluginName}/${pluginName}-${version}.zip";
67 hash =
68 if version == "7.17.27" then
69 "sha256-j0WXuGmE3bRNBnDx/uWxfWrIUrdatDt52ASj8m3mrVg="
70 else
71 throw "unsupported version ${version} for plugin ${pluginName}";
72 };
73 meta = {
74 homepage = "https://github.com/elastic/elasticsearch/tree/master/plugins/analysis-kuromoji";
75 description = "Japanese (kuromoji) Analysis plugin integrates Lucene kuromoji analysis module into Elasticsearch";
76 license = lib.licenses.asl20;
77 };
78 };
79
80 analysis-lemmagen = esPlugin rec {
81 pluginName = "analysis-lemmagen";
82 version = esVersion;
83 src = fetchurl {
84 url = "https://github.com/vhyza/elasticsearch-${pluginName}/releases/download/v${version}/elasticsearch-${pluginName}-${version}-plugin.zip";
85 hash =
86 if version == "7.17.9" then
87 "sha256-iY25apDkS6s0RoR9dVL2o/hFuUo6XhMzLjl8wDSFejk="
88 else
89 throw "unsupported version ${version} for plugin ${pluginName}";
90 };
91 meta = {
92 homepage = "https://github.com/vhyza/elasticsearch-analysis-lemmagen";
93 description = "LemmaGen Analysis plugin provides jLemmaGen lemmatizer as Elasticsearch token filter";
94 license = lib.licenses.asl20;
95 broken = true; # Not released yet for ES 7.17.10
96 };
97 };
98
99 analysis-phonetic = esPlugin rec {
100 pluginName = "analysis-phonetic";
101 version = esVersion;
102 src = fetchurl {
103 url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/${pluginName}/${pluginName}-${version}.zip";
104 hash =
105 if version == "7.17.27" then
106 "sha256-X8b8z9LznJQ24aF9GugRuDz1c9buqT7QGS3jhuDbYBM="
107 else
108 throw "unsupported version ${version} for plugin ${pluginName}";
109 };
110 meta = {
111 homepage = "https://github.com/elastic/elasticsearch/tree/master/plugins/analysis-phonetic";
112 description = "Phonetic Analysis plugin integrates phonetic token filter analysis with elasticsearch";
113 license = lib.licenses.asl20;
114 };
115 };
116
117 analysis-smartcn = esPlugin rec {
118 pluginName = "analysis-smartcn";
119 version = esVersion;
120 src = fetchurl {
121 url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/${pluginName}/${pluginName}-${version}.zip";
122 hash =
123 if version == "7.17.27" then
124 "sha256-0hHHkywdpjKqzZ9vFqQ9B2aLCky17AYzFcSiaz/zGSw="
125 else
126 throw "unsupported version ${version} for plugin ${pluginName}";
127 };
128 meta = {
129 homepage = "https://github.com/elastic/elasticsearch/tree/master/plugins/analysis-smartcn";
130 description = "Smart Chinese Analysis plugin integrates Lucene Smart Chinese analysis module into Elasticsearch";
131 license = lib.licenses.asl20;
132 };
133 };
134
135 discovery-ec2 = esPlugin rec {
136 pluginName = "discovery-ec2";
137 version = esVersion;
138 src = fetchurl {
139 url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/${pluginName}/${pluginName}-${version}.zip";
140 hash =
141 if version == "7.17.27" then
142 "sha256-44p0Pn0mYKR5hWtC8jdaUbh9mbUGiHN9PK98ZT1jQFY="
143 else
144 throw "unsupported version ${version} for plugin ${pluginName}";
145 };
146 meta = {
147 homepage = "https://github.com/elastic/elasticsearch/tree/master/plugins/discovery-ec2";
148 description = "EC2 discovery plugin uses the AWS API for unicast discovery";
149 license = lib.licenses.asl20;
150 };
151 };
152
153 ingest-attachment = esPlugin rec {
154 pluginName = "ingest-attachment";
155 version = esVersion;
156 src = fetchurl {
157 url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/${pluginName}/${pluginName}-${version}.zip";
158 hash =
159 if version == "7.17.27" then
160 "sha256-i+fGO7Ic2Wm/COfPGeRhiJ99Os+rLRYgs/pSepQr68g="
161 else
162 throw "unsupported version ${version} for plugin ${pluginName}";
163 };
164 meta = {
165 homepage = "https://github.com/elastic/elasticsearch/tree/master/plugins/ingest-attachment";
166 description = "Ingest processor that uses Apache Tika to extract contents";
167 license = lib.licenses.asl20;
168 };
169 };
170
171 repository-s3 = esPlugin rec {
172 pluginName = "repository-s3";
173 version = esVersion;
174 src = fetchurl {
175 url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/${pluginName}/${pluginName}-${esVersion}.zip";
176 hash =
177 if version == "7.17.27" then
178 "sha256-o2T0Dd2RqVh99wDPJMEvpnEpFFjz0lQrN9yAVJfiSGY="
179 else
180 throw "unsupported version ${version} for plugin ${pluginName}";
181 };
182 meta = {
183 homepage = "https://github.com/elastic/elasticsearch/tree/master/plugins/repository-s3";
184 description = "S3 repository plugin adds support for using AWS S3 as a repository for Snapshot/Restore";
185 license = lib.licenses.asl20;
186 };
187 };
188
189 repository-gcs = esPlugin rec {
190 pluginName = "repository-gcs";
191 version = esVersion;
192 src = fetchurl {
193 url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/${pluginName}/${pluginName}-${esVersion}.zip";
194 hash =
195 if version == "7.17.27" then
196 "sha256-CWyQuzf2fP9BSIUWL/jxkxrXwdvHyujEINDNhY3FKNI="
197 else
198 throw "unsupported version ${version} for plugin ${pluginName}";
199 };
200 meta = {
201 homepage = "https://github.com/elastic/elasticsearch/tree/master/plugins/repository-gcs";
202 description = "GCS repository plugin adds support for using Google Cloud Storage as a repository for Snapshot/Restore";
203 license = lib.licenses.asl20;
204 };
205 };
206
207 search-guard =
208 let
209 majorVersion = lib.head (builtins.splitVersion esVersion);
210 in
211 esPlugin rec {
212 pluginName = "search-guard";
213 version =
214 # https://docs.search-guard.com/latest/search-guard-versions
215 if esVersion == "7.17.27" then
216 "${esVersion}-53.10.0"
217 else
218 throw "unsupported version ${esVersion} for plugin ${pluginName}";
219 src =
220 if esVersion == "7.17.27" then
221 fetchurl {
222 url = "https://maven.search-guard.com/search-guard-suite-release/com/floragunn/search-guard-suite-plugin/${version}/search-guard-suite-plugin-${version}.zip";
223 hash = "sha256-M1yJ8OD+mDq2uEiK6pvsMxUQMrg6o5A4xEPX8nDt1Rs=";
224 }
225 else
226 throw "unsupported version ${version} for plugin ${pluginName}";
227 meta = {
228 homepage = "https://search-guard.com";
229 description = "Elasticsearch plugin that offers encryption, authentication, and authorisation";
230 license = lib.licenses.asl20;
231 };
232 };
233}