aws-sso-cli: enable postInstall of shell completions

This commit is contained in:
Will Owens
2025-05-26 13:12:51 -04:00
parent 641c8533d1
commit 45c1a1d1e0
+16 -5
View File
@@ -2,6 +2,7 @@
buildGoModule,
fetchFromGitHub,
getent,
installShellFiles,
lib,
makeWrapper,
stdenv,
@@ -19,17 +20,27 @@ buildGoModule rec {
};
vendorHash = "sha256-SNMU7qDfLRGUSLjzrJHtIMgbcRc2DxXwWEUaUEY6PME=";
nativeBuildInputs = [ makeWrapper ];
nativeBuildInputs = [
makeWrapper
installShellFiles
];
ldflags = [
"-X main.Version=${version}"
"-X main.Tag=nixpkgs"
];
postInstall = ''
wrapProgram $out/bin/aws-sso \
--suffix PATH : ${lib.makeBinPath [ xdg-utils ]}
'';
postInstall =
''
wrapProgram $out/bin/aws-sso \
--suffix PATH : ${lib.makeBinPath [ xdg-utils ]}
''
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd aws-sso \
--bash <($out/bin/aws-sso setup completions --source --shell=bash) \
--fish <($out/bin/aws-sso setup completions --source --shell=fish) \
--zsh <($out/bin/aws-sso setup completions --source --shell=zsh)
'';
nativeCheckInputs = [ getent ];