2022-11-21 17:40:18 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, buildGoModule
|
|
|
|
, coreutils
|
|
|
|
, fetchFromGitHub
|
|
|
|
, installShellFiles
|
|
|
|
, git
|
|
|
|
# passthru
|
|
|
|
, runCommand
|
|
|
|
, makeWrapper
|
|
|
|
, pulumi
|
|
|
|
, pulumiPackages
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
buildGoModule rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "pulumi";
|
2023-03-15 16:39:30 +00:00
|
|
|
version = "3.57.1";
|
2022-11-21 17:40:18 +00:00
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
# Used in pulumi-language packages, which inherit this prop
|
2023-03-08 16:32:21 +00:00
|
|
|
sdkVendorHash = "sha256-oXsU4h4CwukJHttYLT7JiW2He8Yq5qAwnxL8+G5FIpc=";
|
2022-12-28 21:21:41 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2023-03-15 16:39:30 +00:00
|
|
|
hash = "sha256-F5mrk0Qb5Hxjx49KEXEUBN6wB52ztTuV+L37/I0tF48=";
|
2023-02-02 18:25:31 +00:00
|
|
|
# Some tests rely on checkout directory name
|
|
|
|
name = "pulumi";
|
2022-11-21 17:40:18 +00:00
|
|
|
};
|
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
vendorHash = "sha256-G+5UuiIMWQSp5I8EnlWo32jUkg0ini/UhQYA/MTYB0Y=";
|
2022-11-21 17:40:18 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
sourceRoot = "${src.name}/pkg";
|
2022-11-21 17:40:18 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
|
|
|
# Bundle release metadata
|
|
|
|
ldflags = [
|
|
|
|
# Omit the symbol table and debug information.
|
|
|
|
"-s"
|
|
|
|
# Omit the DWARF symbol table.
|
|
|
|
"-w"
|
|
|
|
] ++ importpathFlags;
|
|
|
|
|
|
|
|
importpathFlags = [
|
|
|
|
"-X github.com/pulumi/pulumi/pkg/v3/version.Version=v${version}"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
disabledTests = [
|
|
|
|
# Flaky test
|
|
|
|
"TestPendingDeleteOrder"
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-11-21 17:40:18 +00:00
|
|
|
git
|
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
# The tests require `version.Version` to be unset
|
|
|
|
ldflags=''${ldflags//"$importpathFlags"/}
|
|
|
|
|
|
|
|
# Create some placeholders for plugins used in tests. Otherwise, Pulumi
|
|
|
|
# tries to donwload them and fails, resulting in really long test runs
|
|
|
|
dummyPluginPath=$(mktemp -d)
|
|
|
|
for name in pulumi-{resource-pkg{A,B},-pkgB}; do
|
|
|
|
ln -s ${coreutils}/bin/true "$dummyPluginPath/$name"
|
|
|
|
done
|
|
|
|
|
|
|
|
export PATH=$dummyPluginPath''${PATH:+:}$PATH
|
|
|
|
|
|
|
|
# Code generation tests also download dependencies from network
|
|
|
|
rm codegen/{docs,dotnet,go,nodejs,python,schema}/*_test.go
|
|
|
|
rm -R codegen/{dotnet,go,nodejs,python}/gen_program_test
|
2022-12-17 10:02:37 +00:00
|
|
|
|
|
|
|
# Only run tests not marked as disabled
|
|
|
|
buildFlagsArray+=("-run" "[^(${lib.concatStringsSep "|" disabledTests})]")
|
2022-11-21 17:40:18 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
|
|
|
export PULUMI_HOME=$(mktemp -d)
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
# Allow tests that bind or connect to localhost on macOS.
|
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
PULUMI_SKIP_UPDATE_CHECK=1 $out/bin/pulumi version | grep v${version} > /dev/null
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
postInstall = ''
|
2022-08-12 12:06:08 +00:00
|
|
|
installShellCompletion --cmd pulumi \
|
2022-11-21 17:40:18 +00:00
|
|
|
--bash <($out/bin/pulumi gen-completion bash) \
|
|
|
|
--fish <($out/bin/pulumi gen-completion fish) \
|
|
|
|
--zsh <($out/bin/pulumi gen-completion zsh)
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
passthru = {
|
|
|
|
pkgs = pulumiPackages;
|
|
|
|
withPackages = f: runCommand "${pulumi.name}-with-packages"
|
|
|
|
{
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
}
|
|
|
|
''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
makeWrapper ${pulumi}/bin/pulumi $out/bin/pulumi \
|
|
|
|
--suffix PATH : ${lib.makeSearchPath "bin" (f pulumiPackages)}
|
|
|
|
'';
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://pulumi.io/";
|
|
|
|
description = "Pulumi is a cloud development platform that makes creating cloud programs easy and productive";
|
2023-01-11 07:51:40 +00:00
|
|
|
sourceProvenance = [ sourceTypes.fromSource ];
|
2022-11-21 17:40:18 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [
|
2022-11-21 17:40:18 +00:00
|
|
|
trundle
|
|
|
|
veehaitch
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|