ammonite: add scala-2.13 version

This commit is contained in:
volth 2019-09-18 10:36:16 +00:00 committed by Tim Steinbach
parent b952f5dd1e
commit 1673f3d458
2 changed files with 19 additions and 15 deletions

View file

@ -1,30 +1,27 @@
{ stdenv, lib, fetchurl, makeWrapper, jre, gnused { stdenv, fetchurl, jre
, disableRemoteLogging ? true , disableRemoteLogging ? true
}: }:
with stdenv.lib; with stdenv.lib;
let
common = { scalaVersion, sha256 }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "ammonite"; pname = "ammonite";
version = "1.7.1"; version = "1.7.1";
scalaVersion = "2.12";
src = fetchurl { src = fetchurl {
url = "https://github.com/lihaoyi/Ammonite/releases/download/${version}/${scalaVersion}-${version}"; url = "https://github.com/lihaoyi/Ammonite/releases/download/${version}/${scalaVersion}-${version}";
sha256 = "0isg9flnzc2ldbx6q0lg0xyg9lnvqkd8qhgfln8p1hbzdq0n6jd0"; inherit sha256;
}; };
propagatedBuildInputs = [ jre ] ;
buildInputs = [ makeWrapper gnused ] ;
phases = "installPhase"; phases = "installPhase";
installPhase = '' installPhase = ''
mkdir -p $out/bin install -Dm755 ${src} $out/bin/amm
cp ${src} $out/bin/amm sed -i '0,/java/{s|java|${jre}/bin/java|}' $out/bin/amm
chmod +x $out/bin/amm
${gnused}/bin/sed -i '0,/java/{s|java|${jre}/bin/java|}' $out/bin/amm
'' + optionalString (disableRemoteLogging) '' '' + optionalString (disableRemoteLogging) ''
${gnused}/bin/sed -i '0,/ammonite.Main/{s|ammonite.Main|ammonite.Main --no-remote-logging|}' $out/bin/amm sed -i '0,/ammonite.Main/{s|ammonite.Main|ammonite.Main --no-remote-logging|}' $out/bin/amm
''; '';
meta = { meta = {
@ -36,8 +33,12 @@ stdenv.mkDerivation rec {
that may be familiar to people coming from IDEs or other REPLs such as IPython or Zsh. that may be familiar to people coming from IDEs or other REPLs such as IPython or Zsh.
''; '';
homepage = http://www.lihaoyi.com/Ammonite/; homepage = http://www.lihaoyi.com/Ammonite/;
license = lib.licenses.mit; license = licenses.mit;
platforms = lib.platforms.all; platforms = platforms.all;
maintainers = [ lib.maintainers.nequissimus ]; maintainers = [ maintainers.nequissimus ];
}; };
};
in {
ammonite_2_12 = common { scalaVersion = "2.12"; sha256 = "0isg9flnzc2ldbx6q0lg0xyg9lnvqkd8qhgfln8p1hbzdq0n6jd0"; };
ammonite_2_13 = common { scalaVersion = "2.13"; sha256 = "01dyc6bilhcr1mwrpmhjc8nhzfqgjh44bx36gd3gk9mkvlbys5mp"; };
} }

View file

@ -576,7 +576,10 @@ in
inherit (darwin.apple_sdk.frameworks) Security; inherit (darwin.apple_sdk.frameworks) Security;
}; };
ammonite = callPackage ../development/tools/ammonite {}; inherit (callPackages ../development/tools/ammonite {})
ammonite_2_12
ammonite_2_13;
ammonite = if scala == scala_2_12 then ammonite_2_12 else ammonite_2_13;
amp = callPackage ../applications/editors/amp {}; amp = callPackage ../applications/editors/amp {};