nixpkgs/pkgs/development/tools/build-managers/leiningen/default.nix
Jörg Thalheim 887295fd2d
treewide: remove the-kenny from maintainers
@the-kenny did a good job in the past and is set as maintainer in many package,
however since 2017-2018 he stopped contributing. To create less confusion
in pull requests when people try to request his feedback, I removed him as
maintainer from all packages.
2020-05-09 10:28:57 +01:00

53 lines
1.6 KiB
Nix

{ stdenv, fetchurl, makeWrapper
, coreutils, jdk, rlwrap, gnupg }:
stdenv.mkDerivation rec {
pname = "leiningen";
version = "2.9.1";
src = fetchurl {
url = "https://raw.github.com/technomancy/leiningen/${version}/bin/lein-pkg";
sha256 = "1h0gpzpr7xk6hvmrrq41bcp2k9aai348baf8ad9bxvci01n4zb12";
};
jarsrc = fetchurl {
# NOTE: This is actually a .jar, Github has issues
url = "https://github.com/technomancy/leiningen/releases/download/${version}/${pname}-${version}-standalone.zip";
sha256 = "1y2mva5s2w2szzn1b9rhz0dvkffls4ravii677ybcf2w9wd86z7a";
};
JARNAME = "${pname}-${version}-standalone.jar";
dontUnpack = true;
buildInputs = [ makeWrapper ];
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 = ''
mkdir -p $out/bin $out/share
cp -v $src $out/bin/lein
cp -v $jarsrc $out/share/$JARNAME
'';
fixupPhase = ''
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 \
--prefix PATH ":" "${stdenv.lib.makeBinPath [ rlwrap coreutils ]}" \
--set LEIN_GPG ${gnupg}/bin/gpg \
--set JAVA_CMD ${jdk}/bin/java
'';
meta = {
homepage = "https://leiningen.org/";
description = "Project automation for Clojure";
license = stdenv.lib.licenses.epl10;
platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
};
}