forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / by-name / jb / jbang / package.nix
blob085612b67a3448bf801d3a54d4461319975549d4
1 { stdenv, lib, fetchzip, jdk, makeWrapper, coreutils, curl }:
3 stdenv.mkDerivation rec {
4   version = "0.119.0";
5   pname = "jbang";
7   src = fetchzip {
8     url = "https://github.com/jbangdev/jbang/releases/download/v${version}/${pname}-${version}.tar";
9     sha256 = "sha256-ebwBRzgpYEomboY+hMok8KmOaNR4hRaPy7SxjHbLeYU=";
10   };
12   nativeBuildInputs = [ makeWrapper ];
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 [ (placeholder "out") coreutils jdk curl ]}
21     runHook postInstall
22   '';
24   installCheckPhase = ''
25     $out/bin/jbang --version 2>&1 | grep -q "${version}"
26   '';
28   meta = with lib; {
29     description = "Run java as scripts anywhere";
30     mainProgram = "jbang";
31     longDescription = ''
32       jbang uses the java language to build scripts similar to groovy scripts. Dependencies are automatically
33       downloaded and the java code runs.
34     '';
35     homepage = "https://www.jbang.dev";
36     license = licenses.mit;
37     platforms = platforms.all;
38     maintainers = with maintainers; [ moaxcp ];
39   };