Merge pull request #329823 from ExpidusOS/fix/pkgsllvm/elfutils
[NixPkgs.git] / pkgs / by-name / op / openfga / package.nix
blob45b15d5f38e5f3be478c0f56c039bfcdf1e00c1c
2   lib,
3   buildGoModule,
4   fetchFromGitHub,
5   installShellFiles,
6 }:
8 let
9   pname = "openfga";
10   version = "1.5.6";
13 buildGoModule {
14   inherit pname version;
16   src = fetchFromGitHub {
17     owner = "openfga";
18     repo = "openfga";
19     rev = "v${version}";
20     hash = "sha256-R5BqaKiW2jhglJ6zPPQF2Ld97YCttocjhfbo0dDGvCI=";
21   };
23   vendorHash = "sha256-zrhLG5msji6t4VPKG85jD8c2XQCRdQkF9UfRMqnzSFM=";
25   nativeBuildInputs = [ installShellFiles ];
27   ldflags =
28     let
29       buildInfoPkg = "github.com/openfga/openfga/internal/build";
30     in
31     [
32       "-s"
33       "-w"
34       "-X ${buildInfoPkg}.Version=${version}"
35       "-X ${buildInfoPkg}.Commit=${version}"
36       "-X ${buildInfoPkg}.Date=19700101"
37     ];
39   # Tests depend on docker
40   doCheck = false;
42   postInstall = ''
43     completions_dir=$TMPDIR/openfga_completions
44     mkdir $completions_dir
45     $out/bin/openfga completion bash > $completions_dir/openfga.bash
46     $out/bin/openfga completion zsh > $completions_dir/_openfga.zsh
47     $out/bin/openfga completion fish > $completions_dir/openfga.fish
48     installShellCompletion $completions_dir/*
49   '';
51   meta = {
52     description = "High performance and flexible authorization/permission engine built for developers and inspired by Google Zanzibar";
53     homepage = "https://openfga.dev/";
54     license = lib.licenses.asl20;
55     mainProgram = "openfga";
56     maintainers = with lib.maintainers; [ jlesquembre ];
57   };