nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 buildGoModule,
6 installShellFiles,
7 versionCheckHook,
8 writableTmpDirAsHomeHook,
9}:
10
11buildGoModule (finalAttrs: {
12 pname = "scaleway-cli";
13 version = "2.51.0";
14
15 src = fetchFromGitHub {
16 owner = "scaleway";
17 repo = "scaleway-cli";
18 tag = "v${finalAttrs.version}";
19 hash = "sha256-osA8YWvS2KqQtYmCRIAGw+/h3UPocW0sBn5IDhk/wWg=";
20 };
21
22 vendorHash = "sha256-s3G7zvTCg3voMur4YjHibqsHKLkB79iDgmMhv0C52yY=";
23
24 env.CGO_ENABLED = 0;
25
26 ldflags = [
27 "-s"
28 "-w"
29 "-X main.Version=${finalAttrs.src.tag}"
30 "-X main.GitCommit=${finalAttrs.src.rev}"
31 "-X main.GitBranch=HEAD"
32 "-X main.BuildDate=1970-01-01T00:00:00Z"
33 ];
34
35 subPackages = [
36 "cmd/scw"
37 "commands/..."
38 "core/..."
39 "internal/..."
40 ];
41
42 nativeBuildInputs = [ installShellFiles ];
43 nativeInstallCheckInputs = [ versionCheckHook ];
44 nativeCheckInputs = [ writableTmpDirAsHomeHook ];
45
46 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
47 $out/bin/scw autocomplete script basename=scw shell=bash >scw.bash
48 $out/bin/scw autocomplete script basename=scw shell=fish >scw.fish
49 echo '#compdef scw' >scw.zsh
50 $out/bin/scw autocomplete script basename=scw shell=zsh >>scw.zsh
51 installShellCompletion scw.{bash,fish,zsh}
52 '';
53
54 doInstallCheck = true;
55 versionCheckProgramArg = "version";
56
57 __darwinAllowLocalNetworking = true;
58
59 meta = {
60 description = "Command Line Interface for Scaleway";
61 homepage = "https://github.com/scaleway/scaleway-cli";
62 license = lib.licenses.mit;
63 maintainers = with lib.maintainers; [
64 nickhu
65 techknowlogick
66 kashw2
67 ];
68 mainProgram = "scw";
69 };
70})