Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 ballerina, 3 lib, 4 writeText, 5 runCommand, 6 makeWrapper, 7 fetchzip, 8 stdenv, 9 openjdk, 10}: 11let 12 version = "2201.10.3"; 13 codeName = "swan-lake"; 14in 15stdenv.mkDerivation { 16 pname = "ballerina"; 17 inherit version; 18 19 src = fetchzip { 20 url = "https://dist.ballerina.io/downloads/${version}/ballerina-${version}-${codeName}.zip"; 21 hash = "sha256-JVwxWRiOQaUZBkvxoLhKvktyQYnBtbCBZXZa6g6hoRQ="; 22 }; 23 24 nativeBuildInputs = [ makeWrapper ]; 25 26 installPhase = '' 27 runHook preInstall 28 cp -rv distributions/ballerina-${version} $out 29 runHook postInstall 30 ''; 31 preFixup = '' 32 wrapProgram $out/bin/bal --set JAVA_HOME ${openjdk} 33 ''; 34 35 passthru.tests.smokeTest = 36 let 37 helloWorld = writeText "hello-world.bal" '' 38 import ballerina/io; 39 public function main() { 40 io:println("Hello, World!"); 41 } 42 ''; 43 in 44 runCommand "ballerina-${version}-smoketest" { } '' 45 ${ballerina}/bin/bal run ${helloWorld} >$out 46 read result <$out 47 [[ $result = "Hello, World!" ]] 48 ''; 49 50 meta = with lib; { 51 description = "Open-source programming language for the cloud"; 52 mainProgram = "bal"; 53 license = licenses.asl20; 54 platforms = openjdk.meta.platforms; 55 maintainers = with maintainers; [ eigengrau ]; 56 sourceProvenance = with sourceTypes; [ binaryBytecode ]; 57 }; 58}