2020-05-07 10:21:39 +00:00
|
|
|
{ stdenv, lib, fetchurl, writeShellScriptBin }:
|
2020-05-06 10:29:02 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
inherit (lib)
|
|
|
|
removeSuffix optionalString splitString concatMapStrings
|
2020-05-14 08:33:02 +00:00
|
|
|
attrByPath attrValues last makeOverridable importJSON;
|
2020-05-06 10:29:02 +00:00
|
|
|
|
|
|
|
# load dependencies
|
2020-05-14 08:33:02 +00:00
|
|
|
deps = importJSON ./deps.json;
|
2020-05-06 10:29:02 +00:00
|
|
|
|
|
|
|
# some .jar files have an `-aot` suffix that doesn't work for .pom files
|
|
|
|
getPOM = jarUrl: "${removeSuffix "-aot" jarUrl}.pom";
|
|
|
|
|
|
|
|
script = writeShellScriptBin "create-local-maven-repo" (''
|
|
|
|
mkdir -p $out
|
|
|
|
cd $out
|
|
|
|
'' +
|
|
|
|
(concatMapStrings (dep:
|
|
|
|
let
|
|
|
|
url = "${dep.host}/${dep.path}";
|
|
|
|
pom = {
|
|
|
|
sha1 = attrByPath [ "pom" "sha1" ] "" dep;
|
|
|
|
sha256 = attrByPath [ "pom" "sha256" ] "" dep;
|
|
|
|
};
|
|
|
|
pom-download = optionalString (pom.sha256 != "") (
|
|
|
|
fetchurl { url = getPOM url; inherit (pom) sha256; }
|
|
|
|
);
|
|
|
|
jar = {
|
|
|
|
sha1 = attrByPath [ "jar" "sha1" ] "" dep;
|
|
|
|
sha256 = attrByPath [ "jar" "sha256" ] "" dep;
|
|
|
|
};
|
|
|
|
jar-download = optionalString (jar.sha256 != "") (
|
2020-05-14 08:33:02 +00:00
|
|
|
fetchurl { url = "${url}.jar"; inherit (jar) sha256; }
|
2020-05-06 10:29:02 +00:00
|
|
|
);
|
|
|
|
fileName = last (splitString "/" dep.path);
|
|
|
|
directory = removeSuffix fileName dep.path;
|
|
|
|
in
|
|
|
|
''
|
|
|
|
mkdir -p ${directory}
|
|
|
|
|
|
|
|
${optionalString (pom-download != "") ''
|
|
|
|
ln -s "${pom-download}" "${getPOM dep.path}"
|
|
|
|
''}
|
|
|
|
${optionalString (pom.sha1 != "") ''
|
|
|
|
echo "${pom.sha1}" > "${getPOM dep.path}.sha1"
|
|
|
|
''}
|
|
|
|
${optionalString (jar-download != "") ''
|
2020-05-14 08:33:02 +00:00
|
|
|
ln -s "${jar-download}" "${dep.path}.jar"
|
2020-05-06 10:29:02 +00:00
|
|
|
''}
|
|
|
|
${optionalString (jar.sha1 != "") ''
|
2020-05-14 08:33:02 +00:00
|
|
|
echo "${jar.sha1}" > "${dep.path}.jar.sha1"
|
2020-05-06 10:29:02 +00:00
|
|
|
''}
|
|
|
|
'')
|
2020-05-14 08:33:02 +00:00
|
|
|
deps));
|
2020-05-06 10:29:02 +00:00
|
|
|
|
|
|
|
in makeOverridable stdenv.mkDerivation {
|
2022-07-17 12:37:46 +00:00
|
|
|
name = "status-mobile-clojure-deps";
|
2020-05-06 10:29:02 +00:00
|
|
|
phases = [ "buildPhase" ];
|
|
|
|
buildPhase = "${script}/bin/create-local-maven-repo";
|
|
|
|
}
|