2021-01-15 22:18:51 +00:00
|
|
|
{ stdenv, lib, fetchzip, jdk, makeWrapper, coreutils, curl }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "0.117.1";
|
2021-01-15 22:18:51 +00:00
|
|
|
pname = "jbang";
|
|
|
|
|
|
|
|
src = fetchzip {
|
|
|
|
url = "https://github.com/jbangdev/jbang/releases/download/v${version}/${pname}-${version}.tar";
|
2024-07-27 06:49:29 +00:00
|
|
|
sha256 = "sha256-LQ9xXTutKhAnAt51mglP/zc7k1v2X/QLwEY31M8SmzM=";
|
2021-01-15 22:18:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
rm bin/jbang.{cmd,ps1}
|
|
|
|
cp -r . $out
|
|
|
|
wrapProgram $out/bin/jbang \
|
|
|
|
--set JAVA_HOME ${jdk} \
|
2024-06-20 14:57:18 +00:00
|
|
|
--set PATH ${lib.makeBinPath [ (placeholder "out") coreutils jdk curl ]}
|
2021-01-15 22:18:51 +00:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
installCheckPhase = ''
|
|
|
|
$out/bin/jbang --version 2>&1 | grep -q "${version}"
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2021-01-15 22:18:51 +00:00
|
|
|
description = "Run java as scripts anywhere";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "jbang";
|
2021-01-15 22:18:51 +00:00
|
|
|
longDescription = ''
|
|
|
|
jbang uses the java language to build scripts similar to groovy scripts. Dependencies are automatically
|
|
|
|
downloaded and the java code runs.
|
|
|
|
'';
|
2023-04-12 12:48:02 +00:00
|
|
|
homepage = "https://www.jbang.dev";
|
2021-01-15 22:18:51 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ moaxcp ];
|
|
|
|
};
|
|
|
|
}
|