1{ lib, fetchFromGitHub, buildGoModule }:
2
3buildGoModule rec {
4 pname = "scaleway-cli";
5 version = "2.27.0";
6
7 src = fetchFromGitHub {
8 owner = "scaleway";
9 repo = "scaleway-cli";
10 rev = "v${version}";
11 sha256 = "sha256-brcsscNRftlpx73Q6lnbwvFiKoY6csERUUnAsiXwhF0=";
12 };
13
14 vendorHash = "sha256-GDV7BDZb0oHQUbA/Ojx6kzh9kBh0C5RbjYDDzX16LmQ=";
15
16 ldflags = [
17 "-w"
18 "-extldflags"
19 "-static"
20 "-X main.Version=${version}"
21 "-X main.GitCommit=ref/tags/${version}"
22 "-X main.GitBranch=HEAD"
23 "-X main.BuildDate=unknown"
24 ];
25
26 doCheck = true;
27
28 # Some tests require access to scaleway's API, failing when sandboxed
29 preCheck = ''
30 substituteInPlace internal/core/bootstrap_test.go \
31 --replace "TestInterruptError" "SkipInterruptError"
32 substituteInPlace internal/e2e/errors_test.go \
33 --replace "TestStandardErrors" "SkipStandardErrors"
34 substituteInPlace internal/e2e/human_test.go \
35 --replace "TestTestCommand" "SkipTestCommand" \
36 --replace "TestHumanCreate" "SkipHumanCreate" \
37 --replace "TestHumanList" "SkipHumanList" \
38 --replace "TestHumanUpdate" "SkipHumanUpdate" \
39 --replace "TestHumanGet" "SkipHumanGet" \
40 --replace "TestHumanDelete" "SkipHumanDelete"
41 substituteInPlace internal/e2e/sdk_errors_test.go \
42 --replace "TestSdkStandardErrors" "SkipSdkStandardErrors"
43 '';
44
45 doInstallCheck = true;
46
47 installCheckPhase = ''
48 runHook preInstallCheck
49
50 $out/bin/scw --help
51
52 runHook postInstallCheck
53 '';
54
55 meta = with lib; {
56 description = "Interact with Scaleway API from the command line";
57 homepage = "https://github.com/scaleway/scaleway-cli";
58 license = licenses.mit;
59 maintainers = with maintainers; [ nickhu techknowlogick kashw2 ];
60 };
61}