1{ lib, stdenvNoCC, fetchFromGitHub, python3, makeBinaryWrapper }:
2
3stdenvNoCC.mkDerivation rec {
4 pname = "extism-cli";
5 version = "0.1.0";
6
7 src = fetchFromGitHub {
8 owner = "extism";
9 repo = "cli";
10 rev = "97935786166e82154266b82410028482800e6061";
11 sha256 = "sha256-LRzXuZQt5h3exw43UXUwLVIhveYVFw/SQ2YtHI9ZnWc=";
12 };
13
14 buildInputs = [ python3 ];
15 nativeBuildInputs = [ makeBinaryWrapper ];
16
17 installPhase = ''
18 runHook preInstall
19
20 install -D -m 755 ./extism_cli/__init__.py "$out/bin/extism"
21
22 # The extism cli tries by default to install a library and header into /usr/local which does not work on NixOS.
23 # Pass a reasonable writable directory which can still be overwritten with another --prefix argument.
24 wrapProgram "$out/bin/extism" \
25 --add-flags '--prefix $HOME/.local'
26
27 runHook postInstall
28 '';
29
30 meta = with lib; {
31 description = "The extism CLI is used to manage Extism installations";
32 homepage = "https://github.com/extism/cli";
33 license = licenses.bsd3;
34 maintainers = with maintainers; [ borlaag ];
35 platforms = platforms.all;
36 };
37}