From d702fbfe32f27e2aa62128db76ee9c845871ac44 Mon Sep 17 00:00:00 2001 From: happysalada Date: Mon, 30 Aug 2021 11:57:31 +0900 Subject: [PATCH] elasticsearch: nixpkgs-fmt --- pkgs/servers/search/elasticsearch/7.x.nix | 13 ++-- pkgs/servers/search/elasticsearch/plugins.nix | 71 ++++++++++--------- 2 files changed, 45 insertions(+), 39 deletions(-) diff --git a/pkgs/servers/search/elasticsearch/7.x.nix b/pkgs/servers/search/elasticsearch/7.x.nix index fb15951399fe..50ec006cc5cd 100644 --- a/pkgs/servers/search/elasticsearch/7.x.nix +++ b/pkgs/servers/search/elasticsearch/7.x.nix @@ -1,10 +1,13 @@ { elk7Version , enableUnfree ? true -, lib, stdenv +, lib +, stdenv , fetchurl , makeWrapper , jre_headless -, util-linux, gnugrep, coreutils +, util-linux +, gnugrep +, coreutils , autoPatchelfHook , zlib }: @@ -17,11 +20,11 @@ let shas = if enableUnfree then { - x86_64-linux = "1s27bzx5y8vcd95qrw6av3fhyxb45219x9ahwaxa2cygmbpighrp"; + x86_64-linux = "1s27bzx5y8vcd95qrw6av3fhyxb45219x9ahwaxa2cygmbpighrp"; x86_64-darwin = "1ia3byir3i5qaarmcaysrg3dhnxjmxnf0m0kzyf61g9aiy87gb7q"; } else { - x86_64-linux = "005i7d7ag10qkn7bkx7md50iihvcvc84hay2j94wvsm7yghhbmi3"; + x86_64-linux = "005i7d7ag10qkn7bkx7md50iihvcvc84hay2j94wvsm7yghhbmi3"; x86_64-darwin = "01f81720rbzdqc0g1xymhz2lflldfbnb0rh7mpki99pss28vj9sh"; }; in @@ -48,7 +51,7 @@ stdenv.mkDerivation (rec { nativeBuildInputs = [ makeWrapper ]; buildInputs = [ jre_headless util-linux ] - ++ optional enableUnfree zlib; + ++ optional enableUnfree zlib; installPhase = '' mkdir -p $out diff --git a/pkgs/servers/search/elasticsearch/plugins.nix b/pkgs/servers/search/elasticsearch/plugins.nix index 19aac337057f..5ceb6b079410 100644 --- a/pkgs/servers/search/elasticsearch/plugins.nix +++ b/pkgs/servers/search/elasticsearch/plugins.nix @@ -3,17 +3,17 @@ let esVersion = elasticsearch.version; - esPlugin = a@{ - pluginName, - installPhase ? '' - mkdir -p $out/config - mkdir -p $out/plugins - ln -s ${elasticsearch}/lib $out/lib - ES_HOME=$out ${elasticsearch}/bin/elasticsearch-plugin install --batch -v file://$src - rm $out/lib - '', - ... - }: + esPlugin = + a@{ pluginName + , installPhase ? '' + mkdir -p $out/config + mkdir -p $out/plugins + ln -s ${elasticsearch}/lib $out/lib + ES_HOME=$out ${elasticsearch}/bin/elasticsearch-plugin install --batch -v file://$src + rm $out/lib + '' + , ... + }: stdenv.mkDerivation (a // { inherit installPhase; pname = "elasticsearch-${pluginName}"; @@ -24,10 +24,11 @@ let nativeBuildInputs = [ unzip ]; meta = a.meta // { platforms = elasticsearch.meta.platforms; - maintainers = (a.meta.maintainers or []) ++ (with lib.maintainers; [ offline ]); + maintainers = (a.meta.maintainers or [ ]) ++ (with lib.maintainers; [ offline ]); }; }); -in { +in +{ analysis-icu = esPlugin rec { name = "elasticsearch-analysis-icu-${version}"; @@ -149,26 +150,28 @@ in { }; }; - search-guard = let - majorVersion = lib.head (builtins.splitVersion esVersion); - in esPlugin rec { - pluginName = "search-guard"; - version = - # https://docs.search-guard.com/latest/search-guard-versions - if esVersion == "7.5.1" then "${esVersion}-38.0.0" - else if esVersion == "6.8.3" then "${esVersion}-25.5" - else throw "unsupported version ${esVersion} for plugin ${pluginName}"; - src = fetchurl { - url = "mirror://maven/com/floragunn/${pluginName}-${majorVersion}/${version}/${pluginName}-${majorVersion}-${version}.zip"; - sha256 = - if version == "7.5.1-38.0.0" then "1a1wp9wrmz6ji2rnpk0b9jqnp86w0w0z8sb48giyc1gzcy1ra9yh" - else if version == "6.8.3-25.5" then "0a7ys9qinc0fjyka03cx9rv0pm7wnvslk234zv5vrphkrj52s1cb" - else throw "unsupported version ${version} for plugin ${pluginName}"; + search-guard = + let + majorVersion = lib.head (builtins.splitVersion esVersion); + in + esPlugin rec { + pluginName = "search-guard"; + version = + # https://docs.search-guard.com/latest/search-guard-versions + if esVersion == "7.5.1" then "${esVersion}-38.0.0" + else if esVersion == "6.8.3" then "${esVersion}-25.5" + else throw "unsupported version ${esVersion} for plugin ${pluginName}"; + src = fetchurl { + url = "mirror://maven/com/floragunn/${pluginName}-${majorVersion}/${version}/${pluginName}-${majorVersion}-${version}.zip"; + sha256 = + if version == "7.5.1-38.0.0" then "1a1wp9wrmz6ji2rnpk0b9jqnp86w0w0z8sb48giyc1gzcy1ra9yh" + else if version == "6.8.3-25.5" then "0a7ys9qinc0fjyka03cx9rv0pm7wnvslk234zv5vrphkrj52s1cb" + else throw "unsupported version ${version} for plugin ${pluginName}"; + }; + meta = with lib; { + homepage = "https://search-guard.com"; + description = "Elasticsearch plugin that offers encryption, authentication, and authorisation. "; + license = licenses.asl20; + }; }; - meta = with lib; { - homepage = "https://search-guard.com"; - description = "Elasticsearch plugin that offers encryption, authentication, and authorisation. "; - license = licenses.asl20; - }; - }; }