otadump: init at 0.1.2 (#329129)
[NixPkgs.git] / pkgs / by-name / pl / platformsh / package.nix
blobe5960098085d8a3c3a73a3cced8ce1937d35feda
2   stdenvNoCC,
3   lib,
4   fetchurl,
5   testers,
6   installShellFiles,
7   platformsh,
8 }:
10 let
11   versions = lib.importJSON ./versions.json;
12   arch =
13     if stdenvNoCC.hostPlatform.isx86_64 then
14       "amd64"
15     else if stdenvNoCC.hostPlatform.isAarch64 then
16       "arm64"
17     else
18       throw "Unsupported architecture";
19   os =
20     if stdenvNoCC.hostPlatform.isLinux then
21       "linux"
22     else if stdenvNoCC.hostPlatform.isDarwin then
23       "darwin"
24     else
25       throw "Unsupported os";
26   versionInfo = versions."${os}-${arch}";
27   inherit (versionInfo) hash url;
30 stdenvNoCC.mkDerivation (finalAttrs: {
31   pname = "platformsh";
32   inherit (versions) version;
34   nativeBuildInputs = [ installShellFiles ];
36   # run ./update
37   src = fetchurl { inherit hash url; };
39   dontConfigure = true;
40   dontBuild = true;
42   sourceRoot = ".";
43   installPhase = ''
44     runHook preInstall
46     install -Dm755 platform $out/bin/platform
48     installShellCompletion completion/bash/platform.bash \
49         completion/zsh/_platform
51     runHook postInstall
52   '';
54   passthru = {
55     updateScript = ./update.sh;
56     tests.version = testers.testVersion {
57       inherit (finalAttrs) version;
58       package = platformsh;
59     };
60   };
62   meta = {
63     description = "Unified tool for managing your Platform.sh services from the command line";
64     homepage = "https://github.com/platformsh/cli";
65     license = lib.licenses.mit;
66     mainProgram = "platform";
67     maintainers = with lib.maintainers; [
68       shyim
69       spk
70     ];
71     platforms = [
72       "x86_64-linux"
73       "aarch64-linux"
74       "x86_64-darwin"
75       "aarch64-darwin"
76     ];
77     sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
78   };