nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenvNoCC,
3 lib,
4 fetchurl,
5 testers,
6 installShellFiles,
7 upsun,
8}:
9
10let
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;
28
29in
30stdenvNoCC.mkDerivation (finalAttrs: {
31 pname = "upsun";
32 inherit (versions) version;
33
34 nativeBuildInputs = [ installShellFiles ];
35
36 # run ./update
37 src = fetchurl { inherit hash url; };
38
39 dontConfigure = true;
40 dontBuild = true;
41
42 sourceRoot = ".";
43 installPhase = ''
44 runHook preInstall
45
46 install -Dm755 upsun $out/bin/upsun
47
48 installShellCompletion completion/bash/upsun.bash \
49 completion/zsh/_upsun
50
51 runHook postInstall
52 '';
53
54 passthru = {
55 updateScript = ./update.sh;
56 tests.version = testers.testVersion {
57 inherit (finalAttrs) version;
58 package = upsun;
59 };
60 };
61
62 meta = {
63 description = "Unified tool for managing your Upsun services from the command line";
64 homepage = "https://github.com/platformsh/cli";
65 license = lib.licenses.mit;
66 mainProgram = "upsun";
67 maintainers = with lib.maintainers; [ spk ];
68 platforms = [
69 "x86_64-linux"
70 "aarch64-linux"
71 "x86_64-darwin"
72 "aarch64-darwin"
73 ];
74 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
75 };
76})