about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/extism-cli/default.nix
blob: a7999fcaeb49627ce6055ca3bd82f6441da01681 (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
{ lib, stdenvNoCC, fetchFromGitHub, python3, makeBinaryWrapper }:

stdenvNoCC.mkDerivation rec {
  pname = "extism-cli";
  version = "0.1.0";

  src = fetchFromGitHub {
    owner = "extism";
    repo = "cli";
    rev = "97935786166e82154266b82410028482800e6061";
    sha256 = "sha256-LRzXuZQt5h3exw43UXUwLVIhveYVFw/SQ2YtHI9ZnWc=";
  };

  buildInputs = [ python3 ];
  nativeBuildInputs = [ makeBinaryWrapper ];

  installPhase = ''
    runHook preInstall

    install -D -m 755 ./extism_cli/__init__.py "$out/bin/extism"

    # The extism cli tries by default to install a library and header into /usr/local which does not work on NixOS.
    # Pass a reasonable writable directory which can still be overwritten with another --prefix argument.
    wrapProgram "$out/bin/extism" \
      --add-flags '--prefix $HOME/.local'

    runHook postInstall
  '';

  meta = with lib; {
    description = "The extism CLI is used to manage Extism installations";
    homepage = "https://github.com/extism/cli";
    license = licenses.bsd3;
    maintainers = with maintainers; [ ];
    platforms = platforms.all;
  };
}