diff --git a/pkgs/by-name/no/notation/package.nix b/pkgs/by-name/no/notation/package.nix index c765e172377b..21cef5758c2b 100644 --- a/pkgs/by-name/no/notation/package.nix +++ b/pkgs/by-name/no/notation/package.nix @@ -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;