Skip to content

Commit

Permalink
pulumi: fix cross-compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
tie committed Feb 23, 2025
1 parent 4c14668 commit eee48c7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pkgs/by-name/pu/pulumi/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
fetchFromGitHub,
installShellFiles,
git,
buildPackages,
# passthru
runCommand,
makeWrapper,
testers,
pulumi,
pulumiPackages,
}:
let
canExecute = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
in
buildGoModule rec {
pname = "pulumi";
version = "3.152.0";
Expand Down Expand Up @@ -101,11 +105,15 @@ buildGoModule rec {
# Allow tests that bind or connect to localhost on macOS.
__darwinAllowLocalNetworking = true;

# Implies cross-compilation so we use pulumi from previous stage.
pulumiExe =
if canExecute then "${placeholder "out"}/bin/pulumi" else "${buildPackages.pulumi}/bin/pulumi";

postInstall = ''
installShellCompletion --cmd pulumi \
--bash <($out/bin/pulumi gen-completion bash) \
--fish <($out/bin/pulumi gen-completion fish) \
--zsh <($out/bin/pulumi gen-completion zsh)
for shell in bash fish zsh; do
"$pulumiExe" gen-completion $shell >pulumi.$shell
installShellCompletion pulumi.$shell
done
'';

passthru = {
Expand Down

0 comments on commit eee48c7

Please sign in to comment.