nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 jre,
6 autoPatchelfHook,
7 zlib,
8 ncurses,
9}:
10
11stdenv.mkDerivation (finalAttrs: {
12 pname = "sbt";
13 version = "1.12.0";
14
15 src = fetchurl {
16 url = "https://github.com/sbt/sbt/releases/download/v${finalAttrs.version}/sbt-${finalAttrs.version}.tgz";
17 hash = "sha256-5K3j9L2+HnRFvprPAssbNXS+tGA2LhcofiRrfq+buVI=";
18 };
19
20 postPatch = ''
21 echo -java-home ${jre.home} >>conf/sbtopts
22 '';
23
24 nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
25
26 buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
27 stdenv.cc.cc # libstdc++.so.6
28 zlib
29 ];
30
31 propagatedBuildInputs = [
32 # for infocmp
33 ncurses
34 ];
35
36 installPhase = ''
37 runHook preInstall
38
39 mkdir -p $out/share/sbt $out/bin
40 cp -ra . $out/share/sbt
41 ln -sT ../share/sbt/bin/sbt $out/bin/sbt
42 ln -sT ../share/sbt/bin/sbtn-${
43 if (stdenv.hostPlatform.isDarwin) then
44 "universal-apple-darwin"
45 else if (stdenv.hostPlatform.isAarch64) then
46 "aarch64-pc-linux"
47 else
48 "x86_64-pc-linux"
49 } $out/bin/sbtn
50
51 runHook postInstall
52 '';
53
54 meta = {
55 homepage = "https://www.scala-sbt.org/";
56 license = lib.licenses.bsd3;
57 sourceProvenance = with lib.sourceTypes; [
58 binaryBytecode
59 binaryNativeCode
60 ];
61 description = "Build tool for Scala, Java and more";
62 maintainers = with lib.maintainers; [
63 kashw2
64 ];
65 platforms = lib.platforms.unix;
66 };
67})