depot/third_party/nixpkgs/pkgs/by-name/op/openfga/package.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

58 lines
1.4 KiB
Nix

{
lib,
buildGoModule,
fetchFromGitHub,
installShellFiles,
}:
let
pname = "openfga";
version = "1.5.4";
in
buildGoModule {
inherit pname version;
src = fetchFromGitHub {
owner = "openfga";
repo = "openfga";
rev = "v${version}";
hash = "sha256-0K4z5CPNx+MVJ1PeB8rmO8+6hDGZ3ZALTFBWwR2Xl1k=";
};
vendorHash = "sha256-sihNWuxwptBrVO9sXD2YNP20mgwYU2y4NSb8wqVWmCk=";
nativeBuildInputs = [ installShellFiles ];
ldflags =
let
buildInfoPkg = "github.com/openfga/openfga/internal/build";
in
[
"-s"
"-w"
"-X ${buildInfoPkg}.Version=${version}"
"-X ${buildInfoPkg}.Commit=${version}"
"-X ${buildInfoPkg}.Date=19700101"
];
# Tests depend on docker
doCheck = false;
postInstall = ''
completions_dir=$TMPDIR/openfga_completions
mkdir $completions_dir
$out/bin/openfga completion bash > $completions_dir/openfga.bash
$out/bin/openfga completion zsh > $completions_dir/_openfga.zsh
$out/bin/openfga completion fish > $completions_dir/openfga.fish
installShellCompletion $completions_dir/*
'';
meta = {
description = "High performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar";
homepage = "https://openfga.dev/";
license = lib.licenses.asl20;
mainProgram = "openfga";
maintainers = with lib.maintainers; [ jlesquembre ];
};
}