From 1673f3d4585a15a3ec9b6a97da70b7097fc9146c Mon Sep 17 00:00:00 2001 From: volth Date: Wed, 18 Sep 2019 10:36:16 +0000 Subject: [PATCH] ammonite: add scala-2.13 version --- pkgs/development/tools/ammonite/default.nix | 29 +++++++++++---------- pkgs/top-level/all-packages.nix | 5 +++- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/pkgs/development/tools/ammonite/default.nix b/pkgs/development/tools/ammonite/default.nix index ff630242c933..d44a6666ee9f 100644 --- a/pkgs/development/tools/ammonite/default.nix +++ b/pkgs/development/tools/ammonite/default.nix @@ -1,30 +1,27 @@ -{ stdenv, lib, fetchurl, makeWrapper, jre, gnused +{ stdenv, fetchurl, jre , disableRemoteLogging ? true }: with stdenv.lib; + +let +common = { scalaVersion, sha256 }: stdenv.mkDerivation rec { pname = "ammonite"; version = "1.7.1"; - scalaVersion = "2.12"; src = fetchurl { url = "https://github.com/lihaoyi/Ammonite/releases/download/${version}/${scalaVersion}-${version}"; - sha256 = "0isg9flnzc2ldbx6q0lg0xyg9lnvqkd8qhgfln8p1hbzdq0n6jd0"; + inherit sha256; }; - propagatedBuildInputs = [ jre ] ; - buildInputs = [ makeWrapper gnused ] ; - phases = "installPhase"; installPhase = '' - mkdir -p $out/bin - cp ${src} $out/bin/amm - chmod +x $out/bin/amm - ${gnused}/bin/sed -i '0,/java/{s|java|${jre}/bin/java|}' $out/bin/amm + install -Dm755 ${src} $out/bin/amm + sed -i '0,/java/{s|java|${jre}/bin/java|}' $out/bin/amm '' + 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 = { @@ -36,8 +33,12 @@ stdenv.mkDerivation rec { that may be familiar to people coming from IDEs or other REPLs such as IPython or Zsh. ''; homepage = http://www.lihaoyi.com/Ammonite/; - license = lib.licenses.mit; - platforms = lib.platforms.all; - maintainers = [ lib.maintainers.nequissimus ]; + license = licenses.mit; + platforms = platforms.all; + maintainers = [ maintainers.nequissimus ]; }; +}; +in { + ammonite_2_12 = common { scalaVersion = "2.12"; sha256 = "0isg9flnzc2ldbx6q0lg0xyg9lnvqkd8qhgfln8p1hbzdq0n6jd0"; }; + ammonite_2_13 = common { scalaVersion = "2.13"; sha256 = "01dyc6bilhcr1mwrpmhjc8nhzfqgjh44bx36gd3gk9mkvlbys5mp"; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b3b38355671f..b521af8e7824 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -576,7 +576,10 @@ in 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 {};