2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, makeWrapper
|
2020-04-24 23:36:52 +00:00
|
|
|
, coreutils, jdk, rlwrap, gnupg }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "leiningen";
|
2023-01-11 07:51:40 +00:00
|
|
|
version = "2.10.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2023-01-11 07:51:40 +00:00
|
|
|
url = "https://codeberg.org/leiningen/leiningen/raw/tag/${version}/bin/lein-pkg";
|
|
|
|
hash = "sha256-sXV86UHky/Fcv2Sbe09BM2XmEtqJLSKEHsFyg5G7Zq8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
# Check https://codeberg.org/leiningen/leiningen/releases to get the URL for the new version
|
2020-04-24 23:36:52 +00:00
|
|
|
jarsrc = fetchurl {
|
2023-01-11 07:51:40 +00:00
|
|
|
url = "https://codeberg.org/attachments/43cebda5-a7c2-405b-b641-5143a00051b5";
|
|
|
|
hash = "sha256-0nKZutNAdawoZNC9BVn4NcbixHbAsKKDvL21dP2tuzQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
JARNAME = "${pname}-${version}-standalone.jar";
|
|
|
|
|
|
|
|
dontUnpack = true;
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [ jdk ];
|
|
|
|
|
|
|
|
# the jar is not in share/java, because it's a standalone jar and should
|
|
|
|
# never be picked up by set-java-classpath.sh
|
|
|
|
|
|
|
|
installPhase = ''
|
2023-01-11 07:51:40 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
mkdir -p $out/bin $out/share
|
|
|
|
cp -v $src $out/bin/lein
|
|
|
|
cp -v $jarsrc $out/share/$JARNAME
|
2023-01-11 07:51:40 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
fixupPhase = ''
|
2023-01-11 07:51:40 +00:00
|
|
|
runHook preFixup
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
chmod +x $out/bin/lein
|
|
|
|
patchShebangs $out/bin/lein
|
|
|
|
substituteInPlace $out/bin/lein \
|
|
|
|
--replace 'LEIN_JAR=/usr/share/java/leiningen-$LEIN_VERSION-standalone.jar' "LEIN_JAR=$out/share/$JARNAME"
|
|
|
|
wrapProgram $out/bin/lein \
|
2021-02-05 17:12:51 +00:00
|
|
|
--prefix PATH ":" "${lib.makeBinPath [ rlwrap coreutils ]}" \
|
2020-04-24 23:36:52 +00:00
|
|
|
--set LEIN_GPG ${gnupg}/bin/gpg \
|
|
|
|
--set JAVA_CMD ${jdk}/bin/java
|
2023-01-11 07:51:40 +00:00
|
|
|
|
|
|
|
runHook postFixup
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "https://leiningen.org/";
|
|
|
|
description = "Project automation for Clojure";
|
2022-06-16 17:23:12 +00:00
|
|
|
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
|
2021-02-05 17:12:51 +00:00
|
|
|
license = lib.licenses.epl10;
|
2023-01-11 07:51:40 +00:00
|
|
|
platforms = jdk.meta.platforms;
|
|
|
|
maintainers = with lib.maintainers; [ ];
|
2022-01-07 04:07:37 +00:00
|
|
|
mainProgram = "lein";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|