1 { lib, stdenv, fetchurl, jre, writeScript, common-updater-scripts, git, nixfmt-classic
2 , nix, coreutils, gnused, disableRemoteLogging ? true }:
5 repo = "git@github.com:lihaoyi/Ammonite.git";
7 common = { scalaVersion, sha256 }:
8 stdenv.mkDerivation rec {
14 "https://github.com/lihaoyi/Ammonite/releases/download/${version}/${scalaVersion}-${version}";
21 install -Dm755 $src $out/bin/amm
22 sed -i '0,/java/{s|java|${jre}/bin/java|}' $out/bin/amm
23 '' + lib.optionalString (disableRemoteLogging) ''
24 sed -i "0,/ammonite.Main/{s|ammonite.Main'|ammonite.Main' --no-remote-logging|}" $out/bin/amm
25 sed -i '1i #!/bin/sh' $out/bin/amm
30 updateScript = writeScript "update.sh" ''
35 common-updater-scripts
43 oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion ${pname}" | tr -d '"')"
44 latestTag="$(git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags ${repo} '*.*.*' | tail --lines=1 | cut --delimiter='/' --fields=3)"
45 if [ "$oldVersion" != "$latestTag" ]; then
46 nixpkgs="$(git rev-parse --show-toplevel)"
47 default_nix="$nixpkgs/pkgs/development/tools/ammonite/default.nix"
48 update-source-version ${pname}_2_12 "$latestTag" --version-key=version --print-changes
49 sed -i "s|$latestTag|$oldVersion|g" "$default_nix"
50 update-source-version ${pname}_2_13 "$latestTag" --version-key=version --print-changes
53 echo "${pname} is already up-to-date"
58 doInstallCheck = true;
59 installCheckPhase = ''
60 runHook preInstallCheck
62 $out/bin/amm -h "$PWD" -c 'val foo = 21; println(foo * 2)' | grep 42
64 runHook postInstallCheck
68 description = "Improved Scala REPL";
70 The Ammonite-REPL is an improved Scala REPL, re-implemented from first principles.
71 It is much more featureful than the default REPL and comes
72 with a lot of ergonomic improvements and configurability
73 that may be familiar to people coming from IDEs or other REPLs such as IPython or Zsh.
75 homepage = "https://github.com/com-lihaoyi/Ammonite";
76 license = licenses.mit;
77 maintainers = [ maintainers.nequissimus ];
79 platforms = platforms.all;
83 ammonite_2_12 = common {
84 scalaVersion = "2.12";
85 sha256 = "sha256-SlweOVHudknbInM4rfEPJ9bLd3Z/EImLhVLzeKfjfMQ=";
87 ammonite_2_13 = common {
88 scalaVersion = "2.13";
89 sha256 = "sha256-2BydXmF6AkWDdG5rbRLD2I/6z3w3UD0dCd5Tp+3lU7c=";