lol
1{ stdenv, lib, fetchzip, jdk, makeWrapper, coreutils, curl }:
2
3stdenv.mkDerivation rec {
4 version = "0.97.0";
5 pname = "jbang";
6
7 src = fetchzip {
8 url = "https://github.com/jbangdev/jbang/releases/download/v${version}/${pname}-${version}.tar";
9 sha256 = "sha256-36yDwNHnDY/wA/juD2e8hf3Xm22aWcNy3SqAhN8FCo8=";
10 };
11
12 nativeBuildInputs = [ makeWrapper ];
13
14 installPhase = ''
15 runHook preInstall
16 rm bin/jbang.{cmd,ps1}
17 cp -r . $out
18 wrapProgram $out/bin/jbang \
19 --set JAVA_HOME ${jdk} \
20 --set PATH ${lib.makeBinPath [ coreutils jdk curl ]}
21 runHook postInstall
22 '';
23
24 installCheckPhase = ''
25 $out/bin/jbang --version 2>&1 | grep -q "${version}"
26 '';
27
28 meta = with lib; {
29 description = "Run java as scripts anywhere";
30 longDescription = ''
31 jbang uses the java language to build scripts similar to groovy scripts. Dependencies are automatically
32 downloaded and the java code runs.
33 '';
34 homepage = "https://https://www.jbang.dev/";
35 license = licenses.mit;
36 platforms = platforms.all;
37 maintainers = with maintainers; [ moaxcp ];
38 };
39}