Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ballerina: init at 2201.1.0 #181319

Merged
merged 3 commits into from
Aug 19, 2022
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
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3744,6 +3744,12 @@
githubId = 537775;
name = "Emery Hemingway";
};
eigengrau = {
email = "seb@schattenkopie.de";
name = "Sebastian Reuße";
github = "eigengrau";
githubId = 4939947;
};
eikek = {
email = "eike.kettner@posteo.de";
github = "eikek";
Expand Down
45 changes: 45 additions & 0 deletions pkgs/development/compilers/ballerina/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{ ballerina, lib, writeText, runCommand, makeWrapper, fetchzip, stdenv, openjdk }:
let
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This let statement can be ommited by just using stdenv.mkDerivation rec.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What shall we do about codeName? Since we need a let block for codeName anyway, I figured it would be more convenient for future updates to also put the SHA256 and the version there, seeing that these will all change for the same reason in the future. WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe append it to version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won’t help us, since the URL contains both version in isolation and version+codename. Is there anything particularly prohibitive about binding variables? We could hard-code the code-name in the URL, but since this is likely to change in conjunction with the version in the future, it seems preferable to name them explicitly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we resolve this one?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

version = "2201.1.0";
codeName = "swan-lake";
in stdenv.mkDerivation {
pname = "ballerina";
inherit version;

src = fetchzip {
url = "https://dist.ballerina.io/downloads/${version}/ballerina-${version}-${codeName}.zip";
sha256 = "sha256-WZ6CvgnES1indYeMSuC3odDqwR2J27k+D8RktvHsELs=";
};

nativeBuildInputs = [ makeWrapper ];

installPhase = ''
runHook preInstall
cp -rv distributions/ballerina-${version} $out
runHook postInstall
'';
preFixup = ''
wrapProgram $out/bin/bal --set JAVA_HOME ${openjdk}/lib/openjdk
'';

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; {
description = "An open-source programming language for the cloud";
license = licenses.asl20;
platforms = openjdk.meta.platforms;
maintainers = with maintainers; [ eigengrau ];
sourceProvenance = with sourceTypes; [ binaryBytecode ];
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12810,6 +12810,8 @@ with pkgs;

avra = callPackage ../development/compilers/avra { };

ballerina = callPackage ../development/compilers/ballerina { };

beekeeper-studio = callPackage ../development/tools/database/beekeeper-studio { };

bigloo = callPackage ../development/compilers/bigloo { };
Expand Down