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