aws-sso-cli: enable postInstall of shell completions (#410652)

This commit is contained in:
Aleksana
2025-06-01 23:13:52 +08:00
committed by GitHub
+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 ];