Merge pull request #256498 from rtimush/scala-update

scala-update: init at 0.2.2
This commit is contained in:
Weijia Wang 2023-10-19 01:55:04 +02:00 committed by GitHub
commit 1ae1ab8d01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 0 deletions

View File

@ -15226,6 +15226,12 @@
githubId = 47790121;
name = "Ryan Burns";
};
rtimush = {
email = "rtimush@gmail.com";
github = "rtimush";
githubId = 831307;
name = "Roman Timushev";
};
rtreffer = {
email = "treffer+nixos@measite.de";
github = "rtreffer";

View File

@ -0,0 +1,47 @@
{ lib, stdenv, coursier, buildGraalvmNativeImage }:
let
baseName = "scala-update";
version = "0.2.2";
deps = stdenv.mkDerivation {
name = "${baseName}-deps-${version}";
buildCommand = ''
export COURSIER_CACHE=$(pwd)
${coursier}/bin/cs fetch io.github.kitlangton:scala-update_2.13:${version} > deps
mkdir -p $out/share/java
cp $(< deps) $out/share/java/
'';
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = "kNnFzzHn+rFq4taqRYjBYaDax0MHW+vIoSFVN3wxA8M=";
};
in buildGraalvmNativeImage {
pname = baseName;
inherit version;
buildInputs = [ deps ];
src = "${deps}/share/java/${baseName}_2.13-${version}.jar";
extraNativeImageBuildArgs =
[ "--no-fallback" "--enable-url-protocols=https" "update.Main" ];
buildPhase = ''
runHook preBuild
native-image ''${nativeImageBuildArgs[@]} -cp $(JARS=("${deps}/share/java"/*.jar); IFS=:; echo "''${JARS[*]}")
runHook postBuild
'';
installCheckPhase = ''
$out/bin/${baseName} --version | grep -q "${version}"
'';
meta = with lib; {
description = "Update your Scala dependencies interactively";
homepage = "https://github.com/kitlangton/scala-update";
license = licenses.asl20;
maintainers = [ maintainers.rtimush ];
};
}