forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request NixOS#310184 from jlesquembre/jl/openfga-cli
openfga-cli: init at 0.4.0
- Loading branch information
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
lib, | ||
buildGoModule, | ||
fetchFromGitHub, | ||
installShellFiles, | ||
}: | ||
|
||
let | ||
pname = "openfga-cli"; | ||
version = "0.4.0"; | ||
in | ||
|
||
buildGoModule { | ||
inherit pname version; | ||
|
||
src = fetchFromGitHub { | ||
owner = "openfga"; | ||
repo = "cli"; | ||
rev = "v${version}"; | ||
hash = "sha256-nwzUBzu8c8kuSTbjwOB1mCFMLF1zoUReXofXeBOAO1U="; | ||
}; | ||
|
||
vendorHash = "sha256-3fElvsy248lRwmIKWv8ac6BLJ1y5Qyr+kKh/1vprmvo="; | ||
|
||
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 = "A 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 ]; | ||
}; | ||
} |