diff options
author | hlolli <hlolli@gmail.com> | 2020-12-05 18:56:46 +0100 |
---|---|---|
committer | hlolli <hlolli@gmail.com> | 2020-12-05 18:56:46 +0100 |
commit | 38ad37822813692de906c87f47801370ac1bcf1a (patch) | |
tree | 752d39207a97295075d73f3d86edb0b46cd3dade /pkgs/build-support/fetchmavenartifact | |
parent | 49c789703ccb70acebfaec4388f543a9ad63520a (diff) | |
download | nixpkgs-38ad37822813692de906c87f47801370ac1bcf1a.tar nixpkgs-38ad37822813692de906c87f47801370ac1bcf1a.tar.gz nixpkgs-38ad37822813692de906c87f47801370ac1bcf1a.tar.bz2 nixpkgs-38ad37822813692de906c87f47801370ac1bcf1a.tar.lz nixpkgs-38ad37822813692de906c87f47801370ac1bcf1a.tar.xz nixpkgs-38ad37822813692de906c87f47801370ac1bcf1a.tar.zst nixpkgs-38ad37822813692de906c87f47801370ac1bcf1a.zip |
add classifier as an argument
Diffstat (limited to 'pkgs/build-support/fetchmavenartifact')
-rw-r--r-- | pkgs/build-support/fetchmavenartifact/default.nix | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/pkgs/build-support/fetchmavenartifact/default.nix b/pkgs/build-support/fetchmavenartifact/default.nix index 2058600960a..42ad7603a8f 100644 --- a/pkgs/build-support/fetchmavenartifact/default.nix +++ b/pkgs/build-support/fetchmavenartifact/default.nix @@ -17,6 +17,8 @@ args@ artifactId , # Example: "4.3.6" version +, # Example: "jdk11" + classifier ? null , # List of maven repositories from where to fetch the artifact. # Example: [ http://oss.sonatype.org/content/repositories/public ]. repos ? defaultRepos @@ -36,28 +38,19 @@ assert (repos != []) || (url != "") || (urls != []); let - classifierSplit = - with stdenv.lib.strings; - splitString "$" artifactId; - artifactId_ = builtins.head classifierSplit; - classifier = - with stdenv.lib; - if builtins.length classifierSplit > 1 - then concatStrings ["-" (builtins.elemAt classifierSplit 1)] - else ""; name_ = with stdenv.lib; concatStrings [ (replaceChars ["."] ["_"] groupId) "_" - (replaceChars ["."] ["_"] artifactId_) "-" + (replaceChars ["."] ["_"] artifactId) "-" version ]; mkJarUrl = repoUrl: with stdenv.lib; concatStringsSep "/" [ (removeSuffix "/" repoUrl) (replaceChars ["."] ["/"] groupId) - artifactId_ + artifactId version - "${artifactId_}-${version}${classifier}.jar" + "${artifactId}-${version}-${optionalString (!isNull classifier) "-${classifier}"}.jar" ]; urls_ = if url != "" then [url] @@ -65,8 +58,8 @@ let else map mkJarUrl repos; jar = fetchurl ( - builtins.removeAttrs args ["groupId" "artifactId" "version" "repos" "url" ] - // { urls = urls_; name = "${name_}${classifier}.jar"; } + builtins.removeAttrs args ["groupId" "artifactId" "version" "classifier" "repos" "url" ] + // { urls = urls_; name = "${name_}.jar"; } ); in stdenv.mkDerivation { @@ -76,7 +69,7 @@ in # packages packages that mention this derivation in their buildInputs. installPhase = '' mkdir -p $out/share/java - ln -s ${jar} $out/share/java/${artifactId_}-${version}${classifier}.jar + ln -s ${jar} $out/share/java/${artifactId}-${version}.jar ''; # We also add a `jar` attribute that can be used to easily obtain the path # to the downloaded jar file. |