scala: Make overridable
This commit is contained in:
parent
5e66517178
commit
7f50f98298
@ -1,117 +1,117 @@
|
|||||||
{ stdenv, lib, fetchurl, makeWrapper, jre, gnugrep, coreutils, nixosTests
|
{ stdenv, lib, fetchurl, makeWrapper, jre, gnugrep, coreutils, nixosTests
|
||||||
, writeScript, common-updater-scripts, git, gnused, nix, nixfmt }:
|
, writeScript, common-updater-scripts, git, gnused, nix, nixfmt, majorVersion }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
repo = "git@github.com:scala/scala.git";
|
repo = "git@github.com:scala/scala.git";
|
||||||
|
|
||||||
common = { version, sha256, tests, pname }:
|
versionMap = {
|
||||||
stdenv.mkDerivation rec {
|
"2.10" = {
|
||||||
inherit version;
|
version = "2.10.7";
|
||||||
|
sha256 = "koMRmRb2u3cU4HaihAzPItWIGbNVIo7RWRrm92kp8RE=";
|
||||||
name = "scala-${version}";
|
tests = [ nixosTests.scala.scala_2_10 ];
|
||||||
|
pname = "scala_2_10";
|
||||||
src = fetchurl {
|
};
|
||||||
inherit sha256;
|
|
||||||
url = "https://www.scala-lang.org/files/archive/scala-${version}.tgz";
|
"2.11" = {
|
||||||
};
|
version = "2.11.12";
|
||||||
|
sha256 = "sR19M2mcpPYLw7K2hY/ZU+PeK4UiyUP0zaS2dDFhlqg=";
|
||||||
propagatedBuildInputs = [ jre ];
|
tests = [ nixosTests.scala.scala_2_11 ];
|
||||||
buildInputs = [ makeWrapper ];
|
pname = "scala_2_11";
|
||||||
|
};
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out
|
"2.12" = {
|
||||||
rm bin/*.bat
|
version = "2.12.12";
|
||||||
mv * $out
|
sha256 = "NSDNHzye//YrrudfMuUtHl3BIL4szzQGSeRw5I9Sfis=";
|
||||||
|
tests = [ nixosTests.scala.scala_2_12 ];
|
||||||
# put docs in correct subdirectory
|
pname = "scala_2_12";
|
||||||
mkdir -p $out/share/doc
|
};
|
||||||
mv $out/doc $out/share/doc/${name}
|
|
||||||
mv $out/man $out/share/man
|
"2.13" = {
|
||||||
|
version = "2.13.4";
|
||||||
for p in $(ls $out/bin/) ; do
|
sha256 = "1alcnzmxga00nsvgy8yky91zw5b4q0xg2697vrrdgjlglpxiqwdw";
|
||||||
wrapProgram $out/bin/$p \
|
tests = [ nixosTests.scala.scala_2_13 ];
|
||||||
--prefix PATH ":" ${coreutils}/bin \
|
pname = "scala_2_13";
|
||||||
--prefix PATH ":" ${gnugrep}/bin \
|
|
||||||
--prefix PATH ":" ${jre}/bin \
|
|
||||||
--set JAVA_HOME ${jre}
|
|
||||||
done
|
|
||||||
'';
|
|
||||||
|
|
||||||
passthru = {
|
|
||||||
inherit tests;
|
|
||||||
|
|
||||||
updateScript = writeScript "update.sh" ''
|
|
||||||
#!${stdenv.shell}
|
|
||||||
set -o errexit
|
|
||||||
PATH=${
|
|
||||||
stdenv.lib.makeBinPath [
|
|
||||||
common-updater-scripts
|
|
||||||
coreutils
|
|
||||||
git
|
|
||||||
gnused
|
|
||||||
nix
|
|
||||||
nixfmt
|
|
||||||
]
|
|
||||||
}
|
|
||||||
versionSelect='v${versions.major version}.${versions.minor version}.*'
|
|
||||||
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion ${pname}" | tr -d '"')"
|
|
||||||
latestTag="$(git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags ${repo} "$versionSelect" | tail --lines=1 | cut --delimiter='/' --fields=3 | sed 's|^v||g')"
|
|
||||||
if [ "$oldVersion" != "$latestTag" ]; then
|
|
||||||
nixpkgs="$(git rev-parse --show-toplevel)"
|
|
||||||
default_nix="$nixpkgs/pkgs/development/compilers/scala/2.x.nix"
|
|
||||||
update-source-version ${pname} "$latestTag" --version-key=version --print-changes
|
|
||||||
nixfmt "$default_nix"
|
|
||||||
else
|
|
||||||
echo "${pname} is already up-to-date"
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
meta = {
|
|
||||||
description = "A general purpose programming language";
|
|
||||||
longDescription = ''
|
|
||||||
Scala is a general purpose programming language designed to express
|
|
||||||
common programming patterns in a concise, elegant, and type-safe way.
|
|
||||||
It smoothly integrates features of object-oriented and functional
|
|
||||||
languages, enabling Java and other programmers to be more productive.
|
|
||||||
Code sizes are typically reduced by a factor of two to three when
|
|
||||||
compared to an equivalent Java application.
|
|
||||||
'';
|
|
||||||
homepage = "https://www.scala-lang.org/";
|
|
||||||
license = licenses.bsd3;
|
|
||||||
platforms = platforms.all;
|
|
||||||
branch = versions.majorMinor version;
|
|
||||||
maintainers = [ maintainers.nequissimus ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
in {
|
|
||||||
scala_2_10 = common {
|
|
||||||
version = "2.10.7";
|
|
||||||
sha256 = "koMRmRb2u3cU4HaihAzPItWIGbNVIo7RWRrm92kp8RE=";
|
|
||||||
tests = [ nixosTests.scala.scala_2_10 ];
|
|
||||||
pname = "scala_2_10";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
scala_2_11 = common {
|
in with versionMap.${majorVersion};
|
||||||
version = "2.11.12";
|
|
||||||
sha256 = "sR19M2mcpPYLw7K2hY/ZU+PeK4UiyUP0zaS2dDFhlqg=";
|
stdenv.mkDerivation rec {
|
||||||
tests = [ nixosTests.scala.scala_2_11 ];
|
inherit version;
|
||||||
pname = "scala_2_11";
|
|
||||||
|
name = "scala-${version}";
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
inherit sha256;
|
||||||
|
url = "https://www.scala-lang.org/files/archive/scala-${version}.tgz";
|
||||||
};
|
};
|
||||||
|
|
||||||
scala_2_12 = common {
|
propagatedBuildInputs = [ jre ];
|
||||||
version = "2.12.12";
|
|
||||||
sha256 = "NSDNHzye//YrrudfMuUtHl3BIL4szzQGSeRw5I9Sfis=";
|
buildInputs = [ makeWrapper ];
|
||||||
tests = [ nixosTests.scala.scala_2_12 ];
|
|
||||||
pname = "scala_2_12";
|
installPhase = ''
|
||||||
|
mkdir -p $out
|
||||||
|
rm bin/*.bat
|
||||||
|
mv * $out
|
||||||
|
# put docs in correct subdirectory
|
||||||
|
mkdir -p $out/share/doc
|
||||||
|
mv $out/doc $out/share/doc/${name}
|
||||||
|
mv $out/man $out/share/man
|
||||||
|
for p in $(ls $out/bin/) ; do
|
||||||
|
wrapProgram $out/bin/$p \
|
||||||
|
--prefix PATH ":" ${coreutils}/bin \
|
||||||
|
--prefix PATH ":" ${gnugrep}/bin \
|
||||||
|
--prefix PATH ":" ${jre}/bin \
|
||||||
|
--set JAVA_HOME ${jre}
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
|
passthru = {
|
||||||
|
inherit tests;
|
||||||
|
updateScript = writeScript "update.sh" ''
|
||||||
|
#!${stdenv.shell}
|
||||||
|
set -o errexit
|
||||||
|
PATH=${
|
||||||
|
stdenv.lib.makeBinPath [
|
||||||
|
common-updater-scripts
|
||||||
|
coreutils
|
||||||
|
git
|
||||||
|
gnused
|
||||||
|
nix
|
||||||
|
nixfmt
|
||||||
|
]
|
||||||
|
}
|
||||||
|
versionSelect='v${versions.major version}.${versions.minor version}.*'
|
||||||
|
oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion ${pname}" | tr -d '"')"
|
||||||
|
latestTag="$(git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags ${repo} "$versionSelect" | tail --lines=1 | cut --delimiter='/' --fields=3 | sed 's|^v||g')"
|
||||||
|
if [ "$oldVersion" != "$latestTag" ]; then
|
||||||
|
nixpkgs="$(git rev-parse --show-toplevel)"
|
||||||
|
default_nix="$nixpkgs/pkgs/development/compilers/scala/2.x.nix"
|
||||||
|
update-source-version ${pname} "$latestTag" --version-key=version --print-changes
|
||||||
|
nixfmt "$default_nix"
|
||||||
|
else
|
||||||
|
echo "${pname} is already up-to-date"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
scala_2_13 = common {
|
meta = {
|
||||||
version = "2.13.4";
|
description = "A general purpose programming language";
|
||||||
sha256 = "1alcnzmxga00nsvgy8yky91zw5b4q0xg2697vrrdgjlglpxiqwdw";
|
longDescription = ''
|
||||||
tests = [ nixosTests.scala.scala_2_13 ];
|
Scala is a general purpose programming language designed to express
|
||||||
pname = "scala_2_13";
|
common programming patterns in a concise, elegant, and type-safe way.
|
||||||
|
It smoothly integrates features of object-oriented and functional
|
||||||
|
languages, enabling Java and other programmers to be more productive.
|
||||||
|
Code sizes are typically reduced by a factor of two to three when
|
||||||
|
compared to an equivalent Java application.
|
||||||
|
'';
|
||||||
|
homepage = "https://www.scala-lang.org/";
|
||||||
|
license = licenses.bsd3;
|
||||||
|
platforms = platforms.all;
|
||||||
|
branch = versions.majorMinor version;
|
||||||
|
maintainers = [ maintainers.nequissimus ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -10143,11 +10143,10 @@ in
|
|||||||
sbcl_2_0_9 = callPackage ../development/compilers/sbcl/2.0.9.nix {};
|
sbcl_2_0_9 = callPackage ../development/compilers/sbcl/2.0.9.nix {};
|
||||||
sbcl = callPackage ../development/compilers/sbcl {};
|
sbcl = callPackage ../development/compilers/sbcl {};
|
||||||
|
|
||||||
inherit (callPackage ../development/compilers/scala/2.x.nix { jre = jre8; })
|
scala_2_10 = callPackage ../development/compilers/scala/2.x.nix { majorVersion = "2.10"; jre = jdk8; };
|
||||||
scala_2_10
|
scala_2_11 = callPackage ../development/compilers/scala/2.x.nix { majorVersion = "2.11"; jre = jdk8; };
|
||||||
scala_2_11
|
scala_2_12 = callPackage ../development/compilers/scala/2.x.nix { majorVersion = "2.12"; jre = jdk8; };
|
||||||
scala_2_12
|
scala_2_13 = callPackage ../development/compilers/scala/2.x.nix { majorVersion = "2.13"; jre = jdk8; };
|
||||||
scala_2_13;
|
|
||||||
|
|
||||||
scala = scala_2_13;
|
scala = scala_2_13;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user