diff options
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/development/tools/build-managers/sbt')
-rw-r--r-- | infra/libkookie/nixpkgs/pkgs/development/tools/build-managers/sbt/default.nix | 69 | ||||
-rw-r--r-- | infra/libkookie/nixpkgs/pkgs/development/tools/build-managers/sbt/scala-native.nix | 18 |
2 files changed, 87 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/development/tools/build-managers/sbt/default.nix b/infra/libkookie/nixpkgs/pkgs/development/tools/build-managers/sbt/default.nix new file mode 100644 index 000000000000..ebcae9e63eea --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/tools/build-managers/sbt/default.nix @@ -0,0 +1,69 @@ +{ stdenv, fetchurl, jre, autoPatchelfHook, zlib, writeScript +, common-updater-scripts, git, nixfmt, nix, coreutils, gnused, nixosTests }: + +stdenv.mkDerivation rec { + pname = "sbt"; + version = "1.4.4"; + + src = fetchurl { + url = + "https://github.com/sbt/sbt/releases/download/v${version}/sbt-${version}.tgz"; + sha256 = "0ibdq8g2bcanc7gcjslia89khlccn11inqmkx3y7pbqrc63y1yif"; + }; + + patchPhase = '' + echo -java-home ${jre.home} >>conf/sbtopts + ''; + + nativeBuildInputs = stdenv.lib.optionals stdenv.isLinux [ autoPatchelfHook ]; + + buildInputs = stdenv.lib.optionals stdenv.isLinux [ zlib ]; + + installPhase = '' + 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-x86_64-${ + if (stdenv.isDarwin) then "apple-darwin" else "pc-linux" + } $out/bin/sbtn + ''; + + meta = with stdenv.lib; { + homepage = "https://www.scala-sbt.org/"; + license = licenses.bsd3; + description = "A build tool for Scala, Java and more"; + maintainers = with maintainers; [ nequissimus ]; + platforms = platforms.unix; + }; + + passthru = { + tests = { inherit (nixosTests) sbt; }; + + updateScript = writeScript "update.sh" '' + #!${stdenv.shell} + set -o errexit + PATH=${ + stdenv.lib.makeBinPath [ + common-updater-scripts + git + nixfmt + nix + coreutils + gnused + ] + } + + oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion sbt" | tr -d '"')" + latestTag="$(git -c 'versionsort.suffix=-' ls-remote --exit-code --refs --sort='version:refname' --tags git@github.com:sbt/sbt.git '*.*.*' | tail --lines=1 | cut --delimiter='/' --fields=3 | sed 's|^v||g')" + + if [ ! "$oldVersion" = "$latestTag" ]; then + update-source-version sbt "$latestTag" --version-key=version --print-changes + nixpkgs="$(git rev-parse --show-toplevel)" + default_nix="$nixpkgs/pkgs/development/tools/build-managers/sbt/default.nix" + nixfmt "$default_nix" + else + echo "sbt is already up-to-date" + fi + ''; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/development/tools/build-managers/sbt/scala-native.nix b/infra/libkookie/nixpkgs/pkgs/development/tools/build-managers/sbt/scala-native.nix new file mode 100644 index 000000000000..70038ed2d3a4 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/development/tools/build-managers/sbt/scala-native.nix @@ -0,0 +1,18 @@ +{ lib, sbt, makeWrapper, boehmgc, libunwind, re2, llvmPackages, zlib }: + +sbt.overrideDerivation(old: { + nativeBuildInputs = [ makeWrapper ]; + + version = "0.13.16"; + + sha256 = "033nvklclvbirhpsiy28d3ccmbm26zcs9vb7j8jndsc1ln09awi2"; + + postFixup = '' + wrapProgram $out/bin/sbt \ + --set CLANG_PATH "${llvmPackages.clang}/bin/clang" \ + --set CLANGPP_PATH "${llvmPackages.clang}/bin/clang" \ + --set CPATH "${lib.makeSearchPathOutput "dev" "include" [ re2 zlib boehmgc libunwind llvmPackages.libcxxabi llvmPackages.libcxx ]}/c++/v1" \ + --set LIBRARY_PATH "${lib.makeLibraryPath [ re2 zlib boehmgc libunwind llvmPackages.libcxxabi llvmPackages.libcxx ]}" \ + --set NIX_CFLAGS_LINK "-lc++abi -lc++" + ''; +}) |