depot/third_party/nixpkgs/pkgs/by-name/op/openfga-cli/package.nix
Default email 159e378cbb Project import generated by Copybara.
GitOrigin-RevId: c04d5652cfa9742b1d519688f65d1bbccea9eb7e
2024-09-19 17:19:46 +03:00

55 lines
1.3 KiB
Nix

{
lib,
buildGoModule,
fetchFromGitHub,
installShellFiles,
}:
let
pname = "openfga-cli";
version = "0.6.1";
in
buildGoModule {
inherit pname version;
src = fetchFromGitHub {
owner = "openfga";
repo = "cli";
rev = "v${version}";
hash = "sha256-cAfBEhgHnzmSD8/pVi8VVjnC3O+WgokzdPSzvE5hDec=";
};
vendorHash = "sha256-jIcuyt4tzfz+WkyQnMZs6viLnmwtGbVawgnz9M/xAS8=";
nativeBuildInputs = [ installShellFiles ];
ldflags =
let
buildInfoPkg = "github.com/openfga/cli/internal/build";
in
[
"-s"
"-w"
"-X ${buildInfoPkg}.Version=${version}"
"-X ${buildInfoPkg}.Commit=${version}"
"-X ${buildInfoPkg}.Date=19700101"
];
postInstall = ''
completions_dir=$TMPDIR/fga_completions
mkdir $completions_dir
$out/bin/fga completion bash > $completions_dir/fga.bash
$out/bin/fga completion zsh > $completions_dir/_fga.zsh
$out/bin/fga completion fish > $completions_dir/fga.fish
installShellCompletion $completions_dir/*
'';
meta = {
description = "Cross-platform CLI to interact with an OpenFGA server";
homepage = "https://github.com/openfga/cli";
license = lib.licenses.asl20;
mainProgram = "fga";
maintainers = with lib.maintainers; [ jlesquembre ];
};
}