nixpkgs/pkgs/development/tools/build-managers/leiningen/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

64 lines
1.8 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, makeWrapper
, coreutils, jdk, rlwrap, gnupg }:
stdenv.mkDerivation rec {
pname = "leiningen";
2023-01-07 14:05:07 +00:00
version = "2.10.0";
src = fetchurl {
2023-01-07 14:05:07 +00:00
url = "https://codeberg.org/leiningen/leiningen/raw/tag/${version}/bin/lein-pkg";
hash = "sha256-sXV86UHky/Fcv2Sbe09BM2XmEtqJLSKEHsFyg5G7Zq8=";
};
2023-01-07 14:05:07 +00:00
# Check https://codeberg.org/leiningen/leiningen/releases to get the URL for the new version
jarsrc = fetchurl {
2023-01-07 14:05:07 +00:00
url = "https://codeberg.org/attachments/43cebda5-a7c2-405b-b641-5143a00051b5";
hash = "sha256-0nKZutNAdawoZNC9BVn4NcbixHbAsKKDvL21dP2tuzQ=";
};
JARNAME = "${pname}-${version}-standalone.jar";
2019-06-19 15:45:34 +00:00
dontUnpack = true;
nativeBuildInputs = [ makeWrapper ];
2014-11-01 23:47: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
2016-08-23 10:38:24 +00:00
installPhase = ''
2023-01-07 14:05:07 +00:00
runHook preInstall
mkdir -p $out/bin $out/share
2016-08-23 10:38:24 +00:00
cp -v $src $out/bin/lein
cp -v $jarsrc $out/share/$JARNAME
2023-01-07 14:05:07 +00:00
runHook postInstall
2016-08-23 10:38:24 +00:00
'';
fixupPhase = ''
2023-01-07 14:05:07 +00:00
runHook preFixup
2016-08-23 10:38:24 +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"
2016-08-23 10:38:24 +00:00
wrapProgram $out/bin/lein \
--prefix PATH ":" "${lib.makeBinPath [ rlwrap coreutils ]}" \
--set LEIN_GPG ${gnupg}/bin/gpg \
2016-08-23 10:38:24 +00:00
--set JAVA_CMD ${jdk}/bin/java
2023-01-07 14:05:07 +00:00
runHook postFixup
2016-08-23 10:38:24 +00:00
'';
meta = {
homepage = "https://leiningen.org/";
description = "Project automation for Clojure";
sourceProvenance = with lib.sourceTypes; [ binaryBytecode ];
license = lib.licenses.epl10;
2023-01-07 14:05:07 +00:00
platforms = jdk.meta.platforms;
maintainers = with lib.maintainers; [ ];
2022-01-04 18:28:54 +00:00
mainProgram = "lein";
};
}