2024-05-15 08:29:37 +00:00
|
|
|
{
|
|
|
|
stdenvNoCC,
|
|
|
|
lib,
|
|
|
|
fetchurl,
|
2024-05-15 08:34:52 +00:00
|
|
|
testers,
|
2024-08-01 07:40:14 +00:00
|
|
|
installShellFiles,
|
2024-05-15 08:34:52 +00:00
|
|
|
upsun
|
2024-05-15 08:29:37 +00:00
|
|
|
}:
|
2024-03-27 09:39:40 +00:00
|
|
|
|
2024-08-01 07:40:14 +00:00
|
|
|
let versions = lib.importJSON ./versions.json;
|
|
|
|
arch = if stdenvNoCC.hostPlatform.isx86_64 then "amd64"
|
|
|
|
else if stdenvNoCC.hostPlatform.isAarch64 then "arm64"
|
|
|
|
else throw "Unsupported architecture";
|
|
|
|
os = if stdenvNoCC.hostPlatform.isLinux then "linux"
|
|
|
|
else if stdenvNoCC.hostPlatform.isDarwin then "darwin"
|
|
|
|
else throw "Unsupported os";
|
|
|
|
versionInfo = versions."${os}-${arch}";
|
|
|
|
inherit (versionInfo) hash url;
|
|
|
|
|
|
|
|
in
|
2024-05-15 08:28:49 +00:00
|
|
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
2024-03-27 09:39:40 +00:00
|
|
|
pname = "upsun";
|
2024-08-01 07:40:14 +00:00
|
|
|
inherit (versions) version;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ installShellFiles ];
|
|
|
|
|
|
|
|
# run ./update
|
|
|
|
src = fetchurl { inherit hash url; };
|
2024-03-27 09:39:40 +00:00
|
|
|
|
|
|
|
dontConfigure = true;
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
sourceRoot = ".";
|
|
|
|
installPhase = ''
|
2024-05-15 08:11:18 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2024-03-27 09:39:40 +00:00
|
|
|
install -Dm755 upsun $out/bin/upsun
|
2024-05-15 08:11:18 +00:00
|
|
|
|
2024-08-01 07:40:14 +00:00
|
|
|
installShellCompletion completion/bash/upsun.bash \
|
|
|
|
completion/zsh/_upsun
|
|
|
|
|
2024-05-15 08:11:18 +00:00
|
|
|
runHook postInstall
|
2024-03-27 09:39:40 +00:00
|
|
|
'';
|
|
|
|
|
2024-05-15 08:34:52 +00:00
|
|
|
passthru = {
|
2024-08-01 07:40:14 +00:00
|
|
|
updateScript = ./update.sh;
|
2024-05-15 08:34:52 +00:00
|
|
|
tests.version = testers.testVersion {
|
|
|
|
inherit (finalAttrs) version;
|
|
|
|
package = upsun;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-03-27 09:39:40 +00:00
|
|
|
meta = {
|
|
|
|
description = "Unified tool for managing your Upsun services from the command line";
|
2024-05-15 08:35:17 +00:00
|
|
|
homepage = "https://github.com/platformsh/cli";
|
|
|
|
license = lib.licenses.mit;
|
2024-05-14 12:31:42 +00:00
|
|
|
mainProgram = "upsun";
|
2024-03-27 09:39:40 +00:00
|
|
|
maintainers = with lib.maintainers; [ spk ];
|
2024-05-14 12:31:42 +00:00
|
|
|
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
2024-03-27 09:39:40 +00:00
|
|
|
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
|
|
|
};
|
2024-05-15 08:28:49 +00:00
|
|
|
})
|