{
  buildGo126Module,
  fetchgit,
  lib,
  installShellFiles,
}:

buildGo126Module rec {
  pname = "abra";
  version = "0.13.0-beta";
  rev = "06a57ded025a43c80f94d4e65299add8a31830dc";

  src = fetchgit {
    url = "https://git.coopcloud.tech/toolshed/abra.git";
    tag = version;
    hash = "sha256-rgoK0TY0WLSQ39lPvVM80zW/qJF40VFBSxYDOaKXZQo=";
  };

  vendorHash = null;

  nativeBuildInputs = [
    installShellFiles
  ];

  env.CGO_ENABLED = 0;
  buildPhase = ''
    runHook preBuild
    go build -ldflags="-s -w -X 'main.Commit=${rev}' -X 'main.Version=${version}'" ./cmd/abra
    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall
    install -D abra $out/bin/abra
    runHook postInstall
  '';

  postInstall = ''
    export ABRA_DIR="$out"
    $out/bin/abra autocomplete bash >abra.bash
    $out/bin/abra autocomplete fish >abra.fish
    $out/bin/abra autocomplete zsh >abra.zsh
    installShellCompletion abra.{bash,fish,zsh}
  '';

  meta = with lib; {
    description = "The Co-op Cloud utility belt";
    homepage = "https://docs.coopcloud.tech/abra";
    changelog = "https://git.coopcloud.tech/toolshed/abra/releases/tag/${version}";
    mainProgram = "abra";
    license = licenses.gpl3Plus;
    maintainers = "devydave";
  };
}
