Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,23 @@
typelevelShell.jdk.package = pkgs.jdk17_headless;
};
};

sbt1 = pkgs.callPackage ./pkgs/sbt1.nix { };
in
{
inherit devShells;
checks = devShells;
packages = {
inherit sbt1;
};
};
in
{
inherit typelevelShell;
overlays.default = devshell.overlays.default;
overlays.default = final: prev:
(devshell.overlays.default final prev) // {
sbt1 = self.packages.${prev.stdenv.hostPlatform.system}.sbt1;
};
templates = {
library = {
path = ./library;
Expand Down
2 changes: 1 addition & 1 deletion modules/typelevelShell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ in
commands = [
{ package = pkgs.metals.override { jre = cfg.jdk.metals.package; }; }
{ package = pkgs.scala-cli.override { jre = cfg.jdk.scala-cli.package; }; }
{ package = pkgs.sbt.override { jre = cfg.jdk.package; }; }
{ package = pkgs.sbt1.override { jre = cfg.jdk.package; }; }
];

devshell.motd =
Expand Down
69 changes: 69 additions & 0 deletions pkgs/sbt1.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: Copyright (c) 2003-2026 Eelco Dolstra and the Nixpkgs/NixOS contributors
# SPDX-FileContributor: https://github.com/nixos/nixpkgs/blob/d9507283e60f11ad9fcb53b734cbf59154fc3b01/pkgs/development/tools/build-managers/sbt/default.nix

{
lib,
stdenv,
fetchurl,
jre,
autoPatchelfHook,
zlib,
ncurses,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "sbt";
version = "1.13.0";

src = fetchurl {
url = "https://github.com/sbt/sbt/releases/download/v${finalAttrs.version}/sbt-${finalAttrs.version}.tgz";
hash = "sha256-BoBoBf/SYjJycyYhZ2btR5O1SfjB5v/u8uYQ23JFtpg=";
};

postPatch = ''
echo -java-home ${jre.home} >>conf/sbtopts
'';

nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];

buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
stdenv.cc.cc # libstdc++.so.6
zlib
];

propagatedBuildInputs = [
# for infocmp
ncurses
];

installPhase = ''
runHook preInstall

mkdir -p $out/share/sbt $out/bin
cp -ra . $out/share/sbt
ln -sT ../share/sbt/bin/sbt $out/bin/sbt
ln -sT ../share/sbt/bin/sbtn-${
if (stdenv.hostPlatform.isDarwin) then
"universal-apple-darwin"
else if (stdenv.hostPlatform.isAarch64) then
"aarch64-pc-linux"
else
"x86_64-pc-linux"
} $out/bin/sbtn

runHook postInstall
'';

meta = {
homepage = "https://www.scala-sbt.org/";
license = lib.licenses.bsd3;
sourceProvenance = with lib.sourceTypes; [
binaryBytecode
binaryNativeCode
];
description = "Build tool for Scala, Java and more";
platforms = lib.platforms.unix;
mainProgram = "sbt";
};
})