2022-08-21 13:32:41 +00:00
|
|
|
{ ballerina, lib, writeText, runCommand, makeWrapper, fetchzip, stdenv, openjdk }:
|
|
|
|
let
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "2201.9.2";
|
2022-08-21 13:32:41 +00:00
|
|
|
codeName = "swan-lake";
|
|
|
|
in stdenv.mkDerivation {
|
|
|
|
pname = "ballerina";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchzip {
|
|
|
|
url = "https://dist.ballerina.io/downloads/${version}/ballerina-${version}-${codeName}.zip";
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-J73fai5mPPNHk/wux4nhX3KsalxWER8nMqWovWgm6WA=";
|
2022-08-21 13:32:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
cp -rv distributions/ballerina-${version} $out
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
preFixup = ''
|
2023-03-24 00:07:29 +00:00
|
|
|
wrapProgram $out/bin/bal --set JAVA_HOME ${openjdk}
|
2022-08-21 13:32:41 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.tests.smokeTest = let
|
|
|
|
helloWorld = writeText "hello-world.bal" ''
|
|
|
|
import ballerina/io;
|
|
|
|
public function main() {
|
|
|
|
io:println("Hello, World!");
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
in runCommand "ballerina-${version}-smoketest" { } ''
|
|
|
|
${ballerina}/bin/bal run ${helloWorld} >$out
|
|
|
|
read result <$out
|
|
|
|
[[ $result = "Hello, World!" ]]
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Open-source programming language for the cloud";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "bal";
|
2022-08-21 13:32:41 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = openjdk.meta.platforms;
|
|
|
|
maintainers = with maintainers; [ eigengrau ];
|
|
|
|
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
|
|
|
};
|
|
|
|
}
|