nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 58 lines 1.3 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchzip, 5 jdk, 6 makeWrapper, 7 coreutils, 8 curl, 9}: 10 11stdenv.mkDerivation rec { 12 version = "0.127.18"; 13 pname = "jbang"; 14 15 src = fetchzip { 16 url = "https://github.com/jbangdev/jbang/releases/download/v${version}/${pname}-${version}.tar"; 17 sha256 = "sha256-JH/IsQ2l2N6BG5svvGSdk4khMBAyM5tLL4l1uAY4nCY="; 18 }; 19 20 nativeBuildInputs = [ makeWrapper ]; 21 22 installPhase = '' 23 runHook preInstall 24 rm bin/jbang.{cmd,ps1} 25 cp -r . $out 26 wrapProgram $out/bin/jbang \ 27 --set JAVA_HOME ${jdk} \ 28 --set PATH ${ 29 lib.makeBinPath [ 30 (placeholder "out") 31 coreutils 32 jdk 33 curl 34 ] 35 } 36 runHook postInstall 37 ''; 38 39 installCheckPhase = '' 40 $out/bin/jbang --version 2>&1 | grep -q "${version}" 41 ''; 42 43 meta = with lib; { 44 description = "Run java as scripts anywhere"; 45 mainProgram = "jbang"; 46 longDescription = '' 47 jbang uses the java language to build scripts similar to groovy scripts. Dependencies are automatically 48 downloaded and the java code runs. 49 ''; 50 homepage = "https://www.jbang.dev"; 51 sourceProvenance = with lib.sourceTypes; [ 52 binaryBytecode 53 ]; 54 license = licenses.mit; 55 platforms = platforms.all; 56 maintainers = with maintainers; [ moaxcp ]; 57 }; 58}