nixpkgs-suyu/pkgs/development/tools/jbang/default.nix

41 lines
1.1 KiB
Nix
Raw Normal View History

2021-01-10 04:45:01 +01:00
{ stdenv, lib, fetchzip, jdk, makeWrapper, coreutils, curl }:
stdenv.mkDerivation rec {
2021-04-10 14:26:23 +02:00
version = "0.70.0";
2021-01-10 04:45:01 +01:00
pname = "jbang";
src = fetchzip {
url = "https://github.com/jbangdev/jbang/releases/download/v${version}/${pname}-${version}.tar";
2021-04-10 14:26:23 +02:00
sha256 = "sha256-Fy7TvWJVRJI5fhfZzMuW+KBLaVLWKjk/I3Kx60Wazyo=";
2021-01-10 04:45:01 +01:00
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
rm bin/jbang.{cmd,ps1}
rmdir tmp
cp -r . $out
wrapProgram $out/bin/jbang \
--set JAVA_HOME ${jdk} \
--set PATH ${lib.makeBinPath [ coreutils jdk curl ]}
runHook postInstall
'';
installCheckPhase = ''
$out/bin/jbang --version 2>&1 | grep -q "${version}"
'';
meta = with lib; {
2021-01-10 04:45:01 +01:00
description = "Run java as scripts anywhere";
longDescription = ''
jbang uses the java language to build scripts similar to groovy scripts. Dependencies are automatically
downloaded and the java code runs.
'';
homepage = "https://https://www.jbang.dev/";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ moaxcp ];
};
}