notation: provide completions when cross-compiling
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
buildGoModule,
|
||||
fetchFromGitHub,
|
||||
installShellFiles,
|
||||
testers,
|
||||
|
||||
stdenv,
|
||||
buildPackages,
|
||||
}:
|
||||
|
||||
buildGoModule (finalAttrs: {
|
||||
@@ -36,12 +38,20 @@ buildGoModule (finalAttrs: {
|
||||
"-X github.com/notaryproject/notation/internal/version.BuildMetadata="
|
||||
];
|
||||
|
||||
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
||||
installShellCompletion --cmd notation \
|
||||
--bash <($out/bin/notation completion bash) \
|
||||
--fish <($out/bin/notation completion fish) \
|
||||
--zsh <($out/bin/notation completion zsh)
|
||||
'';
|
||||
postInstall =
|
||||
let
|
||||
exe =
|
||||
if stdenv.buildPlatform.canExecute stdenv.hostPlatform then
|
||||
"${placeholder "out"}/bin/${finalAttrs.meta.mainProgram}"
|
||||
else
|
||||
lib.getExe buildPackages.notation;
|
||||
in
|
||||
''
|
||||
installShellCompletion --cmd ${finalAttrs.meta.mainProgram} \
|
||||
--bash <(${exe} completion bash) \
|
||||
--fish <(${exe} completion fish) \
|
||||
--zsh <(${exe} completion zsh)
|
||||
'';
|
||||
|
||||
passthru.tests.version = testers.testVersion {
|
||||
package = finalAttrs.finalPackage;
|
||||
|
||||
Reference in New Issue
Block a user