nixpkgs/pkgs/by-name/jb/jbang/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
1.1 KiB
Nix
Raw Normal View History

2021-01-10 03:45:01 +00:00
{ stdenv, lib, fetchzip, jdk, makeWrapper, coreutils, curl }:
stdenv.mkDerivation rec {
2024-10-05 04:34:31 +00:00
version = "0.119.0";
2021-01-10 03:45:01 +00:00
pname = "jbang";
src = fetchzip {
url = "https://github.com/jbangdev/jbang/releases/download/v${version}/${pname}-${version}.tar";
2024-10-05 04:34:31 +00:00
sha256 = "sha256-ebwBRzgpYEomboY+hMok8KmOaNR4hRaPy7SxjHbLeYU=";
2021-01-10 03:45:01 +00:00
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
rm bin/jbang.{cmd,ps1}
cp -r . $out
wrapProgram $out/bin/jbang \
--set JAVA_HOME ${jdk} \
--set PATH ${lib.makeBinPath [ (placeholder "out") coreutils jdk curl ]}
2021-01-10 03:45:01 +00:00
runHook postInstall
'';
installCheckPhase = ''
$out/bin/jbang --version 2>&1 | grep -q "${version}"
'';
meta = with lib; {
2021-01-10 03:45:01 +00:00
description = "Run java as scripts anywhere";
mainProgram = "jbang";
2021-01-10 03:45:01 +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-11 03:50:29 +00:00
homepage = "https://www.jbang.dev";
2021-01-10 03:45:01 +00:00
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ moaxcp ];
};
}