1{
2 lib,
3 stdenv,
4 fetchurl,
5 makeWrapper,
6 jre,
7 ncurses,
8}:
9
10stdenv.mkDerivation (finalAttrs: {
11 version = "3.3.6";
12 pname = "scala-bare";
13
14 src = fetchurl {
15 url = "https://github.com/scala/scala3/releases/download/${finalAttrs.version}/scala3-${finalAttrs.version}.tar.gz";
16 hash = "sha256-cmdSQkDuKJl2/tG4vAjABF1dKQ0/ruB8a3E3pCUrW5c=";
17 };
18
19 propagatedBuildInputs = [
20 jre
21 ncurses.dev
22 ];
23 nativeBuildInputs = [ makeWrapper ];
24
25 installPhase = ''
26 mkdir -p $out
27 mv * $out
28 '';
29
30 # Use preFixup instead of fixupPhase
31 # because we want the default fixupPhase as well
32 preFixup = ''
33 bin_files=$(find $out/bin -type f ! -name "*common*" ! -name "scala-cli.jar")
34 for f in $bin_files ; do
35 wrapProgram $f --set JAVA_HOME ${jre} --prefix PATH : '${ncurses.dev}/bin'
36 done
37 '';
38
39 meta = with lib; {
40 description = "Scala 3 compiler, also known as Dotty";
41 homepage = "https://scala-lang.org/";
42 license = licenses.asl20;
43 platforms = platforms.all;
44 mainProgram = "scala";
45 maintainers = with maintainers; [
46 virusdave
47 kashw2
48 natsukagami
49 hamzaremmal
50 dottybot
51 ];
52 };
53})