about summary refs log tree commit diff
path: root/pkgs/development/tools/bbin/default.nix
blob: a5c165c77c7180aacbc8e660c2224fbff33705cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{ lib
, stdenvNoCC
, fetchFromGitHub
, gitUpdater
, makeWrapper
, babashka-unwrapped
}:

stdenvNoCC.mkDerivation rec {
  pname = "bbin";
  version = "0.2.4";

  src = fetchFromGitHub {
    owner = "babashka";
    repo = "bbin";
    rev = "v${version}";
    sha256 = "sha256-26uZqHSLi+qnilyPWt/2mCr1wyu1flxNd+jq9zbumrg=";
  };

  nativeBuildInputs = [ makeWrapper ];

  dontConfigure = true;
  dontBuild = true;

  installPhase = ''
    runHook preInstall

    install -D bbin $out/bin/bbin
    mkdir -p $out/share
    cp -r docs $out/share/docs
    wrapProgram $out/bin/bbin \
      --prefix PATH : "${lib.makeBinPath [ babashka-unwrapped babashka-unwrapped.graalvmDrv ]}"

    runHook postInstall
  '';

  passthru = {
    updateScript = gitUpdater { rev-prefix = "v"; };
  };

  meta = with lib; {
    homepage = "https://github.com/babashka/bbin";
    description = "Install any Babashka script or project with one command";
    mainProgram = "bbin";
    license = licenses.mit;
    inherit (babashka-unwrapped.meta) platforms;
    maintainers = with maintainers; [ sohalt ];
  };
}